diff options
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 20 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index fd30eb8..374f95f 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -134,6 +134,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) { BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode); BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled); + BindMethod("queueScriptInIsolatedWorld", &LayoutTestController::queueScriptInIsolatedWorld); // The fallback method is called when an unknown method is invoked. BindFallbackMethod(&LayoutTestController::fallbackMethod); @@ -345,6 +346,18 @@ class WorkItemNonLoadingScript : public LayoutTestController::WorkItem { string script_; }; +class WorkItemIsolatedWorldScript : public LayoutTestController::WorkItem { + public: + WorkItemIsolatedWorldScript(const string& script) : script_(script) {} + bool Run(TestShell* shell) { + WebScriptSource source(WebString::fromUTF8(script_)); + shell->webView()->GetMainFrame()->ExecuteScriptInNewContext(&source, 1); + return false; + } + private: + string script_; +}; + void LayoutTestController::queueLoadingScript( const CppArgumentList& args, CppVariant* result) { if (args.size() > 0 && args[0].isString()) @@ -771,6 +784,13 @@ void LayoutTestController::setXSSAuditorEnabled( result->SetNull(); } +void LayoutTestController::queueScriptInIsolatedWorld( + const CppArgumentList& args, CppVariant* result) { + if (args.size() > 0 && args[0].isString()) + work_queue_.AddWork(new WorkItemIsolatedWorldScript(args[0].ToString())); + result->SetNull(); +} + void LayoutTestController::fallbackMethod( const CppArgumentList& args, CppVariant* result) { std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestController"); diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h index fb9f9be..ca8e2a8 100644 --- a/webkit/tools/test_shell/layout_test_controller.h +++ b/webkit/tools/test_shell/layout_test_controller.h @@ -171,6 +171,7 @@ class LayoutTestController : public CppBoundClass { void setPrivateBrowsingEnabled(const CppArgumentList& args, CppVariant* result); void setXSSAuditorEnabled(const CppArgumentList& args, CppVariant* result); + void queueScriptInIsolatedWorld(const CppArgumentList& args, CppVariant* result); // The fallback method is called when a nonexistent method is called on // the layout test controller object. |