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

Unified Diff: extensions/renderer/module_system.cc

Issue 1192763002: extensions: Use V8 Maybe APIs in NativeHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: extensions/renderer/module_system.cc
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc
index 64e3502b41ef511de53c49d1d9a2e12e7ef13c52..e4dc8a90e493900e6710031407a6de3dc7d798ef 100644
--- a/extensions/renderer/module_system.cc
+++ b/extensions/renderer/module_system.cc
@@ -563,7 +563,13 @@ v8::Local<v8::Value> ModuleSystem::RequireNativeFromString(
"Couldn't find native for requireNative(" + native_name + ")");
return v8::Undefined(GetIsolate());
}
- return i->second->NewInstance();
+ v8::Local<v8::Value> instance;
+ if (!i->second->NewInstance().ToLocal(&instance)) {
+ LOG(ERROR) << "Cannot instanciate native for requireNative(" + native_name +
not at google - send to devlin 2015/06/19 17:23:55 "instantiate", and NOTREACHED(), but might be moot
bashi 2015/06/23 00:10:49 Removed because NewInstance() returns Local now.
+ ")";
+ return v8::Undefined(GetIsolate());
+ }
+ return instance;
}
void ModuleSystem::RequireAsync(
@@ -664,8 +670,9 @@ v8::Local<v8::Value> ModuleSystem::LoadModule(const std::string& module_name) {
gin::ModuleRegistry::InstallGlobals(GetIsolate(), define_object);
v8::Local<v8::Value> exports = v8::Object::New(GetIsolate());
- v8::Local<v8::Object> natives(NewInstance());
- CHECK(!natives.IsEmpty()); // this can fail if v8 has issues
+ v8::Local<v8::Object> natives;
+ if (!NewInstance().ToLocal(&natives))
+ NOTREACHED(); // this can fail if v8 has issues
// These must match the argument order in WrapSource.
v8::Local<v8::Value> args[] = {

Powered by Google App Engine
This is Rietveld 408576698