Reviewers: cbruni,

Description:
Message formatting: handle unexpected case of failing property lookup.

[email protected]
BUG=chromium:523308
LOG=N

Please review this at https://codereview.chromium.org/1314543004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -0 lines):
  M src/messages.cc
  A test/mjsunit/regress/regress-crbug-523308.js


Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index fd10d45d4a02c59f9c43dc5b1a9c7f4c446bf289..a8afa3f5a75067c76c173d301c3d41b0a789a4bc 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -449,6 +449,7 @@ MaybeHandle<String> ErrorToStringHelper::Stringify(Isolate* isolate,
 bool ErrorToStringHelper::ShadowsInternalError(
     Isolate* isolate, LookupIterator* property_lookup,
     LookupIterator* internal_error_lookup) {
+  if (!property_lookup->IsFound()) return false;
   Handle<JSObject> holder = property_lookup->GetHolder<JSObject>();
   // It's fine if the property is defined on the error itself.
   if (holder.is_identical_to(property_lookup->GetReceiver())) return true;
Index: test/mjsunit/regress/regress-crbug-523308.js
diff --git a/test/mjsunit/regress/regress-crbug-523308.js b/test/mjsunit/regress/regress-crbug-523308.js
new file mode 100644
index 0000000000000000000000000000000000000000..5715762ed6b57e98c45e551fa6483bd8e5501a34
--- /dev/null
+++ b/test/mjsunit/regress/regress-crbug-523308.js
@@ -0,0 +1,10 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var error;
+try { reference_error(); } catch (e) { error = e; }
+toString = error.toString;
+error.__proto__ = [];
+assertEquals("ReferenceError: reference_error is not defined",
+             toString.call(error));


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to