summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--chrome/renderer/render_view.cc27
-rw-r--r--chrome/renderer/render_view.h1
-rw-r--r--chrome/renderer/renderer_glue.cc9
-rw-r--r--webkit/api/public/WebFrameClient.h14
-rw-r--r--webkit/api/public/WebKitClient.h5
-rw-r--r--webkit/api/public/WebSecurityOrigin.h16
-rw-r--r--webkit/api/src/ChromiumBridge.cpp5
-rw-r--r--webkit/api/src/FrameLoaderClientImpl.cpp8
-rw-r--r--webkit/api/src/FrameLoaderClientImpl.h1
-rw-r--r--webkit/api/src/TemporaryGlue.h50
-rw-r--r--webkit/api/src/WebSecurityOrigin.cpp34
-rw-r--r--webkit/glue/webkit_glue.h8
-rw-r--r--webkit/glue/webkitclient_impl.cc14
-rw-r--r--webkit/glue/webkitclient_impl.h5
-rw-r--r--webkit/tools/test_shell/test_shell.cc8
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h4
17 files changed, 90 insertions, 121 deletions
diff --git a/DEPS b/DEPS
index 6e0930b..6eb1311 100644
--- a/DEPS
+++ b/DEPS
@@ -1,7 +1,7 @@
vars = {
"webkit_trunk":
"http://svn.webkit.org/repository/webkit/trunk",
- "webkit_revision": "50432",
+ "webkit_revision": "50442",
"ffmpeg_revision": "30374",
}
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index ce8a521..a2fea6f 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2036,7 +2036,7 @@ void RenderView::didCreateDataSource(WebFrame* frame, WebDataSource* ds) {
// The rest of RenderView assumes that a WebDataSource will always have a
// non-null NavigationState.
NavigationState* state = pending_navigation_state_.get() ?
- pending_navigation_state_.release() :
+ pending_navigation_state_.release() :
NavigationState::CreateContentInitiated();
state->set_user_script_idle_scheduler(
@@ -2444,6 +2444,31 @@ void RenderView::didRunInsecureContent(
origin.toString().utf8()));
}
+bool RenderView::allowScript(WebFrame* frame, bool enabled_per_settings) {
+ if (enabled_per_settings)
+ return true;
+
+ WebSecurityOrigin origin = frame->securityOrigin();
+ if (origin.isEmpty())
+ return false; // Uninitialized document?
+
+ if (EqualsASCII(origin.protocol(), chrome::kChromeUIScheme))
+ return true; // Browser UI elements should still work.
+
+ // If the scheme is ftp: or file:, an empty file name indicates a directory
+ // listing, which requires JavaScript to function properly.
+ GURL frame_url = frame->url();
+ const char* kDirProtocols[] = { "ftp", "file" };
+ for (size_t i = 0; i < arraysize(kDirProtocols); ++i) {
+ if (EqualsASCII(origin.protocol(), kDirProtocols[i])) {
+ return frame_url.SchemeIs(kDirProtocols[i]) &&
+ frame_url.ExtractFileName().empty();
+ }
+ }
+
+ return false; // Other protocols fall through here.
+}
+
void RenderView::didExhaustMemoryAvailableForScript(WebFrame* frame) {
Send(new ViewHostMsg_JSOutOfMemory(routing_id_));
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 814d8bd..65e4975 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -350,6 +350,7 @@ class RenderView : public RenderWidget,
virtual void didDisplayInsecureContent(WebKit::WebFrame* frame);
virtual void didRunInsecureContent(
WebKit::WebFrame* frame, const WebKit::WebSecurityOrigin& origin);
+ virtual bool allowScript(WebKit::WebFrame* frame, bool enabled_per_settings);
virtual void didExhaustMemoryAvailableForScript(WebKit::WebFrame* frame);
virtual void didCreateScriptContext(WebKit::WebFrame* frame);
virtual void didDestroyScriptContext(WebKit::WebFrame* frame);
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 2dab562..e7a5a36 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -199,15 +199,6 @@ void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) {
markup, url));
}
-GURL GetInspectorURL() {
- return GURL(std::string(chrome::kChromeUIScheme) +
- "://inspector/inspector.html");
-}
-
-std::string GetUIResourceProtocol() {
- return "chrome";
-}
-
void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) {
if (!RenderThread::current()->plugin_refresh_allowed())
refresh = false;
diff --git a/webkit/api/public/WebFrameClient.h b/webkit/api/public/WebFrameClient.h
index d79a5b64..a592c21 100644
--- a/webkit/api/public/WebFrameClient.h
+++ b/webkit/api/public/WebFrameClient.h
@@ -90,10 +90,7 @@ namespace WebKit {
virtual WebNavigationPolicy decidePolicyForNavigation(
WebFrame*, const WebURLRequest&, WebNavigationType,
const WebNode& originatingNode,
- WebNavigationPolicy defaultPolicy, bool isRedirect)
- {
- return defaultPolicy;
- }
+ WebNavigationPolicy defaultPolicy, bool isRedirect) { return defaultPolicy; }
// Query if the specified request can be handled.
virtual bool canHandleRequest(
@@ -109,19 +106,19 @@ namespace WebKit {
// Notify that a URL cannot be handled.
virtual void unableToImplementPolicyWithError(
- WebFrame*, const WebURLError&) { };
+ WebFrame*, const WebURLError&) { }
// Navigational notifications ------------------------------------------
// A form submission is about to occur.
- virtual void willSubmitForm(WebFrame*, const WebForm&) { };
+ virtual void willSubmitForm(WebFrame*, const WebForm&) { }
// A client-side redirect will occur. This may correspond to a <META
// refresh> or some script activity.
virtual void willPerformClientRedirect(
WebFrame*, const WebURL& from, const WebURL& to,
- double interval, double fireTime) { };
+ double interval, double fireTime) { }
// A client-side redirect was cancelled.
virtual void didCancelClientRedirect(WebFrame*) { }
@@ -234,6 +231,9 @@ namespace WebKit {
// Script notifications ------------------------------------------------
+ // Controls whether scripts are allowed to execute for this frame.
+ virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
+
// Script in the page tried to allocate too much memory.
virtual void didExhaustMemoryAvailableForScript(WebFrame*) { }
diff --git a/webkit/api/public/WebKitClient.h b/webkit/api/public/WebKitClient.h
index 7301563..91c732f 100644
--- a/webkit/api/public/WebKitClient.h
+++ b/webkit/api/public/WebKitClient.h
@@ -36,7 +36,6 @@
#include "WebCommon.h"
#include "WebLocalizedString.h"
#include "WebVector.h"
-#include "webkit/api/src/TemporaryGlue.h"
#ifdef WIN32
typedef void *HANDLE;
@@ -62,9 +61,7 @@ namespace WebKit {
struct WebPluginInfo;
template <typename T> class WebVector;
- // FIXME: Once our webkit api is complete, we should not need to inherit
- // from TemporaryGlue here.
- class WebKitClient : public TemporaryGlue {
+ class WebKitClient {
public:
// Must return non-null.
virtual WebClipboard* clipboard() = 0;
diff --git a/webkit/api/public/WebSecurityOrigin.h b/webkit/api/public/WebSecurityOrigin.h
index cbb1a3d..85dde89 100644
--- a/webkit/api/public/WebSecurityOrigin.h
+++ b/webkit/api/public/WebSecurityOrigin.h
@@ -55,12 +55,22 @@ namespace WebKit {
bool isNull() const { return m_private == 0; }
- // Returns a string representation of this SecurityOrigin that can be used as a file.
- // Should be used in storage APIs only.
- WEBKIT_API WebString databaseIdentifier();
+ WEBKIT_API WebString protocol() const;
+ WEBKIT_API WebString host() const;
+ WEBKIT_API unsigned short port() const;
+
+ // The empty WebSecurityOrigin is the least privileged WebSecurityOrigin.
+ WEBKIT_API bool isEmpty() const;
+ // Returns a string representation of the WebSecurityOrigin. The empty
+ // WebSecurityOrigin is represented by "null". The representation of a
+ // non-empty WebSecurityOrigin resembles a standard URL.
WEBKIT_API WebString toString() const;
+ // Returns a string representation of this WebSecurityOrigin that can
+ // be used as a file. Should be used in storage APIs only.
+ WEBKIT_API WebString databaseIdentifier();
+
#if WEBKIT_IMPLEMENTATION
WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&);
WebSecurityOrigin& operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>&);
diff --git a/webkit/api/src/ChromiumBridge.cpp b/webkit/api/src/ChromiumBridge.cpp
index d55abc1..afd8eb5 100644
--- a/webkit/api/src/ChromiumBridge.cpp
+++ b/webkit/api/src/ChromiumBridge.cpp
@@ -606,11 +606,6 @@ bool ChromiumBridge::isLinkVisited(LinkHash visitedLinkHash)
// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these
// methods will be deleted.
-String ChromiumBridge::uiResourceProtocol()
-{
- return webKitClient()->uiResourceProtocol();
-}
-
void ChromiumBridge::notifyJSOutOfMemory(Frame* frame)
{
if (!frame)
diff --git a/webkit/api/src/FrameLoaderClientImpl.cpp b/webkit/api/src/FrameLoaderClientImpl.cpp
index b7b310e..10f709a 100644
--- a/webkit/api/src/FrameLoaderClientImpl.cpp
+++ b/webkit/api/src/FrameLoaderClientImpl.cpp
@@ -152,6 +152,14 @@ void FrameLoaderClientImpl::registerForIconNotification(bool)
{
}
+bool FrameLoaderClientImpl::allowJavaScript(bool enabledPerSettings)
+{
+ if (m_webFrame->client())
+ return m_webFrame->client()->allowScript(m_webFrame, enabledPerSettings);
+
+ return enabledPerSettings;
+}
+
bool FrameLoaderClientImpl::hasWebView() const
{
return m_webFrame->viewImpl() != 0;
diff --git a/webkit/api/src/FrameLoaderClientImpl.h b/webkit/api/src/FrameLoaderClientImpl.h
index a3e7f18..f308ed1 100644
--- a/webkit/api/src/FrameLoaderClientImpl.h
+++ b/webkit/api/src/FrameLoaderClientImpl.h
@@ -182,6 +182,7 @@ public:
virtual WebCore::String overrideMediaType() const;
virtual void didPerformFirstNavigation() const;
virtual void registerForIconNotification(bool listen = true);
+ virtual bool allowJavaScript(bool enabledPerSettings);
private:
void makeDocumentView();
diff --git a/webkit/api/src/TemporaryGlue.h b/webkit/api/src/TemporaryGlue.h
deleted file mode 100644
index b5fbf85..0000000
--- a/webkit/api/src/TemporaryGlue.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TemporaryGlue_h
-#define TemporaryGlue_h
-
-// This is a temporary file declaring some functions that the WebKit layer can
-// use to call to the Glue layer. Once the Glue layer moves entirely into the
-// WebKit layer, this file will be deleted.
-
-namespace WebCore {
- class String;
-}
-
-namespace WebKit {
- class TemporaryGlue {
- public:
- virtual WebCore::String uiResourceProtocol() = 0;
- };
-
-} // namespace WebKit
-
-#endif
diff --git a/webkit/api/src/WebSecurityOrigin.cpp b/webkit/api/src/WebSecurityOrigin.cpp
index 8368c83..2adf3db 100644
--- a/webkit/api/src/WebSecurityOrigin.cpp
+++ b/webkit/api/src/WebSecurityOrigin.cpp
@@ -55,22 +55,48 @@ void WebSecurityOrigin::assign(const WebSecurityOrigin& other)
assign(p);
}
-WebString WebSecurityOrigin::databaseIdentifier()
+WebString WebSecurityOrigin::protocol() const
{
- if (m_private)
- return m_private->databaseIdentifier();
+ ASSERT(m_private);
+ return m_private->protocol();
+}
- return WebString::fromUTF8("null");
+WebString WebSecurityOrigin::host() const
+{
+ ASSERT(m_private);
+ return m_private->host();
+}
+
+unsigned short WebSecurityOrigin::port() const
+{
+ ASSERT(m_private);
+ return m_private->port();
+}
+
+bool WebSecurityOrigin::isEmpty() const
+{
+ ASSERT(m_private);
+ return m_private->isEmpty();
}
WebString WebSecurityOrigin::toString() const
{
+ // FIXME: We should not support calling this method when m_private is null.
if (m_private)
return m_private->toString();
return WebString::fromUTF8("null");
}
+WebString WebSecurityOrigin::databaseIdentifier()
+{
+ // FIXME: We should not support calling this method when m_private is null.
+ if (m_private)
+ return m_private->databaseIdentifier();
+
+ return WebString::fromUTF8("null");
+}
+
WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin)
: m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef()))
{
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index ba5d405..f52d902 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -190,14 +190,6 @@ void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url);
// Returns true if successful, false otherwise.
bool GetApplicationDirectory(FilePath* path);
-// Gets the URL where the inspector's HTML file resides. It must use the
-// protocol returned by GetUIResourceProtocol.
-GURL GetInspectorURL();
-
-// Gets the protocol that is used for all user interface resources, including
-// the Inspector. It must end with "-resource".
-std::string GetUIResourceProtocol();
-
// Gets the directory where the launching executable resides on disk.
// Path is an output parameter to receive the path.
// Returns true if successful, false otherwise.
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 0bb2edca..a578d7c 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -414,18 +414,4 @@ WebKit::WebURL WebKitClientImpl::filePathToURL(const WebKit::WebString& path) {
return webkit_glue::KURLToWebURL(webkit_glue::GURLToKURL(file_url));
}
-//--------------------------------------------------------------------------
-// BEGIN(TemporaryGlue)
-
-// These are temporary methods that the WebKit layer can use to call to the
-// Glue layer. Once the Glue layer moves entirely into the WebKit layer, these
-// methods will be deleted.
-
-WebCore::String WebKitClientImpl::uiResourceProtocol() {
- return StdStringToString(webkit_glue::GetUIResourceProtocol());
-}
-
-// END(TemporaryGlue)
-//--------------------------------------------------------------------------
-
} // namespace webkit_glue
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index e190465..8b6ab37 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -79,11 +79,6 @@ class WebKitClientImpl : public WebKit::WebKitClient {
virtual void stopSharedTimer();
virtual void callOnMainThread(void (*func)());
- // These are temporary methods that the WebKit layer can use to call to the
- // Glue layer. Once the Glue layer moves entirely into the WebKit layer,
- // these methods will be deleted.
- virtual WebCore::String uiResourceProtocol();
-
private:
void DoTimeout() {
if (shared_timer_func_)
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index c6c0b3a..2bfd69f 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -659,14 +659,6 @@ bool GetApplicationDirectory(FilePath* path) {
return PathService::Get(base::DIR_EXE, path);
}
-GURL GetInspectorURL() {
- return GURL("test-shell-resource://inspector/inspector.html");
-}
-
-std::string GetUIResourceProtocol() {
- return "test-shell-resource";
-}
-
bool GetExeDirectory(FilePath* path) {
return GetApplicationDirectory(path);
}
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index f32c0a7..ee7845b 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -48,9 +48,9 @@ class TestShellWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::initialize(this);
WebKit::setLayoutTestMode(layout_test_mode);
WebKit::WebSecurityPolicy::registerURLSchemeAsLocal(
- ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
+ WebKit::WebString::fromUTF8("test-shell-resource"));
WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess(
- ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
+ WebKit::WebString::fromUTF8("test-shell-resource"));
WebKit::WebScriptController::enableV8SingleThreadMode();
WebKit::WebScriptController::registerExtension(
extensions_v8::GearsExtension::Get());