Changeset 83300 in webkit


Ignore:
Timestamp:
Apr 8, 2011 9:00:38 AM (13 years ago)
Author:
Adam Roben
Message:

Pass NPP_SetWindow a null window handle during plugin destruction on non-Mac platforms

This matches WebKit1.

Fixes <http://webkit.org/b/47009> WebKit2 needs to call NPP_SetWindow when destroying a
plugin

Reviewed by Anders Carlsson.

Source/WebKit2:

  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp:

(WebKit::NetscapePlugin::destroy): Null out our NPWindow's window handle and pass it to
NPP_SetWindow (unless we're on Mac).

Tools:

Test that NPP_SetWindow is passed a null window handle during plugin destruction on non-Mac platforms

  • DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:

(pluginLogWithArguments): Moved code to format and log the message here...
(pluginLog): ...from here.

  • DumpRenderTree/TestNetscapePlugIn/PluginObject.h: Added pluginLogWithArguments.
  • DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:

(PluginTest::log): Added. Calls through to pluginLogWithArguments.

  • DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added log.
  • DumpRenderTree/TestNetscapePlugIn/Tests/NPPSetWindowCalledDuringDestruction.cpp: Added.

(NPPSetWindowCalledDuringDestruction::setWillBeDestroyed): Records that destruction is about
to begin.
(NPPSetWindowCalledDuringDestruction::NPPSetWindowCalledDuringDestruction): Simple
constructor.
(NPPSetWindowCalledDuringDestruction::NPP_GetValue): Creates and returns a ScriptObject that
can be used to invoke our setWillBeDestroyed function.
(NPPSetWindowCalledDuringDestruction::NPP_SetWindow): Records what has happened (and logs if
anything unexpected happens).
(NPPSetWindowCalledDuringDestruction::NPP_Destroy): On Mac, logs a failure message if
NPP_SetWindow was called during destruction. On other platforms, logs a failure message if
NPP_SetWindow was *not* called during destruction.
(NPPSetWindowCalledDuringDestruction::ScriptObject::hasMethod): Return true for our only
method, setWillBeDestroyed.
(NPPSetWindowCalledDuringDestruction::ScriptObject::invoke): Call through to the PluginTest
object.

  • DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  • DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
  • DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
  • GNUmakefile.am:

Added new test.

  • Scripts/old-run-webkit-tests: Skip the new test when using out-of-process plugins with

WebKit1 on Mac, since it can't work properly due to <http://webkit.org/b/58077>.

LayoutTests:

Test that NPP_SetWindow is passed a null window handle during plugin destruction on non-Mac platforms

  • platform/win-wk2/Skipped: Removed a test that no longer crashes thanks to this fix.
  • plugins/npp-set-window-called-during-destruction-expected.txt: Added.
  • plugins/npp-set-window-called-during-destruction.html: Added.
  • platform/mac/plugins/npp-set-window-called-during-destruction-expected.txt: Added. This is

different from the cross-platform results because we don't expect NPP_SetWindow to be called
during destruction.

  • platform/win/plugins/npp-set-window-called-during-destruction-expected.txt: Added. This is

a copy of the cross-platform results, needed to override the Mac-specific results.

Location:
trunk
Files:
5 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r83295 r83300  
     12011-04-07  Adam Roben  <aroben@apple.com>
     2
     3        Test that NPP_SetWindow is passed a null window handle during plugin destruction on non-Mac platforms
     4
     5        Test for <http://webkit.org/b/47009> WebKit2 needs to call NPP_SetWindow when destroying a
     6        plugin
     7
     8        Reviewed by Anders Carlsson.
     9
     10        * platform/win-wk2/Skipped: Removed a test that no longer crashes thanks to this fix.
     11
     12        * plugins/npp-set-window-called-during-destruction-expected.txt: Added.
     13        * plugins/npp-set-window-called-during-destruction.html: Added.
     14
     15        * platform/mac/plugins/npp-set-window-called-during-destruction-expected.txt: Added. This is
     16        different from the cross-platform results because we don't expect NPP_SetWindow to be called
     17        during destruction.
     18
     19        * platform/win/plugins/npp-set-window-called-during-destruction-expected.txt: Added. This is
     20        a copy of the cross-platform results, needed to override the Mac-specific results.
     21
    1222011-04-08  Yi Shen  <yi.4.shen@nokia.com>
    223
  • trunk/LayoutTests/platform/win-wk2/Skipped

    r83233 r83300  
    196196fast/frames/iframe-plugin-load-remove-document-crash.html
    197197
    198 # Causes next test to crash? http://webkit.org/b/55780
    199 platform/win/plugins/draws-gradient.html
    200 
    201198# No keygen support
    202199fast/html/keygen.html
  • trunk/Source/WebKit2/ChangeLog

    r83297 r83300  
     12011-04-07  Adam Roben  <aroben@apple.com>
     2
     3        Pass NPP_SetWindow a null window handle during plugin destruction on non-Mac platforms
     4
     5        This matches WebKit1.
     6
     7        Fixes <http://webkit.org/b/47009> WebKit2 needs to call NPP_SetWindow when destroying a
     8        plugin
     9
     10        Reviewed by Anders Carlsson.
     11
     12        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     13        (WebKit::NetscapePlugin::destroy): Null out our NPWindow's window handle and pass it to
     14        NPP_SetWindow (unless we're on Mac).
     15
    1162011-04-08  Jamie Cooley  <james.cooley@nokia.com>
    217
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r82442 r83300  
    492492    stopAllStreams();
    493493
     494#if !PLUGIN_ARCHITECTURE(MAC)
     495    m_npWindow.window = 0;
     496    callSetWindow();
     497#endif
     498
    494499    NPP_Destroy(0);
    495500
  • trunk/Tools/ChangeLog

    r83271 r83300  
     12011-04-07  Adam Roben  <aroben@apple.com>
     2
     3        Test that NPP_SetWindow is passed a null window handle during plugin destruction on non-Mac platforms
     4
     5        Test for <http://webkit.org/b/47009> WebKit2 needs to call NPP_SetWindow when destroying a
     6        plugin
     7
     8        Reviewed by Anders Carlsson.
     9
     10        * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
     11        (pluginLogWithArguments): Moved code to format and log the message here...
     12        (pluginLog): ...from here.
     13
     14        * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: Added pluginLogWithArguments.
     15
     16        * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
     17        (PluginTest::log): Added. Calls through to pluginLogWithArguments.
     18
     19        * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added log.
     20
     21        * DumpRenderTree/TestNetscapePlugIn/Tests/NPPSetWindowCalledDuringDestruction.cpp: Added.
     22        (NPPSetWindowCalledDuringDestruction::setWillBeDestroyed): Records that destruction is about
     23        to begin.
     24        (NPPSetWindowCalledDuringDestruction::NPPSetWindowCalledDuringDestruction): Simple
     25        constructor.
     26        (NPPSetWindowCalledDuringDestruction::NPP_GetValue): Creates and returns a ScriptObject that
     27        can be used to invoke our setWillBeDestroyed function.
     28        (NPPSetWindowCalledDuringDestruction::NPP_SetWindow): Records what has happened (and logs if
     29        anything unexpected happens).
     30        (NPPSetWindowCalledDuringDestruction::NPP_Destroy): On Mac, logs a failure message if
     31        NPP_SetWindow was called during destruction. On other platforms, logs a failure message if
     32        NPP_SetWindow was *not* called during destruction.
     33        (NPPSetWindowCalledDuringDestruction::ScriptObject::hasMethod): Return true for our only
     34        method, setWillBeDestroyed.
     35        (NPPSetWindowCalledDuringDestruction::ScriptObject::invoke): Call through to the PluginTest
     36        object.
     37
     38        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
     39        * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
     40        * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
     41        * GNUmakefile.am:
     42        Added new test.
     43
     44        * Scripts/old-run-webkit-tests: Skip the new test when using out-of-process plugins with
     45        WebKit1 on Mac, since it can't work properly due to <http://webkit.org/b/58077>.
     46
    1472011-04-08  Mario Sanchez Prada  <msanchez@igalia.com>
    248
  • trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

    r83219 r83300  
    140140                BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */; };
    141141                BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCF6C64F0C98E9C000AC063E /* GCController.cpp */; };
     142                C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */; };
    142143                C06F9ABC1267A7060058E1F6 /* PassDifferentNPPStruct.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */; };
    143144                C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */; };
     
    324325                BCD08B700E1059D200A7D0C1 /* AccessibilityControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityControllerMac.mm; path = mac/AccessibilityControllerMac.mm; sourceTree = "<group>"; };
    325326                BCF6C64F0C98E9C000AC063E /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; };
     327                C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPPSetWindowCalledDuringDestruction.cpp; sourceTree = "<group>"; };
    326328                C06F9ABB1267A7060058E1F6 /* PassDifferentNPPStruct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PassDifferentNPPStruct.cpp; sourceTree = "<group>"; };
    327329                C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EvaluateJSAfterRemovingPluginElement.cpp; sourceTree = "<group>"; };
     
    488490                                1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */,
    489491                                1ACF898B132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp */,
     492                                C031182A134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp */,
    490493                                1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */,
    491494                                1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */,
     
    794797                                1ACF898D132EF41C00E915D4 /* NPDeallocateCalledBeforeNPShutdown.cpp in Sources */,
    795798                                1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */,
     799                                C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp in Sources */,
    796800                        );
    797801                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp

    r78359 r83300  
    7474}
    7575             
    76 // Helper function to log to the console object.
    77 void pluginLog(NPP instance, const char* format, ...)
    78 {
    79     va_list args;
    80     va_start(args, format);
     76void pluginLogWithArguments(NPP instance, const char* format, va_list args)
     77{
    8178    char message[2048] = "PLUGIN: ";
    8279    vsprintf(message + strlen(message), format, args);
    83     va_end(args);
    8480
    8581    NPObject* windowObject = 0;
     
    9288    pluginLogWithWindowObject(windowObject, instance, message);
    9389    browser->releaseobject(windowObject);
     90}
     91
     92// Helper function to log to the console object.
     93void pluginLog(NPP instance, const char* format, ...)
     94{
     95    va_list args;
     96    va_start(args, format);
     97    pluginLogWithArguments(instance, format, args);
     98    va_end(args);
    9499}
    95100
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h

    r73226 r83300  
    8888extern void testNPRuntime(NPP npp);
    8989extern void pluginLog(NPP instance, const char* format, ...);
     90extern void pluginLogWithArguments(NPP instance, const char* format, va_list args);
    9091extern bool testDocumentOpen(NPP npp);
    9192extern bool testWindowOpen(NPP npp);
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp

    r82723 r83300  
    2626#include "PluginTest.h"
    2727
     28#include "PluginObject.h"
    2829#include <assert.h>
    2930#include <string.h>
     
    169170}
    170171
     172void PluginTest::log(const char* format, ...)
     173{
     174    va_list args;
     175    va_start(args, format);
     176    pluginLogWithArguments(m_npp, format, args);
     177    va_end(args);
     178}
     179
    171180void PluginTest::waitUntilDone()
    172181{
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h

    r82723 r83300  
    7979
    8080    void executeScript(const char*);
     81    void log(const char* format, ...);
    8182
    8283    void registerNPShutdownFunction(void (*)());
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj

    r82477 r83300  
    408408                        <File
    409409                                RelativePath="..\Tests\NPDeallocateCalledBeforeNPShutdown.cpp"
     410                                >
     411                        </File>
     412                        <File
     413                                RelativePath="..\Tests\NPPSetWindowCalledDuringDestruction.cpp"
    410414                                >
    411415                        </File>
  • trunk/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro

    r82125 r83300  
    3434          Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
    3535          Tests/NPDeallocateCalledBeforeNPShutdown.cpp \
     36          Tests/NPPSetWindowCalledDuringDestruction.cpp \
    3637          Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
    3738          Tests/NPRuntimeRemoveProperty.cpp \
  • trunk/Tools/GNUmakefile.am

    r83219 r83300  
    184184        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
    185185        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPDeallocateCalledBeforeNPShutdown.cpp \
     186        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPPSetWindowCalledDuringDestruction.cpp \
    186187        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
    187188        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp \
  • trunk/Tools/Scripts/old-run-webkit-tests

    r83120 r83300  
    601601}
    602602
     603if (isAppleMacWebKit() && $platform ne "mac-wk2" && osXVersion()->{minor} >= 6 && architecture() =~ /x86_64/) {
     604    # This test relies on executing JavaScript during NPP_Destroy, which isn't supported with
     605    # out-of-process plugins in WebKit1. See <http://webkit.org/b/58077>.
     606    $ignoredFiles{'plugins/npp-set-window-called-during-destruction.html'} = 1;
     607}
     608
    603609processIgnoreTests(join(',', @ignoreTests), "ignore-tests") if @ignoreTests;
    604610if (!$ignoreSkipped) {
Note: See TracChangeset for help on using the changeset viewer.