Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5704)

Unified Diff: chrome/renderer/extensions/bindings_utils.h

Issue 7717019: Do not dereference potentially invalid frame pointer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/bindings_utils.h
diff --git a/chrome/renderer/extensions/bindings_utils.h b/chrome/renderer/extensions/bindings_utils.h
index 1246a1afc2b0aca4dc454217d2d949480dae1c13..958727ebcce95adf515310febb02fc958c5d9a62 100644
--- a/chrome/renderer/extensions/bindings_utils.h
+++ b/chrome/renderer/extensions/bindings_utils.h
@@ -82,20 +82,23 @@ const char* GetStringResource(int resource_id);
// bindings.
struct ContextInfo {
ContextInfo(v8::Persistent<v8::Context> context,
- const std::string& extension_id,
- WebKit::WebFrame* frame);
+ v8::Persistent<v8::Context> main_world_context,
+ const std::string& extension_id);
~ContextInfo();
+ // The context hosting the bindings. If this is a content script, the handle
+ // will be weak.
v8::Persistent<v8::Context> context;
+ // If the context is a content script, this contains a reference to the
+ // corresponding main world's context. It is weak, but it should always be
+ // valid because we delete ContextInfo for content scripts when the
+ // corresponding main world context is destroyed.
+ v8::Persistent<v8::Context> main_world_context;
+
// The extension ID this context is associated with.
std::string extension_id;
- // The frame the context is associated with. We can't always get this from
- // WebFrame::frameForContext() (in particular as the the frame is navigating
- // or being destroyed).
- WebKit::WebFrame* frame;
-
// A count of the number of events that are listening in this context. When
// this is zero, |context| will be a weak handle.
int num_connected_events;
« no previous file with comments | « no previous file | chrome/renderer/extensions/bindings_utils.cc » ('j') | chrome/renderer/extensions/event_bindings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698