Ignore:
Timestamp:
Aug 13, 2015, 10:25:01 AM (10 years ago)
Author:
Yusuke Suzuki
Message:

X.SetPrototypeOf(Y) should succeed if X.Prototype is already Y even if X is not extensible
https://bugs.webkit.org/show_bug.cgi?id=147930

Reviewed by Saam Barati.

When the passed prototype object to be set is the same to the existing
prototype object, SetPrototypeOf just finishes its operation even
if the extensibility of the target object is false.

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncProtoSetter):

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorSetPrototypeOf):

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectSetPrototypeOf):

  • tests/stress/set-same-prototype.js: Added.

(shouldBe):
(shouldThrow):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r186860 r188384  
    875875        return JSValue::encode(jsUndefined());
    876876
     877    if (thisObject->prototype() == value)
     878        return JSValue::encode(jsUndefined());
     879
    877880    if (!thisObject->isExtensible())
    878881        return throwVMError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
Note: See TracChangeset for help on using the changeset viewer.