| Index: webkit/tools/test_shell/layout_test_controller.cc
|
| ===================================================================
|
| --- webkit/tools/test_shell/layout_test_controller.cc (revision 19799)
|
| +++ webkit/tools/test_shell/layout_test_controller.cc (working copy)
|
| @@ -134,6 +134,7 @@
|
| 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 @@
|
| 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 @@
|
| 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");
|
|
|