Reviewed by Darin Adler.
Indicate which one of the ScriptWorlds for a Frame the Window Object has been cleared for
https://bugs.webkit.org/show_bug.cgi?id=45217
WebKit2:
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
(WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame):
* WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
WebKitTools:
Make WebKitTestRunner work with this change.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didClearWindowForFrame):
Make sure the ScriptWorld here is the normal world, since that is no longer being done in
WebFrameLoaderClient.
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66894
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-09-07 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Indicate which one of the ScriptWorlds for a Frame the Window Object has been cleared for
+ https://bugs.webkit.org/show_bug.cgi?id=45217
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+
+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+ (WebKit::InjectedBundlePageLoaderClient::didClearWindowObjectForFrame):
+ * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
+
2010-09-06 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
typedef void (*WKBundlePageDidFinishLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo); // FIXME: Add WKErrorRef.
typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, const void *clientInfo);
-typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo);
+typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo);
typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
typedef void (*WKBundlePageDidChangeLocationWithinPageForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
#include "InjectedBundlePageLoaderClient.h"
+#include "InjectedBundleScriptWorld.h"
#include "WKAPICast.h"
#include "WKBundleAPICast.h"
#include <wtf/text/WTFString.h>
m_client.didReceiveTitleForFrame(toRef(page), toRef(title.impl()), toRef(frame), m_client.clientInfo);
}
-void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, JSGlobalContextRef context, JSObjectRef window)
+void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
{
if (m_client.didClearWindowObjectForFrame)
- m_client.didClearWindowObjectForFrame(toRef(page), toRef(frame), context, window, m_client.clientInfo);
+ m_client.didClearWindowObjectForFrame(toRef(page), toRef(frame), toRef(InjectedBundleScriptWorld::getOrCreate(world).get()), m_client.clientInfo);
}
void InjectedBundlePageLoaderClient::didCancelClientRedirectForFrame(WebPage* page, WebFrame* frame)
#include <JavaScriptCore/JSBase.h>
#include <wtf/Forward.h>
+namespace WebCore {
+class DOMWrapperWorld;
+}
+
namespace WebKit {
class WebPage;
void didFinishLoadForFrame(WebPage*, WebFrame*);
void didFailLoadWithErrorForFrame(WebPage*, WebFrame*);
void didReceiveTitleForFrame(WebPage*, const WTF::String&, WebFrame*);
- void didClearWindowObjectForFrame(WebPage*, WebFrame*, JSGlobalContextRef, JSObjectRef);
+ void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
void didCancelClientRedirectForFrame(WebPage*, WebFrame*);
void willPerformClientRedirectForFrame(WebPage*, WebFrame*, const WTF::String& url, double delay, double date);
void didChangeLocationWithinPageForFrame(WebPage*, WebFrame*);
if (!webPage)
return;
- if (world != mainThreadNormalWorld())
- return;
-
- // FIXME: Is there a way to get this and know that it's a JSGlobalContextRef?
- // The const_cast here is a bit ugly.
- JSGlobalContextRef context = const_cast<JSGlobalContextRef>(toRef(m_frame->coreFrame()->script()->globalObject(world)->globalExec()));
- JSObjectRef windowObject = toRef(m_frame->coreFrame()->script()->globalObject(world));
-
- webPage->injectedBundleLoaderClient().didClearWindowObjectForFrame(webPage, m_frame, context, windowObject);
+ webPage->injectedBundleLoaderClient().didClearWindowObjectForFrame(webPage, m_frame, world);
}
void WebFrameLoaderClient::documentElementAvailable()
+2010-09-07 Jessie Berlin <jberlin@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Indicate which one of the ScriptWorlds for a Frame the Window Object has been cleared for
+ https://bugs.webkit.org/show_bug.cgi?id=45217
+
+ Make WebKitTestRunner work with this change.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+ (WTR::InjectedBundlePage::didClearWindowForFrame):
+ Make sure the ScriptWorld here is the normal world, since that is no longer being done in
+ WebFrameLoaderClient.
+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+
2010-09-07 Philippe Normand <pnormand@igalia.com>
Unreviewed, build fix.
#include <WebKit2/WKBundlePagePrivate.h>
#include <WebKit2/WKRetainPtr.h>
#include <WebKit2/WKBundleRange.h>
+#include <WebKit2/WKBundleScriptWorld.h>
using namespace std;
static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReceiveTitleForFrame(title, frame);
}
-void InjectedBundlePage::didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window, const void *clientInfo)
+void InjectedBundlePage::didClearWindowForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo)
{
- static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, context, window);
+ static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didClearWindowForFrame(frame, world);
}
void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo)
InjectedBundle::shared().os() << "TITLE CHANGED: " << title << "\n";
}
-void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, JSGlobalContextRef context, JSObjectRef window)
+void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world)
{
if (!InjectedBundle::shared().isTestRunning())
return;
+ if (WKBundleScriptWorldNormalWorld() != world)
+ return;
+
+ JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
+ JSObjectRef window = JSContextGetGlobalObject(context);
+
JSValueRef exception = 0;
InjectedBundle::shared().layoutTestController()->makeWindowObject(context, window, &exception);
InjectedBundle::shared().gcController()->makeWindowObject(context, window, &exception);
static void didFinishLoadForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
static void didFailLoadWithErrorForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
static void didReceiveTitleForFrame(WKBundlePageRef, WKStringRef title, WKBundleFrameRef, const void*);
- static void didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window, const void*);
+ static void didClearWindowForFrame(WKBundlePageRef, WKBundleFrameRef, WKBundleScriptWorldRef, const void*);
static void didCancelClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
static void willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef url, double delay, double date, const void*);
static void didChangeLocationWithinPageForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
void didFinishLoadForFrame(WKBundleFrameRef);
void didFailLoadWithErrorForFrame(WKBundleFrameRef);
void didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef);
- void didClearWindowForFrame(WKBundleFrameRef, JSGlobalContextRef, JSObjectRef window);
+ void didClearWindowForFrame(WKBundleFrameRef, WKBundleScriptWorldRef);
void didCancelClientRedirectForFrame(WKBundleFrameRef);
void willPerformClientRedirectForFrame(WKBundleFrameRef, WKURLRef url, double delay, double date);
void didChangeLocationWithinPageForFrame(WKBundleFrameRef);