[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

aroben at apple.com aroben at apple.com
Wed Dec 22 12:34:46 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9b08ac74653bc66fe7738465716b4919dddd3ae5
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 18:12:47 2010 +0000

    Call NP_GetEntryPoints before NP_Initialize on Windows
    
    Doing otherwise will cause Flash and QuickTime to crash inside
    NP_Initialize.
    
    Fixes <http://webkit.org/b/44270> <rdar://problem/8330393> Crash in
    NP_Initialize when loading QuickTime when running
    plugins/embed-attributes-setting.html in WebKit2 on Windows
    
    Reviewed by John Sullivan.
    
    WebKit2:
    
    * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp:
    (WebKit::NetscapePluginModule::tryLoad): On Windows, first call
    NP_GetEntryPoints, then NP_Initialize. Do the reverse on Mac to
    prevent Silverlight (e.g.) from crashing (see r38858).
    
    WebKitTools:
    
    Test that NP_Initialize and NP_GetEntryPoints are called in the
    correct order
    
    The order differs between Mac and Windows (see r38858).
    
    * DumpRenderTree/TestNetscapePlugIn/main.cpp: Added a CRASH macro and
    a boolean to record whether NP_GetEntryPoints has been called.
    (NP_Initialize): Crash on Windows if NP_GetEntryPoints hasn't been
    called yet. This matches Flash and QuickTime's behavior.
    (NP_GetEntryPoints): Crash on Mac if NP_Initialize hasn't been called
    yet. This matches Silverlight's behavior.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66025 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 88b1735..122a3a1 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-19  Adam Roben  <aroben at apple.com>
+
+        Call NP_GetEntryPoints before NP_Initialize on Windows
+
+        Doing otherwise will cause Flash and QuickTime to crash inside
+        NP_Initialize.
+
+        Fixes <http://webkit.org/b/44270> <rdar://problem/8330393> Crash in
+        NP_Initialize when loading QuickTime when running
+        plugins/embed-attributes-setting.html in WebKit2 on Windows
+
+        Reviewed by John Sullivan.
+
+        * WebProcess/Plugins/Netscape/NetscapePluginModule.cpp:
+        (WebKit::NetscapePluginModule::tryLoad): On Windows, first call
+        NP_GetEntryPoints, then NP_Initialize. Do the reverse on Mac to
+        prevent Silverlight (e.g.) from crashing (see r38858).
+
 2010-08-25  Balazs Kelemen  <kb at inf.u-szeged.hu>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
index a3b8788..b7d4a8e 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginModule.cpp
@@ -129,13 +129,19 @@ bool NetscapePluginModule::tryLoad()
     if (!m_shutdownProcPtr)
         return false;
 
-    if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
-        return false;
-
     m_pluginFuncs.size = sizeof(NPPluginFuncs);
     m_pluginFuncs.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
-    if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR)
+
+    // On Mac, NP_Initialize must be called first, then NP_GetEntryPoints. On Windows, the order is
+    // reversed. Failing to follow this order results in crashes (e.g., in Silverlight on Mac and
+    // in Flash and QuickTime on Windows).
+#if PLATFORM(MAC)
+    if (initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR || getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR)
+        return false;
+#elif PLATFORM(WIN)
+    if (getEntryPointsFuncPtr(&m_pluginFuncs) != NPERR_NO_ERROR || initializeFuncPtr(netscapeBrowserFuncs()) != NPERR_NO_ERROR)
         return false;
+#endif
 
     return true;
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index d4f8e14..90ebb96 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-19  Adam Roben  <aroben at apple.com>
+
+        Test that NP_Initialize and NP_GetEntryPoints are called in the
+        correct order
+
+        The order differs between Mac and Windows (see r38858).
+
+        Fixes <http://webkit.org/b/44270> <rdar://problem/8330393> Crash in
+        NP_Initialize when loading QuickTime when running
+        plugins/embed-attributes-setting.html in WebKit2 on Windows
+
+        Reviewed by John Sullivan.
+
+        * DumpRenderTree/TestNetscapePlugIn/main.cpp: Added a CRASH macro and
+        a boolean to record whether NP_GetEntryPoints has been called.
+        (NP_Initialize): Crash on Windows if NP_GetEntryPoints hasn't been
+        called yet. This matches Flash and QuickTime's behavior.
+        (NP_GetEntryPoints): Crash on Mac if NP_Initialize hasn't been called
+        yet. This matches Silverlight's behavior.
+
 2010-08-25  Martin Robinson  <mrobinson at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index fcda50b..ab22b4e 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -31,6 +31,14 @@
 
 using namespace std;
 
+#define CRASH() do { \
+    *(int *)(uintptr_t)0xbbadbeef = 0; \
+    ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
+} while(false)
+
+static bool getEntryPointsWasCalled;
+static bool initializeWasCalled;
+
 #if XP_WIN
 #define STDCALL __stdcall
 
@@ -47,6 +55,14 @@ static inline int strcasecmp(const char* s1, const char* s2)
 extern "C"
 NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs)
 {
+    initializeWasCalled = true;
+
+#if XP_WIN
+    // Simulate Flash and QuickTime's behavior of crashing when NP_Initialize is called before NP_GetEntryPoints.
+    if (!getEntryPointsWasCalled)
+        CRASH();
+#endif
+
     browser = browserFuncs;
     return NPERR_NO_ERROR;
 }
@@ -54,6 +70,14 @@ NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs)
 extern "C"
 NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
 {
+    getEntryPointsWasCalled = true;
+
+#if XP_MACOSX
+    // Simulate Silverlight's behavior of crashing when NP_GetEntryPoints is called before NP_Initialize.
+    if (!initializeWasCalled)
+        CRASH();
+#endif
+
     pluginFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
     pluginFuncs->size = sizeof(pluginFuncs);
     pluginFuncs->newp = NPP_New;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list