• aroben@apple.com's avatar
    Don't call NPP_GetValue if the plugin didn't provide an implementation · f373716e
    aroben@apple.com authored
    Fixes <http://webkit.org/b/48433> Crash in
    NetscapePlugin::shouldLoadSrcURL when using Shockwave Director 10.3 in
    WebKit2 on Windows
    
    Reviewed by Eric Carlson.
    
    WebKit2:
    
    * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
    (WebKit::NetscapePlugin::NPP_GetValue): Null-check the getvalue pointer
    before using it to call NPP_GetValue.
    
    WebKitTools:
    
    Test that WebKit doesn't crash if the plugin passes 0 for its
    NPP_GetValue pointer
    
    * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
    * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
    * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
    * GNUmakefile.am:
    Added NullNPPGetValuePointer.cpp.
    
    * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
    * DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
    Set up a place to store the NPPluginFuncs struct the browser passed to us.
    
    * DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp: Added.
    (NullNPPGetValuePointer::NullNPPGetValuePointer): Null out the
    NPP_GetValue pointer we passed to the browser to simulate a plugin that
    doesn't implement NPP_GetValue.
    (NullNPPGetValuePointer::NPP_GetValue): Print an error message. If this
    function is called, it means that WebKit has changed in a way that
    makes this test invalid.
    
    * DumpRenderTree/TestNetscapePlugIn/main.cpp:
    (NP_GetEntryPoints): Save the NPPluginFuncs struct the browser passed
    to us so we can be naughty and modify it later.
    
    LayoutTests:
    
    Test that WebKit doesn't crash if the plugin passes 0 for its
    NPP_GetValue pointer
    
    * plugins/null-npp-getvalue-pointer-expected.txt: Added.
    * plugins/null-npp-getvalue-pointer.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70653 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f373716e
null-npp-getvalue-pointer-expected.txt 87 Bytes