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

Side by Side 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: cleanup the hate Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/renderer/extensions/bindings_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 6 #define CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 ContextInfo(v8::Persistent<v8::Context> context, 84 ContextInfo(v8::Persistent<v8::Context> context,
85 const std::string& extension_id, 85 const std::string& extension_id,
86 WebKit::WebFrame* frame); 86 WebKit::WebFrame* frame);
87 ~ContextInfo(); 87 ~ContextInfo();
88 88
89 v8::Persistent<v8::Context> context; 89 v8::Persistent<v8::Context> context;
90 90
91 // The extension ID this context is associated with. 91 // The extension ID this context is associated with.
92 std::string extension_id; 92 std::string extension_id;
93 93
94 // The frame the context is associated with. We can't always get this from 94 // The frame the context is associated with. ContextInfo can outlive its
95 // WebFrame::frameForContext() (in particular as the the frame is navigating 95 // frame, so this should not be dereferenced. It is stored only for use for
96 // or being destroyed). 96 // comparison.
97 WebKit::WebFrame* frame; 97 void* unsafe_frame;
98 98
99 // A count of the number of events that are listening in this context. When 99 // A count of the number of events that are listening in this context. When
100 // this is zero, |context| will be a weak handle. 100 // this is zero, |context| will be a weak handle.
101 int num_connected_events; 101 int num_connected_events;
102 }; 102 };
103 typedef std::list< linked_ptr<ContextInfo> > ContextList; 103 typedef std::list< linked_ptr<ContextInfo> > ContextList;
104 104
105 // Returns a mutable reference to the ContextList. Note: be careful using this. 105 // Returns a mutable reference to the ContextList. Note: be careful using this.
106 // Calling into javascript may result in the list being modified, so don't rely 106 // Calling into javascript may result in the list being modified, so don't rely
107 // on iterators remaining valid between calls to javascript. 107 // on iterators remaining valid between calls to javascript.
(...skipping 28 matching lines...) Expand all
136 // be a sub-property like "Port.dispatchOnMessage". Returns the result of 136 // be a sub-property like "Port.dispatchOnMessage". Returns the result of
137 // the function call. If an exception is thrown an empty Handle will be 137 // the function call. If an exception is thrown an empty Handle will be
138 // returned. 138 // returned.
139 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context, 139 v8::Handle<v8::Value> CallFunctionInContext(v8::Handle<v8::Context> context,
140 const std::string& function_name, int argc, 140 const std::string& function_name, int argc,
141 v8::Handle<v8::Value>* argv); 141 v8::Handle<v8::Value>* argv);
142 142
143 } // namespace bindings_utils 143 } // namespace bindings_utils
144 144
145 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_ 145 #endif // CHROME_RENDERER_EXTENSIONS_BINDINGS_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/extensions/bindings_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698