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

Unified Diff: src/objects.cc

Issue 1143623002: [strong] Implement per-object restrictions behaviour for prototype setting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 7 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 | « src/messages.h ('k') | test/mjsunit/strong/object-set-prototype.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 b4dece00ebf60bae9d9e456e466f21910d0067d5..52b01d020dd1a35219664d3d586897b376de6b34 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12607,6 +12607,13 @@ MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object,
#endif
Isolate* isolate = object->GetIsolate();
+ // Strong objects may not have their prototype set via __proto__ or
+ // setPrototypeOf.
+ if (from_javascript && object->map()->is_strong()) {
+ THROW_NEW_ERROR(isolate,
+ NewTypeError(MessageTemplate::kStrongSetProto, object),
+ Object);
+ }
Heap* heap = isolate->heap();
// Silently ignore the change if value is not a JSObject or null.
// SpiderMonkey behaves this way.
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/strong/object-set-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698