Commit 3043b941 authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit Bot

[Extensions] Use CallModuleMethodSafe() in ScriptContext

In ScriptContext::OnResponseReceived(), instead of immediately executing
JS, request execution. This means we don't receive a result from the
execution. According to comments,

// In debug, the js will validate the callback parameters and return a
// string if a validation error has occured.

This appears to have been true at some point [1], but some time in the
last seven years, has been updated to no longer be the case. As such,
just remove any reference to the result value.

[1] https://chromium.googlesource.com/chromium/src/+/5c21a2eeaa92326a6a771e27c70b11b1ea52441a/chrome/renderer/resources/extension_process_bindings.js#114

BUG=629431

Review-Url: https://codereview.chromium.org/2932913004
Cr-Commit-Position: refs/heads/master@{#478780}
parent 1eb7c8cc
......@@ -381,13 +381,8 @@ void ScriptContext::OnResponseReceived(const std::string& name,
v8::Local<v8::Context>::New(isolate(), v8_context_)),
v8::String::NewFromUtf8(isolate(), error.c_str())};
v8::Local<v8::Value> retval = module_system()->CallModuleMethod(
"sendRequest", "handleResponse", arraysize(argv), argv);
// In debug, the js will validate the callback parameters and return a
// string if a validation error has occured.
DCHECK(retval.IsEmpty() || retval->IsUndefined())
<< *v8::String::Utf8Value(retval);
module_system()->CallModuleMethodSafe("sendRequest", "handleResponse",
arraysize(argv), argv);
}
bool ScriptContext::HasAPIPermission(APIPermission::ID permission) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment