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. |