[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

darin at chromium.org darin at chromium.org
Wed Apr 7 23:19:03 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 33225198e878dcaf8b89fc3a93cc363ff7c7999b
Author: darin at chromium.org <darin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 3 05:47:16 2009 +0000

    2009-10-30  Darin Fisher  <darin at chromium.org>
    
            Reviewed by Adam Barth.
    
            Give the FrameLoaderClient the ability to override Settings::isJavaScriptEnabled.
            https://bugs.webkit.org/show_bug.cgi?id=30967
    
            * bindings/js/ScriptController.cpp:
            (WebCore::ScriptController::isEnabled):
            * bindings/v8/ScriptController.cpp:
            (WebCore::ScriptController::isEnabled):
            * bindings/v8/V8Proxy.cpp: Move implementation of isEnabled to ScriptController
            * bindings/v8/V8Proxy.h: Ditto
            * loader/FrameLoaderClient.h:
            (WebCore::FrameLoaderClient::allowJavaScript):
            * platform/chromium/ChromiumBridge.h: Delete uiResourceProtocol function
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ea685b8..f6ea86b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-30  Darin Fisher  <darin at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Give the FrameLoaderClient the ability to override Settings::isJavaScriptEnabled.
+        https://bugs.webkit.org/show_bug.cgi?id=30967
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::isEnabled):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::isEnabled):
+        * bindings/v8/V8Proxy.cpp: Move implementation of isEnabled to ScriptController
+        * bindings/v8/V8Proxy.h: Ditto
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::allowJavaScript):
+        * platform/chromium/ChromiumBridge.h: Delete uiResourceProtocol function
+
 2009-11-02  Brady Eidson  <beidson at apple.com>
 
         Rubberstamped by Mark Rowe.
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index 5791dd7..f4f4fdd 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -323,7 +323,7 @@ bool ScriptController::anyPageIsProcessingUserGesture() const
 bool ScriptController::isEnabled()
 {
     Settings* settings = m_frame->settings();
-    return (settings && settings->isJavaScriptEnabled());
+    return m_frame->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled());
 }
 
 void ScriptController::attachDebugger(JSC::Debugger* debugger)
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index f816bd0..14c1838 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -40,12 +40,14 @@
 #include "EventListener.h"
 #include "EventNames.h"
 #include "Frame.h"
+#include "FrameLoaderClient.h"
 #include "Node.h"
 #include "NotImplemented.h"
 #include "npruntime_impl.h"
 #include "npruntime_priv.h"
 #include "NPV8Object.h"
 #include "ScriptSourceCode.h"
+#include "Settings.h"
 #include "Widget.h"
 #include "XSSAuditor.h"
 
@@ -290,7 +292,8 @@ bool ScriptController::haveInterpreter() const
 
 bool ScriptController::isEnabled() const
 {
-    return m_proxy->isEnabled();
+    Settings* settings = m_proxy->frame()->settings();
+    return m_proxy->frame()->loader()->client()->allowJavaScript(settings && settings->isJavaScriptEnabled());
 }
 
 PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget)
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index df3f0df..475b5e5 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -623,51 +623,6 @@ void V8Proxy::disconnectFrame()
 {
 }
 
-bool V8Proxy::isEnabled()
-{
-    Settings* settings = m_frame->settings();
-    if (!settings)
-        return false;
-
-    // In the common case, JavaScript is enabled and we're done.
-    if (settings->isJavaScriptEnabled())
-        return true;
-
-    // If JavaScript has been disabled, we need to look at the frame to tell
-    // whether this script came from the web or the embedder. Scripts from the
-    // embedder are safe to run, but scripts from the other sources are
-    // disallowed.
-    Document* document = m_frame->document();
-    if (!document)
-        return false;
-
-    SecurityOrigin* origin = document->securityOrigin();
-    if (origin->protocol().isEmpty())
-        return false; // Uninitialized document
-
-    if (origin->protocol() == "http" || origin->protocol() == "https")
-        return false; // Web site
-
-    // FIXME: the following are application decisions, and they should
-    // not be made at this layer. instead, we should bridge out to the
-    // embedder to allow them to override policy here.
-
-    if (origin->protocol() == ChromiumBridge::uiResourceProtocol())
-        return true;   // Embedder's scripts are ok to run
-
-    // If the scheme is ftp: or file:, an empty file name indicates a directory
-    // listing, which requires JavaScript to function properly.
-    const char* kDirProtocols[] = { "ftp", "file" };
-    for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
-        if (origin->protocol() == kDirProtocols[i]) {
-            const KURL& url = document->url();
-            return url.pathAfterLastSlash() == url.pathEnd();
-        }
-    }
-
-    return false; // Other protocols fall through to here
-}
-
 void V8Proxy::updateDocumentWrapper(v8::Handle<v8::Value> wrapper)
 {
     clearDocumentWrapper();
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 7d27f77..9882a4c 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -163,8 +163,6 @@ namespace WebCore {
         // and clears all timeouts on the DOM window.
         void disconnectFrame();
 
-        bool isEnabled();
-
 #if ENABLE(SVG)
         static void setSVGContext(void*, SVGElement*);
         static SVGElement* svgContext(void*);
diff --git a/WebCore/loader/FrameLoaderClient.h b/WebCore/loader/FrameLoaderClient.h
index 2042b32..b04fc55 100644
--- a/WebCore/loader/FrameLoaderClient.h
+++ b/WebCore/loader/FrameLoaderClient.h
@@ -246,6 +246,8 @@ namespace WebCore {
 
         virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const { return false; }
         virtual bool shouldLoadMediaElementURL(const KURL&) const { return true; }
+
+        virtual bool allowJavaScript(bool enabledPerSettings) { return enabledPerSettings; }
     };
 
 } // namespace WebCore
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index da9f518..0cee4b0 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -158,9 +158,6 @@ namespace WebCore {
         static NPObject* pluginScriptableObject(Widget*);
         static bool popupsAllowed(NPP);
 
-        // Protocol -----------------------------------------------------------
-        static String uiResourceProtocol();  // deprecated
-
         // Resources ----------------------------------------------------------
         static PassRefPtr<Image> loadPlatformImageResource(const char* name);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list