[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:16:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c7670d6966386ecc926950e29ee088858a6eddc3
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 19 00:07:59 2002 +0000

    WebCore:
    
    	Fixed: 3052731 - qt file complains about lack of active-x handler
    	Fixed: 3025872 - Black square where lion should be on mgm.com
    
    	3052731: The page has a syntax error. Notice the missing ">"? He treat this as an OBJECT without an EMBED. khtml actually has a fallback for this. They check the classid and map a mime type to it. They currently map for  realaudio and flash, but not quicktime. I added a quicktime mapping as well as a mapping for shockwave.
    
    	3025872: khtml was unable to parse the EMBED tag within the OBJECT tag (similar to 3052731). When this happens, it looks at the classid and maps it to a mime type. This part was successful because it has a classid->mime type mapping for flash. The strange thing was that it was setting the main URL of the plug-in to "dummy". The code has this comment:
    
    	url = "dummy"; // Not needed, but KHTMLPart aborts the request if empty
    
    	It does this even if the url is valid. It even handles the invalid url case before even calling the part. The fix is to disable this line of code.
    
            Reviewed by trey.
    
            * khtml/rendering/render_frames.cpp:
            (RenderPartObject::updateWidget):
    
    WebKit:
    
    	Fixed: 2862385 - need to pass browser's user agent and version to plug-ins
    	Added some more error checking to the plug-in code
    
            Reviewed by trey.
    
            * Plugins.subproj/WebBaseNetscapePluginView.h:
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (+[WebBaseNetscapePluginView setCurrentPluginView:]): new, sets a global variable for the current plug-in
            (+[WebBaseNetscapePluginView currentPluginView]): new, returns the current plug-in
            (-[WebBaseNetscapePluginView start]): check if NPP_New fails, return NO if it does, set the current plug-in view. Currently, this is the only place we need to do this.
            (-[WebBaseNetscapePluginView userAgent]): made instance-specific because it depends on the plug-in view's WebController
            * Plugins.subproj/WebBaseNetscapePluginViewPrivate.h:
            * Plugins.subproj/WebNetscapePluginEmbeddedView.m:
            (-[WebNetscapePluginEmbeddedView viewDidMoveToWindow]): don't start the stream is start fails
            * Plugins.subproj/npapi.m:
            (NPN_MemAlloc): tweak
            (NPN_RequestRead): tweak
            (pluginViewForInstance): returns the instance's plug-in view if it has one, if not, return the current plug-in view
            (NPN_GetURLNotify): get the instance from pluginViewForInstance
            (NPN_GetURL):
            (NPN_PostURLNotify):
            (NPN_PostURL):
            (NPN_NewStream):
            (NPN_Write):
            (NPN_DestroyStream):
            (NPN_UserAgent):
            (NPN_Status):
            (NPN_InvalidateRect):
            (NPN_InvalidateRegion):
            (NPN_ForceRedraw):
            (NPN_GetValue):
            (NPN_SetValue):
            (NPN_GetJavaEnv):
            (NPN_GetJavaPeer):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3123 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 630d620..89c9f0f 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,21 @@
+2002-12-18  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3052731 - qt file complains about lack of active-x handler
+	Fixed: 3025872 - Black square where lion should be on mgm.com
+
+	3052731: The page has a syntax error. Notice the missing ">"? He treat this as an OBJECT without an EMBED. khtml actually has a fallback for this. They check the classid and map a mime type to it. They currently map for  realaudio and flash, but not quicktime. I added a quicktime mapping as well as a mapping for shockwave.
+
+	3025872: khtml was unable to parse the EMBED tag within the OBJECT tag (similar to 3052731). When this happens, it looks at the classid and maps it to a mime type. This part was successful because it has a classid->mime type mapping for flash. The strange thing was that it was setting the main URL of the plug-in to "dummy". The code has this comment:
+
+	url = "dummy"; // Not needed, but KHTMLPart aborts the request if empty
+
+	It does this even if the url is valid. It even handles the invalid url case before even calling the part. The fix is to disable this line of code.
+
+        Reviewed by trey.
+
+        * khtml/rendering/render_frames.cpp:
+        (RenderPartObject::updateWidget):
+
 2002-12-18  Trey Matteson  <trey at apple.com>
 
 	3105755 - can't log in to amex
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 630d620..89c9f0f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2002-12-18  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3052731 - qt file complains about lack of active-x handler
+	Fixed: 3025872 - Black square where lion should be on mgm.com
+
+	3052731: The page has a syntax error. Notice the missing ">"? He treat this as an OBJECT without an EMBED. khtml actually has a fallback for this. They check the classid and map a mime type to it. They currently map for  realaudio and flash, but not quicktime. I added a quicktime mapping as well as a mapping for shockwave.
+
+	3025872: khtml was unable to parse the EMBED tag within the OBJECT tag (similar to 3052731). When this happens, it looks at the classid and maps it to a mime type. This part was successful because it has a classid->mime type mapping for flash. The strange thing was that it was setting the main URL of the plug-in to "dummy". The code has this comment:
+
+	url = "dummy"; // Not needed, but KHTMLPart aborts the request if empty
+
+	It does this even if the url is valid. It even handles the invalid url case before even calling the part. The fix is to disable this line of code.
+
+        Reviewed by trey.
+
+        * khtml/rendering/render_frames.cpp:
+        (RenderPartObject::updateWidget):
+
 2002-12-18  Trey Matteson  <trey at apple.com>
 
 	3105755 - can't log in to amex
diff --git a/WebCore/khtml/rendering/render_frames.cpp b/WebCore/khtml/rendering/render_frames.cpp
index 35ffe88..4f24084 100644
--- a/WebCore/khtml/rendering/render_frames.cpp
+++ b/WebCore/khtml/rendering/render_frames.cpp
@@ -692,7 +692,9 @@ void RenderPartObject::updateWidget()
               if(!o->classId.isEmpty()) {
                   // We have a clsid, means this is activex (Niko)
                   serviceType = "application/x-activex-handler";
+#ifndef APPLE_CHANGES
                   url = "dummy"; // Not needed, but KHTMLPart aborts the request if empty
+#endif
               }
 
               if(o->classId.contains(QString::fromLatin1("D27CDB6E-AE6D-11cf-96B8-444553540000"))) {
@@ -706,7 +708,11 @@ void RenderPartObject::updateWidget()
               }
               else if(o->classId.contains(QString::fromLatin1("CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA")))
                   serviceType = "audio/x-pn-realaudio-plugin";
-
+              else if(o->classId.contains(QString::fromLatin1("02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")))
+                  serviceType = "video/quicktime";
+              else if(o->classId.contains(QString::fromLatin1("166B1BCA-3F9C-11CF-8075-444553540000")))
+                  serviceType = "application/x-director";
+              
               // TODO: add more plugins here
           }
 
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7d61c1c..c3b8656 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,40 @@
+2002-12-18  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 2862385 - need to pass browser's user agent and version to plug-ins
+	Added some more error checking to the plug-in code
+
+        Reviewed by trey.
+
+        * Plugins.subproj/WebBaseNetscapePluginView.h:
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (+[WebBaseNetscapePluginView setCurrentPluginView:]): new, sets a global variable for the current plug-in
+        (+[WebBaseNetscapePluginView currentPluginView]): new, returns the current plug-in
+        (-[WebBaseNetscapePluginView start]): check if NPP_New fails, return NO if it does, set the current plug-in view. Currently, this is the only place we need to do this.
+        (-[WebBaseNetscapePluginView userAgent]): made instance-specific because it depends on the plug-in view's WebController
+        * Plugins.subproj/WebBaseNetscapePluginViewPrivate.h:
+        * Plugins.subproj/WebNetscapePluginEmbeddedView.m:
+        (-[WebNetscapePluginEmbeddedView viewDidMoveToWindow]): don't start the stream is start fails
+        * Plugins.subproj/npapi.m: 
+        (NPN_MemAlloc): tweak
+        (NPN_RequestRead): tweak
+        (pluginViewForInstance): returns the instance's plug-in view if it has one, if not, return the current plug-in view
+        (NPN_GetURLNotify): get the instance from pluginViewForInstance  
+        (NPN_GetURL):
+        (NPN_PostURLNotify):
+        (NPN_PostURL):
+        (NPN_NewStream):
+        (NPN_Write):
+        (NPN_DestroyStream):
+        (NPN_UserAgent):
+        (NPN_Status):
+        (NPN_InvalidateRect):
+        (NPN_InvalidateRegion):
+        (NPN_ForceRedraw):
+        (NPN_GetValue):
+        (NPN_SetValue):
+        (NPN_GetJavaEnv):
+        (NPN_GetJavaPeer):
+
 2002-12-18  Richard Williamson   <rjw at apple.com>
 
         Fixed 3109590.  We now set the cookie policy URL to a frame's URL if the
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
index 251fef4..792370b 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.h
@@ -55,7 +55,9 @@
     NPP_SetValueProcPtr NPP_SetValue;
 }
 
-- (void)start;
++ (WebBaseNetscapePluginView *)currentPluginView;
+
+- (BOOL)start;
 - (void)stop;
 
 - (WebFrame *)webFrame;
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index 2eeedd6..55b5b0e 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -29,6 +29,8 @@
 #define NullEventIntervalActive 	0.1
 #define NullEventIntervalNotActive	0.25
 
+static WebBaseNetscapePluginView *currentPluginView = nil;
+
 @implementation WebBaseNetscapePluginView
 
 #pragma mark EVENTS
@@ -465,20 +467,38 @@
     }
 }
 
--(void)start
++ (void)setCurrentPluginView:(WebBaseNetscapePluginView *)view
 {
-    if (isStarted || !canRestart || NPP_New == 0){
-        return;
+    currentPluginView = view;
+}
+
++ (WebBaseNetscapePluginView *)currentPluginView
+{
+    return currentPluginView;
+}
+
+- (BOOL)start
+{
+    if (isStarted) {
+        return YES;
     }
+
+    if (!canRestart || NPP_New == 0) {
+        return NO;
+    }
+
+    [[self class] setCurrentPluginView:self];
     
-    isStarted = YES;
-    
-    NPError npErr;
-    npErr = NPP_New((char *)[MIMEType cString], instance, mode, argsCount, cAttributes, cValues, NULL);
+    NPError npErr = NPP_New((char *)[MIMEType cString], instance, mode, argsCount, cAttributes, cValues, NULL);
     LOG(Plugins, "NPP_New: %d", npErr);
-    
-    // Create a WindowRef is one doesn't already exist
-    [_window windowRef];
+    if (npErr != NPERR_NO_ERROR) {
+        ERROR("NPP_New failed with error: %d", npErr);
+        return NO;
+    }
+
+    [[self class] setCurrentPluginView:nil];
+
+    isStarted = YES;
         
     [self setWindow];
     
@@ -512,6 +532,8 @@
     }
     
     [self resetTrackingRect];
+
+    return YES;
 }
 
 - (void)stop
@@ -958,6 +980,11 @@
     return NPERR_NO_ERROR;
 }
 
+- (const char *)userAgent
+{
+    return [[[self controller] userAgentForURL:baseURL] lossyCString];
+}
+
 -(void)status:(const char *)message
 {    
     if (!message) {
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h b/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
index 936605a..f2c5674 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginViewPrivate.h
@@ -18,8 +18,7 @@
 - (NPError)write:(NPStream*)stream len:(SInt32)len buffer:(void *)buffer;
 - (NPError)destroyStream:(NPStream*)stream reason:(NPReason)reason;
 - (void)status:(const char *)message;
-- (NPError)getValue:(NPNVariable)variable value:(void *)value;
-- (NPError)setValue:(NPPVariable)variable value:(void *)value;
+- (const char *)userAgent;
 - (void)invalidateRect:(NPRect *)invalidRect;
 - (void)invalidateRegion:(NPRegion)invalidateRegion;
 - (void)forceRedraw;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginEmbeddedView.m b/WebKit/Plugins.subproj/WebNetscapePluginEmbeddedView.m
index 029e19d..6a1f7c2 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginEmbeddedView.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginEmbeddedView.m
@@ -52,13 +52,9 @@
 {
     [super viewDidMoveToWindow];
     
-    if ([self window]){
-        [self start];
-        
-        if(URL){
-            WebResourceRequest *request = [WebResourceRequest requestWithURL:URL];
-            [self loadRequest:request inTarget:nil withNotifyData:nil];
-        }
+    if ([self window] && [self start] && URL) {
+        WebResourceRequest *request = [WebResourceRequest requestWithURL:URL];
+        [self loadRequest:request inTarget:nil withNotifyData:nil];
     }
 }
 
diff --git a/WebKit/Plugins.subproj/npapi.m b/WebKit/Plugins.subproj/npapi.m
index df34f3f..55900bb 100644
--- a/WebKit/Plugins.subproj/npapi.m
+++ b/WebKit/Plugins.subproj/npapi.m
@@ -8,19 +8,14 @@
 #import <WebKit/WebKitLogging.h>
 #import "WebBaseNetscapePluginViewPrivate.h"
 
-// general plug-in to browser functions
+WebBaseNetscapePluginView *pluginViewForInstance(NPP instance);
 
-const char* NPN_UserAgent(NPP instance)
-{
-    LOG(Plugins, "NPN_UserAgent");
-    return "Microsoft Internet Explorer";
-}
+// general plug-in to browser functions
 
 void* NPN_MemAlloc(UInt32 size)
 {
     //LOG(Plugins, "NPN_MemAlloc");
     return malloc(size);
-
 }
 
 void NPN_MemFree(void* ptr)
@@ -42,97 +37,109 @@ void NPN_ReloadPlugins(NPBool reloadPages)
 
 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
+    LOG(Plugins, "NPN_RequestRead");
     return NPERR_GENERIC_ERROR;
 }
 
 // instance-specific functions
+// The plugin view is always the ndata of the instance. Sometimes, plug-ins will call an instance-specific function
+// with a NULL instance. To workaround this, call the last plug-in view that made a call to a plug-in.
+// Currently, the current plug-in view is only set before NPP_New in [WebBaseNetscapePluginView start].
+// This specifically works around Flash and Shockwave. When we call NPP_New, they call NPN_UserAgent with a NULL instance.
+WebBaseNetscapePluginView *pluginViewForInstance(NPP instance)
+{
+    if (instance && instance->ndata) {
+        return (WebBaseNetscapePluginView *)instance->ndata;
+    } else {
+        return [WebBaseNetscapePluginView currentPluginView];
+    }
+}
 
 NPError NPN_GetURLNotify(NPP instance, const char* URL, const char* target, void* notifyData)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin getURLNotify:URL target:target notifyData:notifyData];
+    return [pluginViewForInstance(instance) getURLNotify:URL target:target notifyData:notifyData];
 }
 
 NPError NPN_GetURL(NPP instance, const char* URL, const char* target)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin getURL:URL target:target];
+    return [pluginViewForInstance(instance) getURL:URL target:target];
 }
 
 NPError NPN_PostURLNotify(NPP instance, const char* URL, const char* target, UInt32 len, const char* buf, NPBool file, void* notifyData)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin postURLNotify:URL target:target len:len buf:buf file:file notifyData:notifyData];
+    return [pluginViewForInstance(instance) postURLNotify:URL target:target len:len buf:buf file:file notifyData:notifyData];
 }
 
 NPError NPN_PostURL(NPP instance, const char* URL, const char* target, UInt32 len, const char* buf, NPBool file)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin postURL:URL target:target len:len buf:buf file:file];
+    return [pluginViewForInstance(instance) postURL:URL target:target len:len buf:buf file:file];
 }
 
 NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin newStream:type target:target stream:stream];
+    return [pluginViewForInstance(instance) newStream:type target:target stream:stream];
 }
 
 SInt32	NPN_Write(NPP instance, NPStream* stream, SInt32 len, void* buffer)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin write:stream len:len buffer:buffer];
+    return [pluginViewForInstance(instance) write:stream len:len buffer:buffer];
 }
 
 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    return [plugin destroyStream:stream reason:reason];
+    return [pluginViewForInstance(instance) destroyStream:stream reason:reason];
 }
 
-void NPN_Status(NPP instance, const char* message)
+const char* NPN_UserAgent(NPP instance)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    [plugin status:message];
+    return [pluginViewForInstance(instance) userAgent];
 }
 
-// According to the plug-in API documentation, 
-// NPN_GetValue and NPN_SetValue are not used in Mac OS.
-
-NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
+void NPN_Status(NPP instance, const char* message)
 {
-    return NPERR_GENERIC_ERROR;
+    [pluginViewForInstance(instance) status:message];
 }
 
-NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
-{
-    return NPERR_GENERIC_ERROR;
-}	
-
 void NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    [plugin invalidateRect:invalidRect];
+    [pluginViewForInstance(instance) invalidateRect:invalidRect];
 }
 
 void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    [plugin invalidateRegion:invalidRegion];
+    [pluginViewForInstance(instance) invalidateRegion:invalidRegion];
 }
 
 void NPN_ForceRedraw(NPP instance)
 {
-    WebBaseNetscapePluginView *plugin = (WebBaseNetscapePluginView *)instance->ndata;
-    [plugin forceRedraw];
+    [pluginViewForInstance(instance) forceRedraw];
+}
+
+// Unsupported functions
+
+// According to the plug-in API documentation,
+// NPN_GetValue and NPN_SetValue are not used in Mac OS.
+NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
+{
+    LOG(Plugins, "NPN_GetValue");
+    return NPERR_GENERIC_ERROR;
 }
 
+NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
+{
+    LOG(Plugins, "NPN_SetValue");
+    return NPERR_GENERIC_ERROR;
+}	
+
 void* NPN_GetJavaEnv(void)
 {
+    LOG(Plugins, "NPN_GetJavaEnv");
     return NULL;
 }
 
 void* NPN_GetJavaPeer(NPP instance)
 {
+    LOG(Plugins, "NPN_GetJavaPeer");
     return NULL;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list