summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 01:52:56 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 01:52:56 +0000
commit146486ff9a39e4d323df0e60e891e33a1e8d8390 (patch)
treef61da72a65c5c94807b639a6c88b7d8b4369dfb2 /webkit
parenta74efa3f82f1ce5ed2d61cfc1ac22410355eb32f (diff)
downloadchromium_src-146486ff9a39e4d323df0e60e891e33a1e8d8390.zip
chromium_src-146486ff9a39e4d323df0e60e891e33a1e8d8390.tar.gz
chromium_src-146486ff9a39e4d323df0e60e891e33a1e8d8390.tar.bz2
Make all content scripts from an extension run in the same
isolated world. Chromium side of change. Review URL: http://codereview.chromium.org/262002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/api/public/WebFrame.h6
-rw-r--r--webkit/glue/webframe_impl.cc6
-rw-r--r--webkit/glue/webframe_impl.h6
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc9
4 files changed, 15 insertions, 12 deletions
diff --git a/webkit/api/public/WebFrame.h b/webkit/api/public/WebFrame.h
index 07f5cf5..671c550 100644
--- a/webkit/api/public/WebFrame.h
+++ b/webkit/api/public/WebFrame.h
@@ -196,9 +196,9 @@ namespace WebKit {
// extensionGroup is an embedder-provided specifier that controls which
// v8 extensions are loaded into the new context - see
// WebKit::registerExtension for the corresponding specifier.
- virtual void executeScriptInNewWorld(const WebScriptSource* sources,
- unsigned numSources,
- int extensionGroup) = 0;
+ virtual void executeScriptInIsolatedWorld(
+ int worldId, const WebScriptSource* sources, unsigned numSources,
+ int extensionGroup) = 0;
// Logs to the console associated with this frame.
virtual void addMessageToConsole(const WebConsoleMessage&) = 0;
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index 7fd7ce9..511a238 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -628,8 +628,8 @@ void WebFrameImpl::executeScriptInNewContext(
frame_->script()->evaluateInNewContext(sources, extension_group);
}
-void WebFrameImpl::executeScriptInNewWorld(
- const WebScriptSource* sources_in, unsigned num_sources,
+void WebFrameImpl::executeScriptInIsolatedWorld(
+ int world_id, const WebScriptSource* sources_in, unsigned num_sources,
int extension_group) {
Vector<WebCore::ScriptSourceCode> sources;
@@ -640,7 +640,7 @@ void WebFrameImpl::executeScriptInNewWorld(
sources_in[i].startLine));
}
- frame_->script()->evaluateInNewWorld(sources, extension_group);
+ frame_->script()->evaluateInIsolatedWorld(world_id, sources, extension_group);
}
void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) {
diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h
index b4cff81..f840df4 100644
--- a/webkit/glue/webframe_impl.h
+++ b/webkit/glue/webframe_impl.h
@@ -99,9 +99,9 @@ class WebFrameImpl : public WebKit::WebFrame, public RefCounted<WebFrameImpl> {
virtual void executeScriptInNewContext(
const WebKit::WebScriptSource* sources, unsigned num_sources,
int extension_group);
- virtual void executeScriptInNewWorld(
- const WebKit::WebScriptSource* sources, unsigned num_sources,
- int extension_group);
+ virtual void executeScriptInIsolatedWorld(
+ int world_id, const WebKit::WebScriptSource* sources,
+ unsigned num_sources, int extension_group);
virtual void addMessageToConsole(const WebKit::WebConsoleMessage&);
virtual void collectGarbage();
#if WEBKIT_USING_V8
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index 3dd2be2..d757d8b 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -825,9 +825,12 @@ void LayoutTestController::setXSSAuditorEnabled(
void LayoutTestController::evaluateScriptInIsolatedWorld(
const CppArgumentList& args, CppVariant* result) {
- if (args.size() > 0 && args[0].isString()) {
- WebScriptSource source(WebString::fromUTF8(args[0].ToString()));
- shell_->webView()->mainFrame()->executeScriptInNewWorld(&source, 1, 1);
+ if (args.size() >= 2 && args[0].isNumber() && args[1].isString()) {
+ WebScriptSource source(WebString::fromUTF8(args[1].ToString()));
+ // This relies on the iframe focusing itself when it loads. This is a bit
+ // sketchy, but it seems to be what other tests do.
+ shell_->webView()->focusedFrame()->executeScriptInIsolatedWorld(
+ args[0].ToInt32(), &source, 1, 1);
}
result->SetNull();
}