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

Unified Diff: src/messages.cc

Issue 1403923002: Fix Error object value lookups. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-542101.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 640c2dff4e891266ce2fab0c206173dc1f7067c5..9489071403b903726aa327c34a85d4fb1f7777c7 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -400,10 +400,6 @@ MaybeHandle<String> ErrorToStringHelper::Stringify(Isolate* isolate,
Handle<String> name_string = isolate->factory()->name_string();
LookupIterator internal_error_lookup(
error, internal_key, LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
- LookupIterator message_lookup(
- error, message_string, LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
- LookupIterator name_lookup(error, name_string,
- LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
// Find out whether an internally created error object is on the prototype
// chain. If the name property is found on a holder prior to the internally
@@ -412,24 +408,26 @@ MaybeHandle<String> ErrorToStringHelper::Stringify(Isolate* isolate,
// Similar for the message property. If the message property shadows the
// internally created error object, use that message property. Otherwise
// use empty string as message.
- if (internal_error_lookup.IsFound()) {
- if (!ShadowsInternalError(isolate, &name_lookup, &internal_error_lookup)) {
- Handle<JSObject> holder = internal_error_lookup.GetHolder<JSObject>();
- name = Handle<String>(holder->constructor_name());
- }
- if (!ShadowsInternalError(isolate, &message_lookup,
- &internal_error_lookup)) {
- message = isolate->factory()->empty_string();
- }
- }
- if (name.is_null()) {
+ LookupIterator name_lookup(error, name_string,
+ LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
+ if (internal_error_lookup.IsFound() &&
+ !ShadowsInternalError(isolate, &name_lookup, &internal_error_lookup)) {
+ Handle<JSObject> holder = internal_error_lookup.GetHolder<JSObject>();
+ name = Handle<String>(holder->constructor_name());
+ } else {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, name,
GetStringifiedProperty(isolate, &name_lookup,
isolate->factory()->Error_string()),
String);
}
- if (message.is_null()) {
+
+ LookupIterator message_lookup(
+ error, message_string, LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
+ if (internal_error_lookup.IsFound() &&
+ !ShadowsInternalError(isolate, &message_lookup, &internal_error_lookup)) {
+ message = isolate->factory()->empty_string();
+ } else {
ASSIGN_RETURN_ON_EXCEPTION(
isolate, message,
GetStringifiedProperty(isolate, &message_lookup,
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-542101.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698