Diff
Modified: trunk/Source/WebCore/ChangeLog (103194 => 103195)
--- trunk/Source/WebCore/ChangeLog 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/ChangeLog 2011-12-19 00:37:49 UTC (rev 103195)
@@ -1,3 +1,24 @@
+2011-12-18 James Kozianski <[email protected]>
+
+ [chromium] Add worldId parameter to allowScriptExtension()
+ https://bugs.webkit.org/show_bug.cgi?id=74214
+
+ Chromium uses the worldId to determine what extension is running in a
+ v8 context and knowing that at the time allowScriptExtension() is
+ called allows us to conditionally inject extension APIs.
+
+ Reviewed by Darin Fisher.
+
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::initContextIfNeeded):
+ (WebCore::V8DOMWindowShell::createNewContext):
+ * bindings/v8/V8DOMWindowShell.h:
+ * bindings/v8/V8IsolatedContext.cpp:
+ (WebCore::V8IsolatedContext::V8IsolatedContext):
+ * loader/EmptyClients.h:
+ (WebCore::EmptyFrameLoaderClient::allowScriptExtension):
+ * loader/FrameLoaderClient.h:
+
2011-12-18 Adam Barth <[email protected]>
Adoption agency iteration limits in HTML parser don't match HTML5 spec
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (103194 => 103195)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2011-12-19 00:37:49 UTC (rev 103195)
@@ -305,7 +305,7 @@
isV8Initialized = true;
}
- m_context = createNewContext(m_global, 0);
+ m_context = createNewContext(m_global, 0, 0);
if (m_context.IsEmpty())
return false;
@@ -348,7 +348,7 @@
return true;
}
-v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Object> global, int extensionGroup)
+v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Object> global, int extensionGroup, int worldId)
{
v8::Persistent<v8::Context> result;
@@ -379,7 +379,7 @@
for (size_t i = 0; i < extensions.size(); ++i) {
// Ensure our date extension is always allowed.
if (extensions[i] != DateExtension::get()
- && !m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup))
+ && !m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup, worldId))
continue;
extensionNames[index++] = extensions[i]->name();
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h (103194 => 103195)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2011-12-19 00:37:49 UTC (rev 103195)
@@ -65,7 +65,7 @@
bool isContextInitialized();
- v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global, int extensionGroup);
+ v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global, int extensionGroup, int worldId);
void setContext(v8::Handle<v8::Context>);
static bool installDOMWindow(v8::Handle<v8::Context> context, DOMWindow*);
Modified: trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp (103194 => 103195)
--- trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp 2011-12-19 00:37:49 UTC (rev 103195)
@@ -54,7 +54,7 @@
{
v8::HandleScope scope;
// FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context.
- m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup));
+ m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup, m_world->id()));
if (m_context->get().IsEmpty())
return;
Modified: trunk/Source/WebCore/loader/EmptyClients.h (103194 => 103195)
--- trunk/Source/WebCore/loader/EmptyClients.h 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2011-12-19 00:37:49 UTC (rev 103195)
@@ -394,7 +394,7 @@
#if USE(V8)
virtual void didCreateScriptContext(v8::Handle<v8::Context>, int worldId) { }
virtual void willReleaseScriptContext(v8::Handle<v8::Context>, int worldId) { }
- virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; }
+ virtual bool allowScriptExtension(const String& extensionName, int extensionGroup, int worldId) { return false; }
#endif
#if PLATFORM(MAC)
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (103194 => 103195)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2011-12-19 00:37:49 UTC (rev 103195)
@@ -277,7 +277,7 @@
#if USE(V8)
virtual void didCreateScriptContext(v8::Handle<v8::Context>, int worldId) = 0;
virtual void willReleaseScriptContext(v8::Handle<v8::Context>, int worldId) = 0;
- virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) = 0;
+ virtual bool allowScriptExtension(const String& extensionName, int extensionGroup, int worldId) = 0;
#endif
virtual void registerForIconNotification(bool listen = true) = 0;
Modified: trunk/Source/WebKit/chromium/ChangeLog (103194 => 103195)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-12-19 00:37:49 UTC (rev 103195)
@@ -1,3 +1,20 @@
+2011-12-18 James Kozianski <[email protected]>
+
+ [chromium] Add worldId parameter to allowScriptExtension()
+ https://bugs.webkit.org/show_bug.cgi?id=74214
+
+ Chromium uses the worldId to determine what extension is running in a
+ v8 context and knowing that at the time allowScriptExtension() is
+ called allows us to conditionally inject extension APIs.
+
+ Reviewed by Darin Fisher.
+
+ * public/WebPermissionClient.h:
+ (WebKit::WebPermissionClient::allowScriptExtension):
+ * src/FrameLoaderClientImpl.cpp:
+ (WebKit::FrameLoaderClientImpl::allowScriptExtension):
+ * src/FrameLoaderClientImpl.h:
+
2011-12-18 Sheriff Bot <[email protected]>
Unreviewed, rolling out r103169.
Modified: trunk/Source/WebKit/chromium/public/WebPermissionClient.h (103194 => 103195)
--- trunk/Source/WebKit/chromium/public/WebPermissionClient.h 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebKit/chromium/public/WebPermissionClient.h 2011-12-19 00:37:49 UTC (rev 103195)
@@ -74,6 +74,11 @@
// value.
virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return true; }
+ virtual bool allowScriptExtension(WebFrame* webFrame, const WebString& extensionName, int extensionGroup, int worldId)
+ {
+ return allowScriptExtension(webFrame, extensionName, extensionGroup);
+ }
+
// Controls whether HTML5 Web Storage is allowed for this frame.
// If local is true, then this is for local storage, otherwise it's for session storage.
virtual bool allowStorage(WebFrame*, bool local) { return true; }
Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp (103194 => 103195)
--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp 2011-12-19 00:37:49 UTC (rev 103195)
@@ -155,11 +155,12 @@
#endif
bool FrameLoaderClientImpl::allowScriptExtension(const String& extensionName,
- int extensionGroup)
+ int extensionGroup,
+ int worldId)
{
WebViewImpl* webview = m_webFrame->viewImpl();
if (webview && webview->permissionClient())
- return webview->permissionClient()->allowScriptExtension(m_webFrame, extensionName, extensionGroup);
+ return webview->permissionClient()->allowScriptExtension(m_webFrame, extensionName, extensionGroup, worldId);
return true;
}
Modified: trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h (103194 => 103195)
--- trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h 2011-12-19 00:37:47 UTC (rev 103194)
+++ trunk/Source/WebKit/chromium/src/FrameLoaderClientImpl.h 2011-12-19 00:37:49 UTC (rev 103195)
@@ -68,7 +68,7 @@
// Returns true if we should allow the given V8 extension to be added to
// the script context at the currently loading page and given extension group.
- virtual bool allowScriptExtension(const String& extensionName, int extensionGroup);
+ virtual bool allowScriptExtension(const String& extensionName, int extensionGroup, int worldId);
virtual bool hasWebView() const;
virtual bool hasFrameView() const;