Title: [117255] trunk
Revision
117255
Author
[email protected]
Date
2012-05-16 04:03:47 -0700 (Wed, 16 May 2012)

Log Message

[EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation
https://bugs.webkit.org/show_bug.cgi?id=83776

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-05-16
Reviewed by Tor Arne Vestbø.

Source/WebKit/efl:

Added helper new function implementing JS script evaluation in an isolated world.
Worlds are cached by their id.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

Added missing implementation of LayoutTestController::evaluateScriptInIsolatedWorld().

* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::evaluateScriptInIsolatedWorld):

LayoutTests:

Unskipped corresponding testcases.

* platform/efl/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117254 => 117255)


--- trunk/LayoutTests/ChangeLog	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/LayoutTests/ChangeLog	2012-05-16 11:03:47 UTC (rev 117255)
@@ -1,3 +1,14 @@
+2012-05-16  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation
+        https://bugs.webkit.org/show_bug.cgi?id=83776
+
+        Reviewed by Tor Arne Vestbø.
+
+        Unskipped corresponding testcases.
+
+        * platform/efl/test_expectations.txt:
+
 2012-05-16  Christophe Dumez  <[email protected]>
 
         [EFL] http/tests/misc/iframe-reparenting-id-collision.html can be unskipped

Modified: trunk/LayoutTests/platform/efl/test_expectations.txt (117254 => 117255)


--- trunk/LayoutTests/platform/efl/test_expectations.txt	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/LayoutTests/platform/efl/test_expectations.txt	2012-05-16 11:03:47 UTC (rev 117255)
@@ -74,15 +74,12 @@
 // EFL's LayoutTestController does not implement originsWithLocalStorage.
 BUGWKEFL SKIP : storage/domstorage/localstorage/storagetracker = FAIL
 
-// EFL's LayoutTestController does not implement evaluateScriptInIsolatedWorld.
-BUGWKEFL SKIP : http/tests/security/isolatedWorld = FAIL
-BUGWKEFL SKIP : storage/open-database-creation-callback-isolated-world.html = FAIL
-BUGWKEFL SKIP : storage/statement-error-callback-isolated-world.html = FAIL
-BUGWKEFL SKIP : storage/statement-success-callback-isolated-world.html = FAIL
-BUGWKEFL SKIP : storage/transaction-callback-isolated-world.html = FAIL
-BUGWKEFL SKIP : storage/transaction-error-callback-isolated-world.html = FAIL
-BUGWKEFL SKIP : storage/transaction-success-callback-isolated-world.html = FAIL
+// JSC does not support setIsolatedWorldSecurityOrigin.
+BUGWK61540 : http/tests/security/isolatedWorld/cross-origin-xhr.html = FAIL
 
+//__worldID is undefined in isolated world
+BUGWKEFL SKIP : http/tests/security/isolatedWorld/didClearWindowObject.html = FAIL
+
 // EFL's LayoutTestController does not implement layerTreeAsText
 BUGWK82294 : compositing/animation/animation-compositing.html = TEXT
 BUGWK82294 : compositing/geometry/ancestor-overflow-change.html = TEXT

Modified: trunk/Source/WebKit/efl/ChangeLog (117254 => 117255)


--- trunk/Source/WebKit/efl/ChangeLog	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-05-16 11:03:47 UTC (rev 117255)
@@ -1,3 +1,17 @@
+2012-05-16  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation
+        https://bugs.webkit.org/show_bug.cgi?id=83776
+
+        Reviewed by Tor Arne Vestbø.
+
+        Added helper new function implementing JS script evaluation in an isolated world.
+        Worlds are cached by their id.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld):
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+
 2012-05-16  Michał Pakuła vel Rutka  <[email protected]>
 
         [EFL] Add new commands for Ewk_Editor_Command.

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp (117254 => 117255)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp	2012-05-16 11:03:47 UTC (rev 117255)
@@ -45,12 +45,14 @@
 #include <PageGroup.h>
 #include <PrintContext.h>
 #include <RenderTreeAsText.h>
+#include <ScriptValue.h>
 #include <Settings.h>
 #include <TextIterator.h>
 #include <WebKitMutationObserver.h>
 #include <bindings/js/GCController.h>
 #include <history/HistoryItem.h>
 #include <workers/WorkerThread.h>
+#include <wtf/HashMap.h>
 
 unsigned DumpRenderTreeSupportEfl::activeAnimationsCount(const Evas_Object* ewkFrame)
 {
@@ -532,6 +534,49 @@
     return historyItem->isTargetItem();
 }
 
+void DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script)
+{
+    WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame);
+    if (!coreFrame)
+        return;
+
+    // Comment from mac: Start off with some guess at a frame and a global object, we'll try to do better...!
+    WebCore::JSDOMWindow* anyWorldGlobalObject = coreFrame->script()->globalObject(WebCore::mainThreadNormalWorld());
+
+    // Comment from mac: The global object is probably a shell object? - if so, we know how to use this!
+    JSC::JSObject* globalObjectObj = toJS(globalObject);
+    if (!strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell"))
+        anyWorldGlobalObject = static_cast<WebCore::JSDOMWindowShell*>(globalObjectObj)->window();
+
+    // Comment from mac: Get the frame from the global object we've settled on.
+    WebCore::Frame* globalFrame = anyWorldGlobalObject->impl()->frame();
+    if (!globalFrame)
+        return;
+
+    WebCore::ScriptController* proxy = globalFrame->script();
+    if (!proxy)
+        return;
+
+    static WTF::HashMap<int, WTF::RefPtr<WebCore::DOMWrapperWorld > > worldMap;
+
+    WTF::RefPtr<WebCore::DOMWrapperWorld> scriptWorld;
+    if (!worldID)
+        scriptWorld = WebCore::ScriptController::createWorld();
+    else {
+        WTF::HashMap<int, RefPtr<WebCore::DOMWrapperWorld > >::const_iterator it = worldMap.find(worldID);
+        if (it != worldMap.end())
+            scriptWorld = (*it).second;
+        else {
+            scriptWorld = WebCore::ScriptController::createWorld();
+            worldMap.set(worldID, scriptWorld);
+        }
+    }
+
+    // The code below is only valid for JSC, V8 specific code is to be added
+    // when V8 will be supported in EFL port. See Qt implemenation.
+    proxy->executeScriptInWorld(scriptWorld.get(), script, true);
+}
+
 void DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(bool enable)
 {
     WebCore::Settings::setMockScrollbarsEnabled(enable);

Modified: trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h (117254 => 117255)


--- trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h	2012-05-16 11:03:47 UTC (rev 117255)
@@ -88,6 +88,7 @@
     static HistoryItemChildrenVector childHistoryItems(const Ewk_History_Item*);
     static String historyItemTarget(const Ewk_History_Item*);
     static bool isTargetItem(const Ewk_History_Item*);
+    static void evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script);
 
     static void setMockScrollbarsEnabled(bool);
 

Modified: trunk/Tools/ChangeLog (117254 => 117255)


--- trunk/Tools/ChangeLog	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/Tools/ChangeLog	2012-05-16 11:03:47 UTC (rev 117255)
@@ -1,3 +1,15 @@
+2012-05-16  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL] EFL's LayoutTestController  evaluateScriptInIsolatedWorld implementation
+        https://bugs.webkit.org/show_bug.cgi?id=83776
+
+        Reviewed by Tor Arne Vestbø.
+
+        Added missing implementation of LayoutTestController::evaluateScriptInIsolatedWorld().
+
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::evaluateScriptInIsolatedWorld):
+
 2012-05-16  Grzegorz Czajkowski  <[email protected]>
 
         Unreviewed. Add myself as a committer.

Modified: trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp (117254 => 117255)


--- trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-16 10:43:17 UTC (rev 117254)
+++ trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-05-16 11:03:47 UTC (rev 117255)
@@ -724,9 +724,9 @@
     notImplemented();
 }
 
-void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned, JSObjectRef, JSStringRef)
+void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
 {
-    notImplemented();
+    DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(browser->mainFrame(), worldID, globalObject, String(script->ustring().impl()));
 }
 
 void LayoutTestController::removeAllVisitedLinks()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to