diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 00:04:33 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 00:04:33 +0000 |
commit | 8569eafc863900c15ba3df7da5b05ac8ec145ec5 (patch) | |
tree | 13b680d773e8197182be85917625d5e4c0fb1a3c /chrome/renderer | |
parent | 1669e4d96e503460e2888320c5dc6d3217234599 (diff) | |
download | chromium_src-8569eafc863900c15ba3df7da5b05ac8ec145ec5.zip chromium_src-8569eafc863900c15ba3df7da5b05ac8ec145ec5.tar.gz chromium_src-8569eafc863900c15ba3df7da5b05ac8ec145ec5.tar.bz2 |
Another try at enabling the content script messaging test.
Also fixes some issues that that test exposes.
My previous attempt (http://src.chromium.org/viewvc/chrome?view=rev&revision=21324) was reverted.
TEST=no
BUG=no
Review URL: http://codereview.chromium.org/160048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/extensions/event_bindings.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index 863ebbf..81924cb 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -129,8 +129,7 @@ static void DeferredUnload(v8::Persistent<v8::Context> context) { context.Clear(); } -static void HandleContextDestroyed(ContextList::iterator context_iter, - bool in_gc) { +static void UnregisterContext(ContextList::iterator context_iter, bool in_gc) { // Notify the bindings that they're going away. if (in_gc) { // We shouldn't call back into javascript during a garbage collect. Do it @@ -154,14 +153,6 @@ static void HandleContextDestroyed(ContextList::iterator context_iter, } } - // Unload any content script contexts for this frame. - for (ContextList::iterator it = GetContexts().begin(); - it != GetContexts().end(); ) { - ContextList::iterator current = it++; - if ((*current)->parent_context == (*context_iter)->context) - HandleContextDestroyed(current, in_gc); - } - if (!(*context_iter)->parent_context.IsEmpty()) { (*context_iter)->parent_context.Dispose(); (*context_iter)->parent_context.Clear(); @@ -179,10 +170,11 @@ static void HandleContextDestroyed(ContextList::iterator context_iter, static void ContextWeakReferenceCallback(v8::Persistent<v8::Value> context, void*) { + // This should only get called for content script contexts. for (ContextList::iterator it = GetContexts().begin(); it != GetContexts().end(); ++it) { if ((*it)->context == context) { - HandleContextDestroyed(it, true); + UnregisterContext(it, true); return; } } @@ -258,7 +250,16 @@ void EventBindings::HandleContextDestroyed(WebFrame* frame) { ContextList::iterator context_iter = bindings_utils::FindContext(context); if (context_iter != GetContexts().end()) - ::HandleContextDestroyed(context_iter, false); + UnregisterContext(context_iter, false); + + // Unload any content script contexts for this frame. Note that the frame + // itself might not be registered, but can still be a parent context. + for (ContextList::iterator it = GetContexts().begin(); + it != GetContexts().end(); ) { + ContextList::iterator current = it++; + if ((*current)->parent_context == context) + UnregisterContext(current, false); + } } // static |