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

Unified Diff: extensions/renderer/module_system.cc

Issue 783333002: Throw JavaScript error instead of CHECK when this in privates is invalid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/module_system.cc
diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc
index 1e121051e767869bf0689ae4fc8c06276289edec..028f6d6523882cfb0b9e1a0d206c77294f2b5760 100644
--- a/extensions/renderer/module_system.cc
+++ b/extensions/renderer/module_system.cc
@@ -563,8 +563,12 @@ v8::Handle<v8::String> ModuleSystem::WrapSource(v8::Handle<v8::String> source) {
void ModuleSystem::Private(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(1, args.Length());
- CHECK(args[0]->IsObject());
- CHECK(!args[0]->IsNull());
+ if (!args[0]->IsObject() || args[0]->IsNull()) {
+ GetIsolate()->ThrowException(
+ v8::String::NewFromUtf8(GetIsolate(),
+ "Invalid invocation: this is not an object!"));
+ return;
not at google - send to devlin 2014/12/08 22:29:11 Good catch, I think this is the right behaviour, t
robwu 2014/12/08 22:39:24 Done.
+ }
v8::Local<v8::Object> obj = args[0].As<v8::Object>();
v8::Local<v8::String> privates_key =
v8::String::NewFromUtf8(GetIsolate(), "privates");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698