Diff
Modified: trunk/LayoutTests/ChangeLog (114973 => 114974)
--- trunk/LayoutTests/ChangeLog 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/LayoutTests/ChangeLog 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1,3 +1,15 @@
+2012-04-23 Eriq Augustine <eaugu...@chromium.org>
+
+ Return value from executed script in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=79851
+
+ Reviewed by Adam Barth.
+
+ Testing executing a script and getting the result of that script.
+
+ * platform/chromium/http/tests/misc/execute-and-return-value-expected.txt: Added.
+ * platform/chromium/http/tests/misc/execute-and-return-value.html: Added.
+
2012-04-23 Kent Tamura <tk...@chromium.org>
RenderDetailsMarker should draw the triangle inside the content box
Added: trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value-expected.txt (0 => 114974)
--- trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value-expected.txt 2012-04-24 01:10:25 UTC (rev 114974)
@@ -0,0 +1,6 @@
+Expecting 5: 5
+Expecting 3.14: 3.14
+Expecting "The quick brown dog.": The quick brown dog.
+Expecting false: false
+Expecting null: null
+
Added: trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value.html (0 => 114974)
--- trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value.html (rev 0)
+++ trunk/LayoutTests/platform/chromium/http/tests/misc/execute-and-return-value.html 2012-04-24 01:10:25 UTC (rev 114974)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+
+ var intTest = layoutTestController.evaluateScriptInIsolatedWorldAndReturnValue(0, "5");
+ document.body.appendChild(document.createTextNode('Expecting 5: ' + intTest));
+ document.body.appendChild(document.createElement('br'));
+
+ var doubleTest = layoutTestController.evaluateScriptInIsolatedWorldAndReturnValue(0, "3.14");
+ document.body.appendChild(document.createTextNode('Expecting 3.14: ' + doubleTest));
+ document.body.appendChild(document.createElement('br'));
+
+ var stringTest = layoutTestController.evaluateScriptInIsolatedWorldAndReturnValue(0, '"The quick brown dog."');
+ document.body.appendChild(document.createTextNode('Expecting "The quick brown dog.": ' + stringTest));
+ document.body.appendChild(document.createElement('br'));
+
+ var booleanTest = layoutTestController.evaluateScriptInIsolatedWorldAndReturnValue(0, "!true");
+ document.body.appendChild(document.createTextNode('Expecting false: ' + booleanTest));
+ document.body.appendChild(document.createElement('br'));
+
+ var nullTest = layoutTestController.evaluateScriptInIsolatedWorldAndReturnValue(0, "null");
+ document.body.appendChild(document.createTextNode('Expecting null: ' + nullTest));
+ document.body.appendChild(document.createElement('br'));
+}
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (114973 => 114974)
--- trunk/Source/WebCore/ChangeLog 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebCore/ChangeLog 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1,3 +1,24 @@
+2012-04-23 Eriq Augustine <eaugu...@chromium.org>
+
+ Return value from executed script in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=79851
+
+ Reviewed by Adam Barth.
+
+ Providing a varaiant of evaluateScriptInIsolatedWorld that
+ returns the value of the evaluated script.
+
+ Test: platform/chromium/http/tests/misc/execute-and-return-value.html
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInIsolatedWorld):
+ * bindings/v8/ScriptController.h:
+ (ScriptController):
+ * bindings/v8/V8Proxy.cpp:
+ (WebCore::V8Proxy::evaluateInIsolatedWorld):
+ * bindings/v8/V8Proxy.h:
+ (V8Proxy):
+
2012-04-23 Kent Tamura <tk...@chromium.org>
RenderDetailsMarker should draw the triangle inside the content box
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (114973 => 114974)
--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -170,14 +170,22 @@
return ScriptValue(m_proxy->callFunction(function, receiver, argc, argv));
}
-void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources)
+void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, Vector<ScriptValue>* results)
{
- m_proxy->evaluateInIsolatedWorld(worldID, sources, 0);
+ evaluateInIsolatedWorld(worldID, sources, 0, results);
}
-void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup)
+void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, Vector<ScriptValue>* results)
{
- m_proxy->evaluateInIsolatedWorld(worldID, sources, extensionGroup);
+ v8::HandleScope handleScope;
+ if (results) {
+ Vector<v8::Local<v8::Value> > v8Results;
+ m_proxy->evaluateInIsolatedWorld(worldID, sources, extensionGroup, &v8Results);
+ Vector<v8::Local<v8::Value> >::iterator itr;
+ for (itr = v8Results.begin(); itr != v8Results.end(); ++itr)
+ results->append(ScriptValue(*itr));
+ } else
+ m_proxy->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0);
}
void ScriptController::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOrigin> securityOrigin)
@@ -380,7 +388,7 @@
Vector<ScriptSourceCode> sources;
sources.append(source);
// FIXME: Get an ID from the world param.
- evaluateInIsolatedWorld(0, sources);
+ evaluateInIsolatedWorld(0, sources, 0);
}
static NPObject* createNoScriptObject()
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (114973 => 114974)
--- trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -87,7 +87,7 @@
// as a string.
ScriptValue evaluate(const ScriptSourceCode&);
- void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&);
+ void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, Vector<ScriptValue>* results);
// Executes _javascript_ in an isolated world. The script gets its own global scope,
// its own prototypes for intrinsic _javascript_ objects (String, Array, and so-on),
@@ -99,7 +99,7 @@
// If the worldID is 0, a new world is always created.
//
// FIXME: Get rid of extensionGroup here.
- void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&, int extensionGroup);
+ void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, Vector<ScriptValue>* results);
// Associates an isolated world (see above for description) with a security
// origin. XMLHttpRequest instances used in that world will be considered
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (114973 => 114974)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -217,7 +217,7 @@
return true;
}
-void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup)
+void V8Proxy::evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, WTF::Vector<v8::Local<v8::Value> >* results)
{
// FIXME: This will need to get reorganized once we have a windowShell for the isolated world.
if (!windowShell()->initContextIfNeeded())
@@ -240,7 +240,7 @@
// FIXME: We should change this to using window shells to match JSC.
m_isolatedWorlds.set(worldID, isolatedContext);
}
-
+
IsolatedWorldSecurityOriginMap::iterator securityOriginIter = m_isolatedWorldSecurityOrigins.find(worldID);
if (securityOriginIter != m_isolatedWorldSecurityOrigins.end())
isolatedContext->setSecurityOrigin(securityOriginIter->second);
@@ -254,11 +254,17 @@
v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolatedContext->context());
v8::Context::Scope context_scope(context);
- for (size_t i = 0; i < sources.size(); ++i)
- evaluate(sources[i], 0);
+ if (results) {
+ for (size_t i = 0; i < sources.size(); ++i)
+ results->append(evaluate(sources[i], 0));
+ } else {
+ for (size_t i = 0; i < sources.size(); ++i)
+ evaluate(sources[i], 0);
+ }
+
if (worldID == 0)
- isolatedContext->destroy();
+ isolatedContext->destroy();
}
void V8Proxy::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOrigin> prpSecurityOriginIn)
Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (114973 => 114974)
--- trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -147,8 +147,8 @@
// global scope, its own prototypes for intrinsic _javascript_ objects (String,
// Array, and so-on), and its own wrappers for all DOM nodes and DOM
// constructors.
- void evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup);
-
+ void evaluateInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, WTF::Vector<v8::Local<v8::Value> >* result);
+
void setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr<SecurityOrigin>);
// Evaluate a script file in the current execution environment.
Modified: trunk/Source/WebKit/chromium/ChangeLog (114973 => 114974)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1,3 +1,22 @@
+2012-04-23 Eriq Augustine <eaugu...@chromium.org>
+
+ Return value from executed script in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=79851
+
+ Reviewed by Adam Barth.
+
+ Providing a variant of evaluateScriptInIsolatedWorld that
+ returns the value of the evaluated script.
+
+ * public/WebFrame.h:
+ (WebFrame):
+ * src/WebFrameImpl.cpp:
+ (WebKit::WebFrameImpl::executeScriptInIsolatedWorldAndReturnValues):
+ (WebKit):
+ * src/WebFrameImpl.h:
+ (WebKit):
+ (WebFrameImpl):
+
2012-04-23 Raymond Toy <r...@google.com>
Move AudioDestinationChromium FIFO class to its own class.
Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (114973 => 114974)
--- trunk/Source/WebKit/chromium/public/WebFrame.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -276,6 +276,10 @@
virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
const WebScriptSource&) = 0;
+ virtual void executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results) = 0;
+
// Call the function with the given receiver and arguments, bypassing
// canExecute().
virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (114973 => 114974)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -829,7 +829,7 @@
sourcesIn[i].code, sourcesIn[i].url, position));
}
- m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup);
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0);
}
void WebFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin& securityOrigin)
@@ -896,6 +896,28 @@
return m_frame->script()->executeScript(ScriptSourceCode(source.code, source.url, position)).v8Value();
}
+void WebFrameImpl::executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results)
+{
+ Vector<ScriptSourceCode> sources;
+
+ for (unsigned i = 0; i < numSources; ++i) {
+ TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first());
+ sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position));
+ }
+
+ if (results) {
+ Vector<ScriptValue> scriptResults;
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults);
+ WebVector<v8::Local<v8::Value> > v8Results(scriptResults.size());
+ for (unsigned i = 0; i < scriptResults.size(); i++)
+ v8Results[i] = v8::Local<v8::Value>::New(scriptResults[i].v8Value());
+ results->swap(v8Results);
+ } else
+ m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0);
+}
+
// Call the function with the given receiver and arguments, bypassing canExecuteScripts.
v8::Handle<v8::Value> WebFrameImpl::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function,
v8::Handle<v8::Object> receiver,
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (114973 => 114974)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -62,6 +62,8 @@
class WebView;
class WebViewImpl;
+template <typename T> class WebVector;
+
// Implementation of WebFrame, note that this is a reference counted object.
class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> {
public:
@@ -110,6 +112,9 @@
#if WEBKIT_USING_V8
virtual v8::Handle<v8::Value> executeScriptAndReturnValue(
const WebScriptSource&);
+ virtual void executeScriptInIsolatedWorld(
+ int worldID, const WebScriptSource* sourcesIn, unsigned numSources,
+ int extensionGroup, WebVector<v8::Local<v8::Value> >* results);
virtual v8::Handle<v8::Value> callFunctionEvenIfScriptDisabled(
v8::Handle<v8::Function>,
v8::Handle<v8::Object>,
Modified: trunk/Tools/ChangeLog (114973 => 114974)
--- trunk/Tools/ChangeLog 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/ChangeLog 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1,3 +1,41 @@
+2012-04-23 Eriq Augustine <eaugu...@chromium.org>
+
+ Return value from executed script in Chromium.
+ https://bugs.webkit.org/show_bug.cgi?id=79851
+
+ Reviewed by Adam Barth.
+
+ Adding a function to LayoutTestController that evaluates a script in
+ an isolated wold an returns the result of the evaluation.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (evaluateScriptInIsolatedWorldAndReturnValue):
+ (LayoutTestController::staticFunctions):
+ * DumpRenderTree/LayoutTestController.h:
+ (LayoutTestController):
+ * DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::setXSSAuditorEnabled):
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ (LayoutTestController):
+ * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/qt/LayoutTestControllerQt.h:
+ (LayoutTestController):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue):
+
2012-04-23 Dirk Pranke <dpra...@chromium.org>
run-perf-tests fail intermittently with an exception
Modified: trunk/Tools/DumpRenderTree/LayoutTestController.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/LayoutTestController.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/LayoutTestController.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1827,6 +1827,18 @@
return JSValueMakeUndefined(context);
}
+static JSValueRef evaluateScriptInIsolatedWorldAndReturnValueCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ double worldID = JSValueToNumber(context, arguments[0], exception);
+ ASSERT(!*exception);
+ JSRetainPtr<JSStringRef> script(Adopt, JSValueToStringCopy(context, arguments[1], exception));
+ ASSERT(!*exception);
+
+ controller->evaluateScriptInIsolatedWorldAndReturnValue(static_cast<unsigned>(worldID), JSContextGetGlobalObject(context), script.get());
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef elementDoesAutoCompleteForElementWithIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -2351,6 +2363,7 @@
{ "elementDoesAutoCompleteForElementWithId", elementDoesAutoCompleteForElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "encodeHostName", encodeHostNameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "evaluateInWebInspector", evaluateInWebInspectorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "evaluateScriptInIsolatedWorldAndReturnValue", evaluateScriptInIsolatedWorldAndReturnValueCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "evaluateScriptInIsolatedWorld", evaluateScriptInIsolatedWorldCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "execCommand", execCommandCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "findString", findStringCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/LayoutTestController.h (114973 => 114974)
--- trunk/Tools/DumpRenderTree/LayoutTestController.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/LayoutTestController.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -311,6 +311,7 @@
void closeWebInspector();
void evaluateInWebInspector(long callId, JSStringRef script);
void evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
+ void evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script);
void allowRoundingHacks();
bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; }
Modified: trunk/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/blackberry/LayoutTestControllerBlackBerry.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -502,6 +502,14 @@
notImplemented();
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+ UNUSED_PARAM(worldID);
+ UNUSED_PARAM(globalObject);
+ UNUSED_PARAM(script);
+ notImplemented();
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{
UNUSED_PARAM(worldID);
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -128,6 +128,7 @@
bindMethod("enableAutoResizeMode", &LayoutTestController::enableAutoResizeMode);
bindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
bindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
+ bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue);
bindMethod("setIsolatedWorldSecurityOrigin", &LayoutTestController::setIsolatedWorldSecurityOrigin);
bindMethod("execCommand", &LayoutTestController::execCommand);
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
@@ -1334,6 +1335,36 @@
result->setNull();
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList& arguments, CppVariant* result)
+{
+ v8::HandleScope scope;
+ WebVector<v8::Local<v8::Value> > values;
+ if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
+ WebScriptSource source(cppVariantToWebString(arguments[1]));
+ // This relies on the iframe focusing itself when it loads. This is a bit
+ // sketchy, but it seems to be what other tests do.
+ m_shell->webView()->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1, &values);
+ }
+ result->setNull();
+ // Since only one script was added, only one result is expected
+ if (values.size() == 1 && !values[0].IsEmpty()) {
+ v8::Local<v8::Value> scriptValue = values[0];
+ // FIXME: There are many more types that can be handled.
+ if (scriptValue->IsString()) {
+ v8::String::AsciiValue asciiV8(scriptValue);
+ result->set(std::string(*asciiV8));
+ } else if (scriptValue->IsBoolean())
+ result->set(scriptValue->ToBoolean()->Value());
+ else if (scriptValue->IsNumber()) {
+ if (scriptValue->IsInt32())
+ result->set(scriptValue->ToInt32()->Value());
+ else
+ result->set(scriptValue->ToNumber()->Value());
+ } else if (scriptValue->IsNull())
+ result->setNull();
+ }
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (114973 => 114974)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -289,6 +289,7 @@
void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*);
void setAllowRunningOfInsecureContent(const CppArgumentList&, CppVariant*);
+ void evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList&, CppVariant*);
void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
void setIsolatedWorldSecurityOrigin(const CppArgumentList&, CppVariant*);
Modified: trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -692,6 +692,11 @@
notImplemented();
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned, JSObjectRef, JSStringRef)
+{
+ notImplemented();
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned, JSObjectRef, JSStringRef)
{
notImplemented();
Modified: trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -916,6 +916,11 @@
g_free(scriptString);
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+ // FIXME: Implement this.
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{
// FIXME: Implement this.
Modified: trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm (114973 => 114974)
--- trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm 2012-04-24 01:10:25 UTC (rev 114974)
@@ -952,6 +952,11 @@
return 0;
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+ // FIXME: Implement this.
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{
RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script));
Modified: trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -910,6 +910,11 @@
// See https://bugs.webkit.org/show_bug.cgi?id=39485.
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const QString& script)
+{
+ // FIXME: Implement.
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(int worldID, const QString& script)
{
DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(m_drt->webPage()->mainFrame(), worldID, script);
Modified: trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h (114973 => 114974)
--- trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h 2012-04-24 01:10:25 UTC (rev 114974)
@@ -258,6 +258,7 @@
void setEditingBehavior(const QString& editingBehavior);
+ void evaluateScriptInIsolatedWorldAndReturnValue(int worldID, const QString& script);
void evaluateScriptInIsolatedWorld(int worldID, const QString& script);
bool isPageBoxVisible(int pageIndex);
QString pageSizeAndMarginsInPixels(int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft);
Modified: trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -1289,6 +1289,11 @@
return 0;
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+ // FIXME: Implement this.
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{
COMPtr<IWebFramePrivate> framePrivate(Query, frame);
Modified: trunk/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp (114973 => 114974)
--- trunk/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp 2012-04-24 00:57:30 UTC (rev 114973)
+++ trunk/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp 2012-04-24 01:10:25 UTC (rev 114974)
@@ -456,6 +456,11 @@
// FIXME: Implement this.
}
+void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
+{
+
+}
+
void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
{