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

Unified Diff: src/objects.cc

Issue 1680133002: [proxies] Implement spec change to consistency check in [[SetPrototypeOf]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/harmony/proxies-set-prototype-of.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index f787a3098c50bb1b9adde6c85f21039f50bfdce2..da54ea1404af8a7e99b941f671f321a9c31fa253 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -15718,33 +15718,35 @@ Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value,
Execution::Call(isolate, trap, handler, arraysize(argv), argv),
Nothing<bool>());
bool bool_trap_result = trap_result->BooleanValue();
- // 9. Let extensibleTarget be ? IsExtensible(target).
+ // 9. If booleanTrapResult is false, return false.
+ if (!bool_trap_result) {
+ RETURN_FAILURE(
+ isolate, should_throw,
+ NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
+ }
+ // 10. Let extensibleTarget be ? IsExtensible(target).
Maybe<bool> is_extensible = JSReceiver::IsExtensible(target);
if (is_extensible.IsNothing()) return Nothing<bool>();
- // 10. If extensibleTarget is true, return booleanTrapResult.
+ // 11. If extensibleTarget is true, return true.
if (is_extensible.FromJust()) {
if (bool_trap_result) return Just(true);
RETURN_FAILURE(
isolate, should_throw,
NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
}
- // 11. Let targetProto be ? target.[[GetPrototypeOf]]().
+ // 12. Let targetProto be ? target.[[GetPrototypeOf]]().
Handle<Object> target_proto;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, target_proto,
JSReceiver::GetPrototype(isolate, target),
Nothing<bool>());
- // 12. If booleanTrapResult is true and SameValue(V, targetProto) is false,
- // throw a TypeError exception.
+ // 13. If SameValue(V, targetProto) is false, throw a TypeError exception.
if (bool_trap_result && !value->SameValue(*target_proto)) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kProxySetPrototypeOfNonExtensible));
return Nothing<bool>();
}
- // 13. Return booleanTrapResult.
- if (bool_trap_result) return Just(true);
- RETURN_FAILURE(
- isolate, should_throw,
- NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
+ // 14. Return true.
+ return Just(true);
}
« no previous file with comments | « no previous file | test/mjsunit/harmony/proxies-set-prototype-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698