Chromium Code Reviews| Index: extensions/renderer/module_system.cc |
| diff --git a/extensions/renderer/module_system.cc b/extensions/renderer/module_system.cc |
| index 1e121051e767869bf0689ae4fc8c06276289edec..8473335c6cf8fa6f03c4b57dcf39ef12a16a62e8 100644 |
| --- a/extensions/renderer/module_system.cc |
| +++ b/extensions/renderer/module_system.cc |
| @@ -563,8 +563,15 @@ 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::Exception::TypeError(v8::String::NewFromUtf8(GetIsolate(), |
| + args[0]->IsUndefined() |
| + ? "Method called without a valid receiver (this). " |
| + "Did you forget to call .bind()?" |
| + : "Invalid invocation: this is not an object!"))); |
|
not at google - send to devlin
2014/12/08 23:18:31
s/this/receiver.
|
| + return; |
| + } |
| v8::Local<v8::Object> obj = args[0].As<v8::Object>(); |
| v8::Local<v8::String> privates_key = |
| v8::String::NewFromUtf8(GetIsolate(), "privates"); |