diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 21:31:06 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 21:31:06 +0000 |
commit | af7eb3fb5d0666d37b5c754c2976cc1276b66323 (patch) | |
tree | 4623bf0e86a9e20a5c94090b43094da34b26871c /chrome/renderer/render_thread.h | |
parent | 943ca53d131a04f71e18fd140780b39304492ec1 (diff) | |
download | chromium_src-af7eb3fb5d0666d37b5c754c2976cc1276b66323.zip chromium_src-af7eb3fb5d0666d37b5c754c2976cc1276b66323.tar.gz chromium_src-af7eb3fb5d0666d37b5c754c2976cc1276b66323.tar.bz2 |
Trying to reland r59889, this time as a multi-stage patch.
Fix regression introduced by
http://src.chromium.org/viewvc/chrome?view=rev&revision=57788
Add a delegate interface so that chromium have more fine-grained control over
whether a V8 extension is injected into a script context. This is the
chromium-side change of webkit bug
https://bugs.webkit.org/show_bug.cgi?id=45721
BUG=37290
TEST=covered by unit tests
Review URL: http://codereview.chromium.org/3464005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.h')
-rw-r--r-- | chrome/renderer/render_thread.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 6b28214..4572b49 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -6,6 +6,7 @@ #define CHROME_RENDERER_RENDER_THREAD_H_ #pragma once +#include <map> #include <string> #include <vector> @@ -60,6 +61,10 @@ namespace WebKit { class WebStorageEventDispatcher; } +namespace v8 { +class Extension; +} + // The RenderThreadBase is the minimal interface that a RenderView/Widget // expects from a render thread. The interface basically abstracts a way to send // and receive messages. @@ -231,6 +236,13 @@ class RenderThread : public RenderThreadBase, // on the renderer's main thread. scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); + // This function is called for every registered V8 extension each time a new + // script context is created. Returns true if the given V8 extension is + // allowed to run on the given URL and extension group. + bool AllowScriptExtension(const std::string& v8_extension_name, + const GURL& url, + int extension_group); + private: virtual void OnControlMessageReceived(const IPC::Message& msg); @@ -311,6 +323,10 @@ class RenderThread : public RenderThreadBase, // Schedule a call to IdleHandler with the given initial delay. void ScheduleIdleHandler(double initial_delay_s); + // Registers the given V8 extension with WebKit, and also tracks what pages + // it is allowed to run on. + void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); + // These objects live solely on the render thread. scoped_ptr<ScopedRunnableMethodFactory<RenderThread> > task_factory_; scoped_ptr<VisitedLinkSlave> visited_link_slave_; @@ -371,6 +387,11 @@ class RenderThread : public RenderThreadBase, // A lazily initiated thread on which file operations are run. scoped_ptr<base::Thread> file_thread_; + // Map of registered v8 extensions. The key is the extension name. The value + // is true if the extension should be restricted to extension-related + // contexts. + std::map<std::string, bool> v8_extensions_; + DISALLOW_COPY_AND_ASSIGN(RenderThread); }; |