Ignore:
Timestamp:
Mar 1, 2016, 1:45:16 PM (9 years ago)
Author:
[email protected]
Message:

IsExtensible should be a virtual method in the method table
https://bugs.webkit.org/show_bug.cgi?id=154799

Reviewed by Mark Lam.

This patch makes us more consistent with how the ES6 specification models the
IsExtensible trap. Moving this method into ClassInfo::methodTable
is a prerequisite for implementing Proxy.IsExtensible.

  • runtime/ClassInfo.h:
  • runtime/JSCell.cpp:

(JSC::JSCell::preventExtensions):
(JSC::JSCell::isExtensible):

  • runtime/JSCell.h:
  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncProtoSetter):

  • runtime/JSObject.cpp:

(JSC::JSObject::preventExtensions):
(JSC::JSObject::isExtensible):
(JSC::JSObject::reifyAllStaticProperties):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::defineOwnNonIndexProperty):
(JSC::JSObject::defineOwnProperty):

  • runtime/JSObject.h:

(JSC::JSObject::isSealed):
(JSC::JSObject::isFrozen):
(JSC::JSObject::isExtensibleImpl):
(JSC::JSObject::isStructureExtensible):
(JSC::JSObject::isExtensibleInline):
(JSC::JSObject::indexingShouldBeSparse):
(JSC::JSObject::putDirectInternal):
(JSC::JSObject::isExtensible): Deleted.

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorSetPrototypeOf):
(JSC::objectConstructorIsSealed):
(JSC::objectConstructorIsFrozen):
(JSC::objectConstructorIsExtensible):
(JSC::objectConstructorIs):

  • runtime/ProxyObject.cpp:

(JSC::ProxyObject::performInternalMethodGetOwnProperty):
(JSC::ProxyObject::performHasProperty):

  • runtime/ReflectObject.cpp:

(JSC::reflectObjectIsExtensible):
(JSC::reflectObjectSetPrototypeOf):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayValueMap::putDirect):

  • runtime/StringObject.cpp:

(JSC::StringObject::defineOwnProperty):

  • runtime/Structure.cpp:

(JSC::Structure::isSealed):
(JSC::Structure::isFrozen):

  • runtime/Structure.h:
File:
1 edited

Legend:

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

    r197383 r197412  
    197197        // FIXME: this doesn't work if 'target' is another Proxy. We don't have isExtensible implemented in a way that fits w/ Proxys.
    198198        // https://bugs.webkit.org/show_bug.cgi?id=154375
    199         if (!target->isExtensible()) {
     199        bool isExtensible = target->isExtensibleInline(exec);
     200        if (exec->hadException())
     201            return false;
     202        if (!isExtensible) {
    200203            // FIXME: Come up with a test for this error. I'm not sure how to because
    201204            // Object.seal(o) will make all fields [[Configurable]] false.
     
    208211    }
    209212
     213    bool isExtensible = target->isExtensibleInline(exec);
     214    if (exec->hadException())
     215        return false;
    210216    PropertyDescriptor trapResultAsDescriptor;
    211217    toPropertyDescriptor(exec, trapResult, trapResultAsDescriptor);
     
    213219        return false;
    214220    bool throwException = false;
    215     bool valid = validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, target->isExtensible(),
     221    bool valid = validateAndApplyPropertyDescriptor(exec, nullptr, propertyName, isExtensible,
    216222        trapResultAsDescriptor, isTargetPropertyDescriptorDefined, targetPropertyDescriptor, throwException);
    217223    if (!valid) {
     
    289295                return false;
    290296            }
    291             if (!target->isExtensible()) {
     297            bool isExtensible = target->isExtensibleInline(exec);
     298            if (exec->hadException())
     299                return false;
     300            if (!isExtensible) {
    292301                throwVMTypeError(exec, ASCIILiteral("Proxy 'has' must return 'true' for a non-extensible 'target' object with a configurable property."));
    293302                return false;
Note: See TracChangeset for help on using the changeset viewer.