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

Unified Diff: extensions/renderer/script_context.cc

Issue 2936083002: [Extensions] Remove unsafe variants of CallModuleMethod (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_context.cc
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index 256381e1b839e2f5348e0c676f8efad11303481a..431bb4de8b6eaa45334d41168a55f14ffb440817 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -180,29 +180,6 @@ content::RenderFrame* ScriptContext::GetRenderFrame() const {
return NULL;
}
-v8::Local<v8::Value> ScriptContext::CallFunction(
- const v8::Local<v8::Function>& function,
- int argc,
- v8::Local<v8::Value> argv[]) const {
- DCHECK(thread_checker_.CalledOnValidThread());
- v8::EscapableHandleScope handle_scope(isolate());
- v8::Context::Scope scope(v8_context());
-
- v8::MicrotasksScope microtasks(
- isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks);
- if (!is_valid_) {
- return handle_scope.Escape(
- v8::Local<v8::Primitive>(v8::Undefined(isolate())));
- }
-
- v8::Local<v8::Object> global = v8_context()->Global();
- if (!web_frame_)
- return handle_scope.Escape(function->Call(global, argc, argv));
- return handle_scope.Escape(
- v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled(
- function, global, argc, argv)));
-}
-
void ScriptContext::SafeCallFunction(const v8::Local<v8::Function>& function,
int argc,
v8::Local<v8::Value> argv[]) {
@@ -530,4 +507,27 @@ gin::ContextHolder* ScriptContext::Runner::GetContextHolder() {
return gin::PerContextData::From(context_->v8_context())->context_holder();
}
+v8::Local<v8::Value> ScriptContext::CallFunction(
+ const v8::Local<v8::Function>& function,
+ int argc,
+ v8::Local<v8::Value> argv[]) const {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ v8::EscapableHandleScope handle_scope(isolate());
+ v8::Context::Scope scope(v8_context());
+
+ v8::MicrotasksScope microtasks(isolate(),
+ v8::MicrotasksScope::kDoNotRunMicrotasks);
+ if (!is_valid_) {
+ return handle_scope.Escape(
+ v8::Local<v8::Primitive>(v8::Undefined(isolate())));
+ }
+
+ v8::Local<v8::Object> global = v8_context()->Global();
+ if (!web_frame_)
+ return handle_scope.Escape(function->Call(global, argc, argv));
+ return handle_scope.Escape(
+ v8::Local<v8::Value>(web_frame_->CallFunctionEvenIfScriptDisabled(
+ function, global, argc, argv)));
+}
+
} // namespace extensions
« no previous file with comments | « extensions/renderer/script_context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698