[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:39:27 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit beb421f7c4d133484dc20724f11e653e41a1aa5d
Author: mpcomplete at chromium.org <mpcomplete at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 22 18:59:06 2010 +0000

    2010-09-22  Matt Perry  <mpcomplete at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Trying to reland a version of r67749:
            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::registerExtension):
            * bindings/v8/V8Proxy.h:
            * loader/EmptyClients.h:
            (WebCore::EmptyFrameLoaderClient::allowScriptExtension):
            * loader/FrameLoaderClient.h:
    2010-09-22  Matt Perry  <mpcomplete at chromium.org>
    
            Reviewed by Darin Fisher.
    
            Trying to reland a version of r67749:
            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):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68061 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f9badac..f5b3609 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-22  Matt Perry  <mpcomplete at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Trying to reland a version of r67749:
+        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::registerExtension):
+        * bindings/v8/V8Proxy.h:
+        * loader/EmptyClients.h:
+        (WebCore::EmptyFrameLoaderClient::allowScriptExtension):
+        * loader/FrameLoaderClient.h:
+
 2010-09-22  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index b07f6fc..e2567a8 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -340,11 +340,18 @@ v8::Persistent<v8::Context> V8DOMWindowShell::createNewContext(v8::Handle<v8::Ob
         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;
+        if (extensions[i].useCallback) {
+            // Ensure our date extension is always allowed.
+            if (extensions[i].extension != DateExtension::get()
+                && !m_frame->loader()->client()->allowScriptExtension(extensions[i].extension->name(), extensionGroup))
+                continue;
+        } else {
+            // 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();
     }
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index a776ee7..9499075 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -842,14 +842,21 @@ bool V8Proxy::registeredExtensionWithV8(v8::Extension* extension)
 void V8Proxy::registerExtension(v8::Extension* extension, const String& schemeRestriction)
 {
     registerExtensionWithV8(extension);
-    V8ExtensionInfo info = {schemeRestriction, 0, extension};
+    V8ExtensionInfo info = {schemeRestriction, 0, extension, false};
     m_extensions.append(info);
 }
 
 void V8Proxy::registerExtension(v8::Extension* extension, int extensionGroup)
 {
     registerExtensionWithV8(extension);
-    V8ExtensionInfo info = {String(), extensionGroup, extension};
+    V8ExtensionInfo info = {String(), extensionGroup, extension, false};
+    m_extensions.append(info);
+}
+
+void V8Proxy::registerExtension(v8::Extension* extension)
+{
+    registerExtensionWithV8(extension);
+    V8ExtensionInfo info = {String(), 0, extension, true};
     m_extensions.append(info);
 }
 
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 7b4d6f6..7f10a26 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -128,6 +128,7 @@ namespace WebCore {
         String scheme;
         int group;
         v8::Extension* extension;
+        bool useCallback; // FIXME: remove
     };
     typedef WTF::Vector<V8ExtensionInfo> V8Extensions;
 
@@ -329,6 +330,11 @@ namespace WebCore {
         static void registerExtension(v8::Extension*, const String& schemeRestriction);
         static void registerExtension(v8::Extension*, int extensionGroup);
 
+        // Same as above, but new version.
+        // FIXME: remove the other 2 versions in phase 3 of multipart checkin:
+        // https://bugs.webkit.org/show_bug.cgi?id=45721
+        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 65ba3b8..d8f8e27 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 b113995..98f3f29 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-22  Matt Perry  <mpcomplete at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        Trying to reland a version of r67749:
+        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-22  Jeremy Orlow  <jorlow at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h
index 699325d..a72e2fd 100644
--- a/WebKit/chromium/public/WebFrameClient.h
+++ b/WebKit/chromium/public/WebFrameClient.h
@@ -301,6 +301,13 @@ public:
     // scripts.
     virtual void didCreateIsolatedScriptContext(WebFrame*) { }
 
+    // Controls whether the given script extension should run in a new script
+    // context in this frame. If extensionGroup is 0, the script context is the
+    // frame's main context. Otherwise, it is a context created by
+    // WebFrame::executeScriptInIsolatedWorld with that same extensionGroup
+    // value.
+    virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return true; }
+
 
     // Geometry notifications ----------------------------------------------
 
diff --git a/WebKit/chromium/public/WebScriptController.h b/WebKit/chromium/public/WebScriptController.h
index 54bb08a..5c360b2 100644
--- a/WebKit/chromium/public/WebScriptController.h
+++ b/WebKit/chromium/public/WebScriptController.h
@@ -51,6 +51,8 @@ public:
     // matching group.
     // Will only affect v8 contexts initialized after this call. Takes ownership
     // of the v8::Extension object passed.
+    // FIXME: remove the latter 2 versions in phase 3 of multipart checkin:
+    // https://bugs.webkit.org/show_bug.cgi?id=45721
     WEBKIT_API static void registerExtension(v8::Extension*);
     WEBKIT_API static void registerExtension(v8::Extension*,
                                              const WebString& schemeRestriction);
diff --git a/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/WebKit/chromium/src/FrameLoaderClientImpl.cpp
index 61d43df..68c0178 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..8877ba0 100644
--- a/WebKit/chromium/src/WebScriptController.cpp
+++ b/WebKit/chromium/src/WebScriptController.cpp
@@ -43,7 +43,7 @@ namespace WebKit {
 
 void WebScriptController::registerExtension(v8::Extension* extension)
 {
-    V8Proxy::registerExtension(extension, WebString());
+    V8Proxy::registerExtension(extension);
 }
 
 void WebScriptController::registerExtension(v8::Extension* extension,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list