[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
mjs at apple.com
mjs at apple.com
Sun Feb 20 23:27:40 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 7977a5285a92bdf4ebb13ea8e4e502e3468a9fee
Author: mjs at apple.com <mjs at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 20 17:15:50 2011 +0000
2011-01-20 Maciej Stachowiak <mjs at apple.com>
Reviewed by Adam Roben.
WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
https://bugs.webkit.org/show_bug.cgi?id=42327
* platform/mac-wk2/Skipped: Unskip the tests that needed this.
2011-01-20 Maciej Stachowiak <mjs at apple.com>
Reviewed by Adam Roben.
WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
https://bugs.webkit.org/show_bug.cgi?id=42327
Added a new API call, WKBundleFrameForJavaScriptContext, that gets the WKBundleFrameRef
that corresponds to a JSContextRef (or null if none).
* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameForJavaScriptContext): Simple wrapper, defers to a WebFrame
static method.
* WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::frameForContext): Follow the maze of twisty pointers.
* WebProcess/WebPage/WebFrame.h:
2011-01-20 Maciej Stachowiak <mjs at apple.com>
Reviewed by Adam Roben.
WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
https://bugs.webkit.org/show_bug.cgi?id=42327
* WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm: Add support
for methods that take their normal arguments but also a JSContextRef.
* WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: IDL definition
for evaluateScriptInIsolatedWorld.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didClearWindowForFrame): Set a magic variable only if
this call is for an isolated world.
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::worldMap): Helper to create a world map.
(WTR::LayoutTestController::worldIDForWorld): Map from an ID to a world.
(WTR::LayoutTestController::evaluateScriptInIsolatedWorld): The newly
added LayoutTestController API.
* WebKitTestRunner/InjectedBundle/LayoutTestController.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76259 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 36a300b..11562cf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-20 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
+ https://bugs.webkit.org/show_bug.cgi?id=42327
+
+ * platform/mac-wk2/Skipped: Unskip the tests that needed this.
+
2011-01-19 Adam Roben <aroben at apple.com>
Add a test that scrolls composited content that has already been painted
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index 42c6f1a..3839cc6 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -56,6 +56,8 @@ compositing/iframes/iframe-src-change.html
# WebKitTestRunner needs an implementation of eventSender
# <https://bugs.webkit.org/show_bug.cgi?id=42194>
+http/tests/security/isolatedWorld/events.html
+http/tests/security/isolatedWorld/userGestureEvents.html
http/tests/misc/isindex-with-no-form-base-href.html
plugins/clicking-missing-plugin-fires-delegate.html
editing/deleting/delete-by-word-001.html
@@ -1284,36 +1286,6 @@ webarchive/test-table-background.html
webarchive/test-td-background.html
webarchive/test-xml-stylesheet.xml
-# WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
-# <https://bugs.webkit.org/show_bug.cgi?id=42327>
-http/tests/security/isolatedWorld/all-window-properties.html
-http/tests/security/isolatedWorld/all-window-prototypes.html
-http/tests/security/isolatedWorld/body-properties.html
-http/tests/security/isolatedWorld/body-prototype.html
-http/tests/security/isolatedWorld/click-event.html
-http/tests/security/isolatedWorld/didClearWindowObject.html
-http/tests/security/isolatedWorld/dispatchEvent.html
-http/tests/security/isolatedWorld/document-open.html
-http/tests/security/isolatedWorld/document-properties.html
-http/tests/security/isolatedWorld/document-prototype.html
-http/tests/security/isolatedWorld/events.html
-http/tests/security/isolatedWorld/global-variables.html
-http/tests/security/isolatedWorld/image-properties.html
-http/tests/security/isolatedWorld/image-prototype.html
-http/tests/security/isolatedWorld/location-properties.html
-http/tests/security/isolatedWorld/location-prototype.html
-http/tests/security/isolatedWorld/number-prototype.html
-http/tests/security/isolatedWorld/object-prototype.html
-http/tests/security/isolatedWorld/storage-properties.html
-http/tests/security/isolatedWorld/storage-prototype.html
-http/tests/security/isolatedWorld/string-prototype.html
-http/tests/security/isolatedWorld/top-properties.html
-http/tests/security/isolatedWorld/userGestureEvents.html
-http/tests/security/isolatedWorld/window-properties.html
-http/tests/security/isolatedWorld/window-setTimeout-function.html
-http/tests/security/isolatedWorld/window-setTimeout-string.html
-http/tests/security/isolatedWorld/world-reuse.html
-
# WebKitTestRunner needs to support layoutTestController.setJavaScriptProfilingEnabled
# <https://bugs.webkit.org/show_bug.cgi?id=42328>
fast/profiler
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index fd72c75..1e6c768 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-20 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
+ https://bugs.webkit.org/show_bug.cgi?id=42327
+
+ Added a new API call, WKBundleFrameForJavaScriptContext, that gets the WKBundleFrameRef
+ that corresponds to a JSContextRef (or null if none).
+
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+ (WKBundleFrameForJavaScriptContext): Simple wrapper, defers to a WebFrame
+ static method.
+ * WebProcess/InjectedBundle/API/c/WKBundleFrame.h:
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::frameForContext): Follow the maze of twisty pointers.
+ * WebProcess/WebPage/WebFrame.h:
+
2011-01-20 Alejandro G. Castro <alex at igalia.com>
Fix compilation error in GTK WebKit2.
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
index 9410642..ec1c7bd 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp
@@ -85,6 +85,11 @@ JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frameRef)
return toImpl(frameRef)->jsContext();
}
+WKBundleFrameRef WKBundleFrameForJavaScriptContext(JSContextRef context)
+{
+ return toAPI(WebFrame::frameForContext(context));
+}
+
JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frameRef, WKBundleScriptWorldRef worldRef)
{
return toImpl(frameRef)->jsContextForWorld(toImpl(worldRef));
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
index a6a20b2..eff82d9 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h
@@ -46,6 +46,8 @@ WK_EXPORT WKURLRef WKBundleFrameCopyProvisionalURL(WKBundleFrameRef frame);
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContext(WKBundleFrameRef frame);
WK_EXPORT JSGlobalContextRef WKBundleFrameGetJavaScriptContextForWorld(WKBundleFrameRef frame, WKBundleScriptWorldRef world);
+WK_EXPORT WKBundleFrameRef WKBundleFrameForJavaScriptContext(JSContextRef context);
+
WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForNodeForWorld(WKBundleFrameRef frame, WKBundleNodeHandleRef nodeHandle, WKBundleScriptWorldRef world);
WK_EXPORT JSValueRef WKBundleFrameGetJavaScriptWrapperForRangeForWorld(WKBundleFrameRef frame, WKBundleRangeHandleRef rangeHandle, WKBundleScriptWorldRef world);
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
index c5f117e..8dcabf0 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
@@ -34,6 +34,7 @@
#include "WebPageProxyMessages.h"
#include "WebProcess.h"
#include <JavaScriptCore/APICast.h>
+#include <JavaScriptCore/JSContextRef.h>
#include <JavaScriptCore/JSLock.h>
#include <JavaScriptCore/JSValueRef.h>
#include <WebCore/AnimationController.h>
@@ -455,6 +456,17 @@ JSGlobalContextRef WebFrame::jsContextForWorld(InjectedBundleScriptWorld* world)
return toGlobalRef(m_coreFrame->script()->globalObject(world->coreWorld())->globalExec());
}
+WebFrame* WebFrame::frameForContext(JSContextRef context)
+{
+ JSObjectRef globalObjectRef = JSContextGetGlobalObject(context);
+ JSC::JSObject* globalObjectObj = toJS(globalObjectRef);
+ if (strcmp(globalObjectObj->classInfo()->className, "JSDOMWindowShell") != 0)
+ return 0;
+
+ Frame* coreFrame = static_cast<JSDOMWindowShell*>(globalObjectObj)->window()->impl()->frame();
+ return static_cast<WebFrameLoaderClient*>(coreFrame->loader()->client())->webFrame();
+}
+
JSValueRef WebFrame::jsWrapperForWorld(InjectedBundleNodeHandle* nodeHandle, InjectedBundleScriptWorld* world)
{
JSDOMWindow* globalObject = m_coreFrame->script()->globalObject(world->coreWorld());
diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
index 3ded6f6..0115dee 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h
@@ -90,6 +90,8 @@ public:
JSGlobalContextRef jsContext();
JSGlobalContextRef jsContextForWorld(InjectedBundleScriptWorld*);
+ static WebFrame* frameForContext(JSContextRef);
+
JSValueRef jsWrapperForWorld(InjectedBundleNodeHandle*, InjectedBundleScriptWorld*);
JSValueRef jsWrapperForWorld(InjectedBundleRangeHandle*, InjectedBundleScriptWorld*);
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 12e4c17..4aea0a2 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-20 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Adam Roben.
+
+ WebKitTestRunner needs to support layoutTestController.evaluateScriptInIsolatedWorld
+ https://bugs.webkit.org/show_bug.cgi?id=42327
+
+ * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm: Add support
+ for methods that take their normal arguments but also a JSContextRef.
+ * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl: IDL definition
+ for evaluateScriptInIsolatedWorld.
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::didClearWindowForFrame): Set a magic variable only if
+ this call is for an isolated world.
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::worldMap): Helper to create a world map.
+ (WTR::LayoutTestController::worldIDForWorld): Map from an ID to a world.
+ (WTR::LayoutTestController::evaluateScriptInIsolatedWorld): The newly
+ added LayoutTestController API.
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+
2011-01-19 Adam Roben <aroben at apple.com>
Convert paths in environment variables back to msys-style inside commit-log-editor
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm b/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
index 0de2fd0..2f5c66f 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
@@ -256,6 +256,10 @@ EOF
$self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
+ if ($function->signature->extendedAttributes->{"PassContext"}) {
+ push(@parameters, "context");
+ }
+
foreach my $i (0..$#specifiedParameters) {
my $parameter = $specifiedParameters[$i];
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index acc2f47..a88a838 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -76,6 +76,9 @@ module WTR {
// Text search testing.
boolean findString(in DOMString target, in object optionsArray);
+
+ // Evaluating script in a special context
+ [PassContext] void evaluateScriptInIsolatedWorld(in unsigned long worldID, in DOMString script)
};
}
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 656f97a..c5f4909 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -526,12 +526,14 @@ void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundle
if (!InjectedBundle::shared().isTestRunning())
return;
- if (WKBundleScriptWorldNormalWorld() != world)
- return;
-
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
JSObjectRef window = JSContextGetGlobalObject(context);
+ if (WKBundleScriptWorldNormalWorld() != world) {
+ JSObjectSetProperty(context, window, toJS("__worldID").get(), JSValueMakeNumber(context, LayoutTestController::worldIDForWorld(world)), kJSPropertyAttributeReadOnly, 0);
+ return;
+ }
+
JSValueRef exception = 0;
InjectedBundle::shared().layoutTestController()->makeWindowObject(context, window, &exception);
InjectedBundle::shared().gcController()->makeWindowObject(context, window, &exception);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index c8a6f84..13c7b10 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -37,6 +37,7 @@
#include <WebKit2/WKBundlePrivate.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WebKit2.h>
+#include <wtf/HashMap.h>
namespace WTR {
@@ -308,4 +309,44 @@ void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef wi
setProperty(context, windowObject, "layoutTestController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
}
+typedef WTF::HashMap<unsigned, WKRetainPtr<WKBundleScriptWorldRef> > WorldMap;
+static WorldMap& worldMap()
+{
+ static WorldMap& map = *new WorldMap;
+ return map;
+}
+
+unsigned LayoutTestController::worldIDForWorld(WKBundleScriptWorldRef world)
+{
+ WorldMap::const_iterator end = worldMap().end();
+ for (WorldMap::const_iterator it = worldMap().begin(); it != end; ++it) {
+ if (it->second == world)
+ return it->first;
+ }
+
+ return 0;
+}
+
+void LayoutTestController::evaluateScriptInIsolatedWorld(JSContextRef context, unsigned worldID, JSStringRef script)
+{
+ // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world
+ // that is created once and cached forever.
+ WKRetainPtr<WKBundleScriptWorldRef> world;
+ if (!worldID)
+ world.adopt(WKBundleScriptWorldCreateWorld());
+ else {
+ WKRetainPtr<WKBundleScriptWorldRef>& worldSlot = worldMap().add(worldID, 0).first->second;
+ if (!worldSlot)
+ worldSlot.adopt(WKBundleScriptWorldCreateWorld());
+ world = worldSlot;
+ }
+
+ WKBundleFrameRef frame = WKBundleFrameForJavaScriptContext(context);
+ if (!frame)
+ frame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+
+ JSGlobalContextRef jsContext = WKBundleFrameGetJavaScriptContextForWorld(frame, world.get());
+ JSEvaluateScript(jsContext, script, 0, 0, 0, 0);
+}
+
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 2aaad08..1f81970 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -28,6 +28,7 @@
#include "JSWrappable.h"
#include <JavaScriptCore/JSRetainPtr.h>
+#include <WebKit2/WKBundleScriptWorld.h>
#include <string>
#include <wtf/PassRefPtr.h>
@@ -122,6 +123,9 @@ public:
bool shouldCloseExtraWindowsAfterRunningTest() const { return m_shouldCloseExtraWindows; }
+ void evaluateScriptInIsolatedWorld(JSContextRef, unsigned worldID, JSStringRef script);
+ static unsigned worldIDForWorld(WKBundleScriptWorldRef);
+
private:
static const double waitToDumpWatchdogTimerInterval;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list