Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
2011-02-20 Anders Carlsson <andersca@apple.com>
Reviewed by Maciej Stachowiak. Crash when a plug-in requests a javascript: url that destroys the plug-in https://bugs.webkit.org/show_bug.cgi?id=54837 <rdar://problem/9005475> Add new plug-in test. * DumpRenderTree/DumpRenderTree.gypi: * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: (PluginTest::NPN_GetURL): * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: * DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp: Added. (GetURLWithJavaScriptURLDestroyingPlugin::GetURLWithJavaScriptURLDestroyingPlugin): (GetURLWithJavaScriptURLDestroyingPlugin::NPP_New): * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj: * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: 2011-02-20 Anders Carlsson <andersca@apple.com> Reviewed by Maciej Stachowiak. Crash when a plug-in requests a javascript: url that destroys the plug-in https://bugs.webkit.org/show_bug.cgi?id=54837 <rdar://problem/9005475> Add test. * plugins/get-url-with-javascript-destroying-plugin-expected.txt: Added. * plugins/get-url-with-javascript-destroying-plugin.html: Added. 2011-02-20 Anders Carlsson <andersca@apple.com> Reviewed by Maciej Stachowiak. Crash when a plug-in requests a javascript: url that destroys the plug-in https://bugs.webkit.org/show_bug.cgi?id=54837 <rdar://problem/9005475> * WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::destroy): Null out m_pluginController. * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest): Don't access the frame through m_pluginElement since it will be nulled out when the plug-in is destroyed. Canonical link: https://commits.webkit.org/69090@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79157 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Anders Carlsson
committed
Feb 21, 2011
1 parent
4324301
commit 1469e49
Showing
14 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
LayoutTests/plugins/get-url-with-javascript-destroying-plugin-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This tests that evaluating JS that calls NPN_GetURL to evaluate a javascript: URL that destroys the plug-in doesn't crash. | ||
|
||
SUCCESS |
19 changes: 19 additions & 0 deletions
19
LayoutTests/plugins/get-url-with-javascript-destroying-plugin.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script> | ||
function removePlugin() { | ||
var plugin = document.getElementById('plugin'); | ||
plugin.parentNode.removeChild(plugin); | ||
|
||
document.getElementById('console').innerText = 'SUCCESS'; | ||
if (window.layoutTestController) | ||
layoutTestController.notifyDone(); | ||
} | ||
|
||
if (window.layoutTestController) { | ||
layoutTestController.dumpAsText(); | ||
layoutTestController.waitUntilDone(); | ||
} | ||
</script> | ||
<body> | ||
<embed id="plugin" type="application/x-webkit-test-netscape" test="get-url-with-javascript-url-destroying-plugin" width=100 height=100></embed> | ||
<p id="description">This tests that evaluating JS that calls NPN_GetURL to evaluate a javascript: URL that destroys the plug-in doesn't crash.</p> | ||
<div id="console">FAILURE</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2011 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "PluginTest.h" | ||
|
||
using namespace std; | ||
|
||
// From NPP_New, call NPN_GetURL to evaluate JavaScript that destroys the plug-in. | ||
|
||
class GetURLWithJavaScriptURLDestroyingPlugin : public PluginTest { | ||
public: | ||
GetURLWithJavaScriptURLDestroyingPlugin(NPP npp, const string& identifier) | ||
: PluginTest(npp, identifier) | ||
{ | ||
} | ||
|
||
private: | ||
|
||
virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) | ||
{ | ||
NPN_GetURL("javascript:removePlugin()", 0); | ||
return NPERR_NO_ERROR; | ||
} | ||
}; | ||
|
||
static PluginTest::Register<GetURLWithJavaScriptURLDestroyingPlugin> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url-destroying-plugin"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters