diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 00:48:58 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 00:48:58 +0000 |
commit | 9a7b22e6fb1d115a694616fd5a12bfe6e491664b (patch) | |
tree | 505bc1a11530c975bf45588b19aa6c3cfbc36c13 /chrome | |
parent | 08da43b40e557c42b93fe490e91ab44a73d7e0dd (diff) | |
download | chromium_src-9a7b22e6fb1d115a694616fd5a12bfe6e491664b.zip chromium_src-9a7b22e6fb1d115a694616fd5a12bfe6e491664b.tar.gz chromium_src-9a7b22e6fb1d115a694616fd5a12bfe6e491664b.tar.bz2 |
Split V8Proxy::retrieveActiveFrame() into two methods.
We now have RetrieveFrameForCurrentContext() and
RetrieveFrameForEnteredContext().
These terms means the same thing they do in V8::Context --
'current' is the top of the js stack and 'entered' is the
bottom.
I needed 'entered' to fix a bug in extensions where if you
call an extension API through the web inspector we get
confused and think the web inspector's view is the one who
called.
Review URL: http://codereview.chromium.org/113085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/renderer/extensions/bindings_utils.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/extensions/bindings_utils.h | 4 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_process_bindings.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/extensions/renderer_extension_bindings.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/external_extension.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/loadtimes_extension_bindings.cc | 2 |
6 files changed, 15 insertions, 11 deletions
diff --git a/chrome/renderer/extensions/bindings_utils.cc b/chrome/renderer/extensions/bindings_utils.cc index ee4688d..097c8d0 100644 --- a/chrome/renderer/extensions/bindings_utils.cc +++ b/chrome/renderer/extensions/bindings_utils.cc @@ -7,9 +7,9 @@ #include "chrome/renderer/render_view.h" #include "webkit/glue/webframe.h" -RenderView* GetActiveRenderView() { - WebFrame* webframe = WebFrame::RetrieveActiveFrame(); - DCHECK(webframe) << "GetActiveRenderView called when not in a V8 context."; +RenderView* GetRenderViewForCurrentContext() { + WebFrame* webframe = WebFrame::RetrieveFrameForCurrentContext(); + DCHECK(webframe) << "RetrieveCurrentFrame called when not in a V8 context."; if (!webframe) return NULL; diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h index 7f336c3..7596952 100644 --- a/chrome/renderer/extensions/bindings_utils.h +++ b/chrome/renderer/extensions/bindings_utils.h @@ -28,8 +28,8 @@ const char* GetStringResource() { Singleton< StringResourceTemplate<kResourceId> >::get()->resource.c_str(); } -// Returns the active RenderView, based on which V8 context is active. It is +// Returns the current RenderView, based on which V8 context is current. It is // an error to call this when not in a V8 context. -RenderView* GetActiveRenderView(); +RenderView* GetRenderViewForCurrentContext(); #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index 1a3614f..032d4570 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -69,8 +69,10 @@ class ExtensionImpl : public v8::Extension { } static v8::Handle<v8::Value> StartRequest(const v8::Arguments& args) { - WebFrame* webframe = WebFrame::RetrieveActiveFrame(); - RenderView* renderview = GetActiveRenderView(); + // Get the current RenderView so that we can send a routed IPC message from + // the correct source. + WebFrame* webframe = WebFrame::RetrieveFrameForCurrentContext(); + RenderView* renderview = GetRenderViewForCurrentContext(); if (!webframe || !renderview) return v8::Undefined(); diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc index 4d894a4..86d3d15 100644 --- a/chrome/renderer/extensions/renderer_extension_bindings.cc +++ b/chrome/renderer/extensions/renderer_extension_bindings.cc @@ -49,7 +49,9 @@ class ExtensionImpl : public v8::Extension { // Creates a new messaging channel to the given extension. static v8::Handle<v8::Value> OpenChannelToExtension( const v8::Arguments& args) { - RenderView* renderview = GetActiveRenderView(); + // Get the current RenderView so that we can send a routed IPC message from + // the correct source. + RenderView* renderview = GetRenderViewForCurrentContext(); if (!renderview) return v8::Undefined(); @@ -65,7 +67,7 @@ class ExtensionImpl : public v8::Extension { // Sends a message along the given channel. static v8::Handle<v8::Value> PostMessage(const v8::Arguments& args) { - RenderView* renderview = GetActiveRenderView(); + RenderView* renderview = GetRenderViewForCurrentContext(); if (!renderview) return v8::Undefined(); diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc index 378e78e..100f311 100644 --- a/chrome/renderer/external_extension.cc +++ b/chrome/renderer/external_extension.cc @@ -35,7 +35,7 @@ class ExternalExtensionWrapper : public v8::Extension { if (!args.Length()) return v8::Undefined(); - WebFrame* webframe = WebFrame::RetrieveActiveFrame(); + WebFrame* webframe = WebFrame::RetrieveFrameForEnteredContext(); DCHECK(webframe) << "There should be an active frame since we just got " "a native function called."; if (!webframe) return v8::Undefined(); diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc index 49f2b25..6acbbe6 100644 --- a/chrome/renderer/loadtimes_extension_bindings.cc +++ b/chrome/renderer/loadtimes_extension_bindings.cc @@ -55,7 +55,7 @@ class LoadTimesExtensionWrapper : public v8::Extension { } static v8::Handle<v8::Value> GetLoadTimes(const v8::Arguments& args) { - WebFrame* win_frame = WebFrame::RetrieveActiveFrame(); + WebFrame* win_frame = WebFrame::RetrieveFrameForEnteredContext(); if (win_frame) { WebDataSource* data_source = win_frame->GetDataSource(); if (data_source) { |