summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 03:53:05 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-18 03:53:05 +0000
commitac6e3b5ac59eb51272dd0e2d2a38739951a82591 (patch)
tree3a631406471cd7a5d2668f1cff7ed33cfd3f7b38 /webkit
parente6547c10d0e66c56545e929f66ecd6e779e05814 (diff)
downloadchromium_src-ac6e3b5ac59eb51272dd0e2d2a38739951a82591.zip
chromium_src-ac6e3b5ac59eb51272dd0e2d2a38739951a82591.tar.gz
chromium_src-ac6e3b5ac59eb51272dd0e2d2a38739951a82591.tar.bz2
Fix plugin crash caused by removal of EMBED element during NPP_New.
We get into trouble if FrameLoaderClient::createPlugin returns non- null if the EMBED element was removed from the DOM during NPP_New. This CL makes changes to main.cpp to support the layout test, which corresponds to http://trac.webkit.org/changeset/48361. R=jam BUG=21841 TEST=covered by layout test Review URL: http://codereview.chromium.org/211008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc7
-rwxr-xr-xwebkit/tools/layout_tests/test_expectations.txt1
-rw-r--r--webkit/tools/npapi_layout_test_plugin/main.cpp5
3 files changed, 10 insertions, 3 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 4f806cc..b2c91b8 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -35,6 +35,7 @@
#include "webkit/api/public/WebFrameClient.h"
#include "webkit/api/public/WebPlugin.h"
#include "webkit/api/public/WebPluginParams.h"
+#include "webkit/api/public/WebSecurityOrigin.h"
#include "webkit/api/public/WebURL.h"
#include "webkit/api/public/WebURLError.h"
#include "webkit/api/public/WebVector.h"
@@ -987,7 +988,7 @@ void WebFrameLoaderClient::didDisplayInsecureContent() {
void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin) {
if (webframe_->client()) {
webframe_->client()->didRunInsecureContent(webframe_,
- webkit_glue::StringToWebString(origin->toString()));
+ webkit_glue::SecurityOriginToWebSecurityOrigin(origin));
}
}
@@ -1227,6 +1228,10 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(
if (!webplugin->initialize(container.get()))
return NULL;
+ // The element might have been removed during plugin initialization!
+ if (!element->renderer())
+ return NULL;
+
return container;
}
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 203cc67..e4afdad 100755
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -2287,7 +2287,6 @@ BUG21767 : LayoutTests/http/tests/security/cross-frame-access-enumeration.html =
// WK roll to 48371
BUG21840 : LayoutTests/http/tests/loading/basic-auth-resend-wrong-credentials.html = FAIL
BUG21840 : LayoutTests/http/tests/loading/basic-credentials-sent-automatically.html = FAIL
-BUG21841 : LayoutTests/plugins/destroy-during-npp-new.html = FAIL
// missing upstream baseline from 48368
BUG21842 SKIP WIN LINUX : LayoutTests/platform/win/accessibility/scroll-to-anchor.html = FAIL
diff --git a/webkit/tools/npapi_layout_test_plugin/main.cpp b/webkit/tools/npapi_layout_test_plugin/main.cpp
index fbd9b82..b546efe 100644
--- a/webkit/tools/npapi_layout_test_plugin/main.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/main.cpp
@@ -143,6 +143,8 @@ void NPAPI NP_Shutdown(void)
{
}
+static void executeScript(const PluginObject* obj, const char* script);
+
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
if (browser->version >= 14) {
@@ -164,7 +166,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
fflush(stdout);
}
}
- }
+ } else if (strcasecmp(argn[i], "cleardocumentduringnew") == 0)
+ executeScript(obj, "document.body.innerHTML = ''");
}
instance->pdata = obj;