[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mpcomplete at chromium.org mpcomplete at chromium.org
Wed Dec 22 13:31:02 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8eeb973b6600b438e64fa89284542b9bb8a025d0
Author: mpcomplete at chromium.org <mpcomplete at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 17 21:57:37 2010 +0000

    2010-09-13  Matt Perry  <mpcomplete at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Have V8DOMWindowShell ask the embedder whether to run a V8 extension
            in a particular script context.
            https://bugs.webkit.org/show_bug.cgi?id=45721
    
            * bindings/v8/V8DOMWindowShell.cpp:
            (WebCore::V8DOMWindowShell::createNewContext):
            * bindings/v8/V8Proxy.cpp:
            (WebCore::V8Proxy::registeredExtensionWithV8):
            (WebCore::V8Proxy::registerExtension):
            * bindings/v8/V8Proxy.h:
            * loader/EmptyClients.h:
            (WebCore::EmptyFrameLoaderClient::allowScriptExtension):
            * loader/FrameLoaderClient.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67749 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 118737d..d3d9160 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-13  Matt Perry  <mpcomplete at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Have V8DOMWindowShell ask the embedder whether to run a V8 extension
+        in a particular script context.
+        https://bugs.webkit.org/show_bug.cgi?id=45721
+
+        * bindings/v8/V8DOMWindowShell.cpp:
+        (WebCore::V8DOMWindowShell::createNewContext):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::registeredExtensionWithV8):
+        (WebCore::V8Proxy::registerExtension):
+        * bindings/v8/V8Proxy.h:
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::allowScriptExtension):
+        * loader/FrameLoaderClient.h:
+
 2010-09-17  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index b07f6fc..76498cd 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -330,23 +330,15 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob
 
     // Used to avoid sleep calls in unload handlers.
     if (!V8Proxy::registeredExtensionWithV8(DateExtension::get()))
-        V8Proxy::registerExtension(DateExtension::get(), String());
+        V8Proxy::registerExtension(DateExtension::get());
 
     // Dynamically tell v8 about our extensions now.
     const V8Extensions& extensions = V8Proxy::extensions();
     OwnArrayPtr<const char*> extensionNames(new const char*[extensions.size()]);
     int index = 0;
     for (size_t i = 0; i < extensions.size(); ++i) {
-        if (extensions[i].group && extensions[i].group != extensionGroup)
-            continue;
-
-        // Note: we check the loader URL here instead of the document URL
-        // because we might be currently loading an URL into a blank page.
-        // See http://code.google.com/p/chromium/issues/detail?id=10924
-        if (extensions[i].scheme.length() > 0 && (extensions[i].scheme != m_frame->loader()->activeDocumentLoader()->url().protocol()))
-            continue;
-
-        extensionNames[index++] = extensions[i].extension->name();
+        if (m_frame->loader()->client()->allowScriptExtension(extensions[i]->name(), extensionGroup))
+            extensionNames[index++] = extensions[i]->name();
     }
     v8::ExtensionConfiguration extensionConfiguration(index, extensionNames.get());
     result = v8::Context::New(&extensionConfiguration, globalTemplate, global);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index a776ee7..e731772 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -832,25 +832,17 @@ void V8Proxy::registerExtensionWithV8(v8::Extension* extension)
 bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension)
 {
     for (size_t i = 0; i < m_extensions.size(); ++i) {
-        if (m_extensions[i].extension == extension)
+        if (m_extensions[i] == extension)
             return true;
     }
 
     return false;
 }
 
-void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
+void V8Proxy::registerExtension(v8::Extension* extension)
 {
     registerExtensionWithV8(extension);
-    V8ExtensionInfo info = {schemeRestriction, 0, extension};
-    m_extensions.append(info);
-}
-
-void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup)
-{
-    registerExtensionWithV8(extension);
-    V8ExtensionInfo info = {String(), extensionGroup, extension};
-    m_extensions.append(info);
+    m_extensions.append(extension);
 }
 
 bool V8Proxy::setContextDebugId(int debugId)
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 7b4d6f6..4d00d57 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -119,17 +119,7 @@ namespace WebCore {
 
     const int kMaxRecursionDepth = 20;
 
-    // Information about an extension that is registered for use with V8. If
-    // scheme is non-empty, it contains the URL scheme the extension should be
-    // used with. If group is non-zero, the extension will only be loaded into
-    // script contexts that belong to that group. Otherwise, the extension is
-    // used with all schemes and contexts.
-    struct V8ExtensionInfo {
-        String scheme;
-        int group;
-        v8::Extension* extension;
-    };
-    typedef WTF::Vector<V8ExtensionInfo> V8Extensions;
+    typedef WTF::Vector<v8::Extension*> V8Extensions;
 
     class V8Proxy {
     public:
@@ -319,15 +309,10 @@ namespace WebCore {
         bool setContextDebugId(int id);
         static int contextDebugId(v8::Handle<v8::Context>);
 
-        // Registers a v8 extension to be available on webpages. The two forms
-        // offer various restrictions on what types of contexts the extension is
-        // loaded into. If a scheme is provided, only pages whose URL has the given
-        // scheme will match. If extensionGroup is provided, the extension will
-        // only be loaded into scripts run via evaluateInNewWorld with the
-        // matching group.  Will only affect v8 contexts initialized after this
-        // call. Takes ownership of the v8::Extension object passed.
-        static void registerExtension(v8::Extension*, const String& schemeRestriction);
-        static void registerExtension(v8::Extension*, int extensionGroup);
+        // Registers a v8 extension to be available on webpages. Will only
+        // affect v8 contexts initialized after this call. Takes ownership of
+        // the v8::Extension object passed.
+        static void registerExtension(v8::Extension*);
 
         static void registerExtensionWithV8(v8::Extension*);
         static bool registeredExtensionWithV8(v8::Extension*);
diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h
index b3a196d..d032f98 100644
--- a/WebCore/loader/EmptyClients.h
+++ b/WebCore/loader/EmptyClients.h
@@ -359,6 +359,7 @@ public:
     virtual void didCreateScriptContextForFrame() { }
     virtual void didDestroyScriptContextForFrame() { }
     virtual void didCreateIsolatedScriptContext() { }
+    virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; }
 #endif
 
 #if PLATFORM(MAC)
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 1b7e9c0..a736b58 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -253,6 +253,7 @@ namespace WebCore {
         virtual void didCreateScriptContextForFrame() = 0;
         virtual void didDestroyScriptContextForFrame() = 0;
         virtual void didCreateIsolatedScriptContext() = 0;
+        virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) = 0;
 #endif
 
         virtual void registerForIconNotification(bool listen = true) = 0;
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index a1d5f13..e3a35b6 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-13  Matt Perry  <mpcomplete at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Have V8DOMWindowShell ask the embedder whether to run a V8 extension
+        in a particular script context.
+        https://bugs.webkit.org/show_bug.cgi?id=45721
+
+        * public/WebFrameClient.h:
+        (WebKit::WebFrameClient::allowScriptExtension):
+        * public/WebScriptController.h:
+        * src/FrameLoaderClientImpl.cpp:
+        (WebKit::FrameLoaderClientImpl::allowScriptExtension):
+        * src/FrameLoaderClientImpl.h:
+        * src/WebScriptController.cpp:
+        (WebKit::WebScriptController::registerExtension):
+
 2010-09-17  Eric Uhrhane  <ericu at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h
index 699325d..9944da1 100644
--- a/WebKit/chromium/public/WebFrameClient.h
+++ b/WebKit/chromium/public/WebFrameClient.h
@@ -301,6 +301,9 @@ public:
     // scripts.
     virtual void didCreateIsolatedScriptContext(WebFrame*) { }
 
+    // Controls whether the given script extension should run in this frame.
+    virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return false; }
+
 
     // Geometry notifications ----------------------------------------------
 
diff --git a/WebKit/chromium/public/WebScriptController.h b/WebKit/chromium/public/WebScriptController.h
index 54bb08a..12d691d 100644
--- a/WebKit/chromium/public/WebScriptController.h
+++ b/WebKit/chromium/public/WebScriptController.h
@@ -43,18 +43,10 @@ class WebString;
 
 class WebScriptController {
 public:
-    // Registers a v8 extension to be available on webpages. The three forms
-    // offer various restrictions on what types of contexts the extension is
-    // loaded into. If a scheme is provided, only pages whose URL has the given
-    // scheme will match. If extensionGroup is provided, the extension will only
-    // be loaded into scripts run via WebFrame::ExecuteInNewWorld with the
-    // matching group.
+    // Registers a v8 extension to be available on webpages.
     // Will only affect v8 contexts initialized after this call. Takes ownership
     // of the v8::Extension object passed.
     WEBKIT_API static void registerExtension(v8::Extension*);
-    WEBKIT_API static void registerExtension(v8::Extension*,
-                                             const WebString& schemeRestriction);
-    WEBKIT_API static void registerExtension(v8::Extension*, int extensionGroup);
 
     // Enables special settings which are only applicable if V8 is executed
     // in the single thread which must be the main thread.
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 368694d..652b085 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.cpp
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
@@ -147,6 +147,14 @@ void FrameLoaderClientImpl::didCreateIsolatedScriptContext()
         m_webFrame->client()->didCreateIsolatedScriptContext(m_webFrame);
 }
 
+bool FrameLoaderClientImpl::allowScriptExtension(const String& extensionName,
+                                                 int extensionGroup)
+{
+    if (m_webFrame->client())
+        return m_webFrame->client()->allowScriptExtension(m_webFrame, extensionName, extensionGroup);
+    return false;
+}
+
 void FrameLoaderClientImpl::didPerformFirstNavigation() const
 {
 }
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.h b/WebKit/chromium/src/FrameLoaderClientImpl.h
index 57105de..64ca830 100644
--- a/WebKit/chromium/src/FrameLoaderClientImpl.h
+++ b/WebKit/chromium/src/FrameLoaderClientImpl.h
@@ -69,6 +69,10 @@ public:
     // in garbage collection.
     virtual void didCreateIsolatedScriptContext();
 
+    // 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 hasWebView() const;
     virtual bool hasFrameView() const;
     virtual void makeRepresentation(WebCore::DocumentLoader*);
diff --git a/WebKit/chromium/src/WebScriptController.cpp b/WebKit/chromium/src/WebScriptController.cpp
index d2c168d..0aa11a6 100644
--- a/WebKit/chromium/src/WebScriptController.cpp
+++ b/WebKit/chromium/src/WebScriptController.cpp
@@ -43,19 +43,7 @@ namespace WebKit {
 
 void WebScriptController::registerExtension(v8::Extension* extension)
 {
-    V8Proxy::registerExtension(extension, WebString());
-}
-
-void WebScriptController::registerExtension(v8::Extension* extension,
-                                            const WebString& schemeRestriction)
-{
-    V8Proxy::registerExtension(extension, schemeRestriction);
-}
-
-void WebScriptController::registerExtension(v8::Extension* extension,
-                                            int extensionGroup)
-{
-    V8Proxy::registerExtension(extension, extensionGroup);
+    V8Proxy::registerExtension(extension);
 }
 
 void WebScriptController::enableV8SingleThreadMode()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list