[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:21:12 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e49e92ba22cbb9a160b0c7561add445a586c0757
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 19 21:22:13 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 Sam Weinig.
    
    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. Crash on Mac
    if NP_GetEntryPoints has been called already. This matches
    Silverlight's behavior.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65703 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index ee3d5e5..5feb5c9 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,23 @@
 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 Sam Weinig.
+
+        * 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-19  Adam Roben  <aroben at apple.com>
+
         Add NetscapePluginWin.cpp
 
         Fixes <http://webkit.org/b/44269> <rdar://problem/8330391>
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 3a26d80..2f784b0 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,25 @@
 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 Sam Weinig.
+
+        * 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. Crash on Mac
+        if NP_GetEntryPoints has been called already. This matches
+        Silverlight's behavior.
+
+2010-08-19  Adam Roben  <aroben at apple.com>
+
         Make build-webkittestrunner build TestNetscapePlugIn on Windows
 
         Fixes <http://webkit.org/b/44268> <rdar://problem/8330388>
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index fcda50b..6088d5b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -31,6 +31,13 @@
 
 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;
+
 #if XP_WIN
 #define STDCALL __stdcall
 
@@ -47,6 +54,16 @@ static inline int strcasecmp(const char* s1, const char* s2)
 extern "C"
 NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs)
 {
+#if XP_WIN
+    // Simulate Flash and QuickTime's behavior of crashing when NP_Initialize is called before NP_GetEntryPoints.
+    if (!getEntryPointsWasCalled)
+        CRASH();
+#elif XP_MACOSX
+    // Simulate Silverlight's behavior of crashing when NP_GetEntryPoints is called before NP_Initialize.
+    if (getEntryPointsWasCalled)
+        CRASH();
+#endif
+
     browser = browserFuncs;
     return NPERR_NO_ERROR;
 }
@@ -54,6 +71,8 @@ NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs)
 extern "C"
 NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
 {
+    getEntryPointsWasCalled = true;
+
     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