Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 82336652b20c7e5ef312e3b29a6a848a7b4cab76..95b6c36dd19bb9907a2cb888a2cff856bb983c6a 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -12822,22 +12822,13 @@ int Script::GetLineNumber(int code_pos) { |
Handle<Object> Script::GetNameOrSourceURL(Handle<Script> script) { |
Isolate* isolate = script->GetIsolate(); |
- Handle<String> name_or_source_url_key = |
- isolate->factory()->InternalizeOneByteString( |
- STATIC_CHAR_VECTOR("nameOrSourceURL")); |
- Handle<JSObject> script_wrapper = Script::GetWrapper(script); |
- Handle<Object> property = |
- JSReceiver::GetProperty(script_wrapper, name_or_source_url_key) |
- .ToHandleChecked(); |
- DCHECK(property->IsJSFunction()); |
- Handle<Object> result; |
- // Do not check against pending exception, since this function may be called |
- // when an exception has already been pending. |
- if (!Execution::TryCall(isolate, property, script_wrapper, 0, NULL) |
- .ToHandle(&result)) { |
- return isolate->factory()->undefined_value(); |
+ |
+ // Keep in sync with ScriptNameOrSourceURL in messages.js. |
+ |
+ if (!script->source_url()->IsUndefined(isolate)) { |
+ return handle(script->source_url(), isolate); |
} |
- return result; |
+ return handle(script->name(), isolate); |
} |