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

Side by Side Diff: extensions/renderer/script_context_set.h

Issue 2654623007: [Extensions] Handle null ScriptContexts in GetModuleSystem() (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | extensions/renderer/v8_context_native_handler.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // Gets the ScriptContext corresponding to the specified 69 // Gets the ScriptContext corresponding to the specified
70 // v8::Context or NULL if no such context exists. 70 // v8::Context or NULL if no such context exists.
71 ScriptContext* GetByV8Context(const v8::Local<v8::Context>& context) const; 71 ScriptContext* GetByV8Context(const v8::Local<v8::Context>& context) const;
72 // Static equivalent of the above. 72 // Static equivalent of the above.
73 static ScriptContext* GetContextByV8Context( 73 static ScriptContext* GetContextByV8Context(
74 const v8::Local<v8::Context>& context); 74 const v8::Local<v8::Context>& context);
75 75
76 // Returns the ScriptContext corresponding to the V8 context that created the 76 // Returns the ScriptContext corresponding to the V8 context that created the
77 // given |object|. 77 // given |object|.
78 // Note: The provided |object| may belong to a v8::Context in another frame,
79 // as can happen when a parent frame uses an object of an embedded iframe.
80 // In this case, there may be no associated ScriptContext, since the child
81 // frame can be hosted in another process. Thus, callers of this need to
82 // null-check the result (and should also always check whether or not the
83 // context has access to the other context).
78 static ScriptContext* GetContextByObject(const v8::Local<v8::Object>& object); 84 static ScriptContext* GetContextByObject(const v8::Local<v8::Object>& object);
79 85
80 // Synchronously runs |callback| with each ScriptContext that belongs to 86 // Synchronously runs |callback| with each ScriptContext that belongs to
81 // |extension_id| in |render_frame|. 87 // |extension_id| in |render_frame|.
82 // 88 //
83 // An empty |extension_id| will match all extensions, and a null 89 // An empty |extension_id| will match all extensions, and a null
84 // |render_frame| will match all render views, but try to use the inline 90 // |render_frame| will match all render views, but try to use the inline
85 // variants of these methods instead. 91 // variants of these methods instead.
86 void ForEach(const std::string& extension_id, 92 void ForEach(const std::string& extension_id,
87 content::RenderFrame* render_frame, 93 content::RenderFrame* render_frame,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 140
135 // The set of all ScriptContexts we own. 141 // The set of all ScriptContexts we own.
136 std::set<ScriptContext*> contexts_; 142 std::set<ScriptContext*> contexts_;
137 143
138 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet); 144 DISALLOW_COPY_AND_ASSIGN(ScriptContextSet);
139 }; 145 };
140 146
141 } // namespace extensions 147 } // namespace extensions
142 148
143 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_ 149 #endif // EXTENSIONS_RENDERER_SCRIPT_CONTEXT_SET_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/v8_context_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698