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

Side by Side Diff: src/messages.cc

Issue 1314543004: Message formatting: handle unexpected case of failing property lookup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-523308.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/messages.h" 5 #include "src/messages.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/execution.h" 8 #include "src/execution.h"
9 #include "src/string-builder.h" 9 #include "src/string-builder.h"
10 10
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 builder.AppendString(name); 442 builder.AppendString(name);
443 builder.AppendCString(": "); 443 builder.AppendCString(": ");
444 builder.AppendString(message); 444 builder.AppendString(message);
445 return builder.Finish(); 445 return builder.Finish();
446 } 446 }
447 447
448 448
449 bool ErrorToStringHelper::ShadowsInternalError( 449 bool ErrorToStringHelper::ShadowsInternalError(
450 Isolate* isolate, LookupIterator* property_lookup, 450 Isolate* isolate, LookupIterator* property_lookup,
451 LookupIterator* internal_error_lookup) { 451 LookupIterator* internal_error_lookup) {
452 if (!property_lookup->IsFound()) return false;
452 Handle<JSObject> holder = property_lookup->GetHolder<JSObject>(); 453 Handle<JSObject> holder = property_lookup->GetHolder<JSObject>();
453 // It's fine if the property is defined on the error itself. 454 // It's fine if the property is defined on the error itself.
454 if (holder.is_identical_to(property_lookup->GetReceiver())) return true; 455 if (holder.is_identical_to(property_lookup->GetReceiver())) return true;
455 PrototypeIterator it(isolate, holder, PrototypeIterator::START_AT_RECEIVER); 456 PrototypeIterator it(isolate, holder, PrototypeIterator::START_AT_RECEIVER);
456 while (true) { 457 while (true) {
457 if (it.IsAtEnd()) return false; 458 if (it.IsAtEnd()) return false;
458 if (it.IsAtEnd(internal_error_lookup->GetHolder<JSObject>())) return true; 459 if (it.IsAtEnd(internal_error_lookup->GetHolder<JSObject>())) return true;
459 it.AdvanceIgnoringProxies(); 460 it.AdvanceIgnoringProxies();
460 } 461 }
461 } 462 }
462 463
463 464
464 MaybeHandle<String> ErrorToStringHelper::GetStringifiedProperty( 465 MaybeHandle<String> ErrorToStringHelper::GetStringifiedProperty(
465 Isolate* isolate, LookupIterator* property_lookup, 466 Isolate* isolate, LookupIterator* property_lookup,
466 Handle<String> default_value) { 467 Handle<String> default_value) {
467 if (!property_lookup->IsFound()) return default_value; 468 if (!property_lookup->IsFound()) return default_value;
468 Handle<Object> obj; 469 Handle<Object> obj;
469 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::GetProperty(property_lookup), 470 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Object::GetProperty(property_lookup),
470 String); 471 String);
471 if (obj->IsUndefined()) return default_value; 472 if (obj->IsUndefined()) return default_value;
472 if (!obj->IsString()) { 473 if (!obj->IsString()) {
473 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj), 474 ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, Execution::ToString(isolate, obj),
474 String); 475 String);
475 } 476 }
476 return Handle<String>::cast(obj); 477 return Handle<String>::cast(obj);
477 } 478 }
478 479
479 } // namespace internal 480 } // namespace internal
480 } // namespace v8 481 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-523308.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698