Ignore:
Timestamp:
Apr 6, 2017, 5:16:18 PM (8 years ago)
Author:
[email protected]
Message:

Cannot Object.seal() or Object.freeze() global "this"
https://bugs.webkit.org/show_bug.cgi?id=170549

Reviewed by Mark Lam.

JSTests:

Enabled failing tests fixed by the corresponding code change:

ChakraCore/test/LetConst/delete.js
ChakraCore/test/LetConst/dop.js
ChakraCore/test/LetConst/dop1.js

  • ChakraCore.yaml:
  • ChakraCore/test/LetConst/dop.baseline-jsc: Added JSC specific expected output.
  • ChakraCore/test/LetConst/dop1.baseline-jsc: Added JSC specific expected output.

Source/JavaScriptCore:

Needed to implement JSProxy::isExtensible() which returns the results of calling
the same on wrapped object.

Implemented step 11 of Runtime Semantics: EvalDeclarationInstantiation from the ECMAScript
spec to properly return a TypeError object when attempting to add properties to a
non-extensible global object.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):

  • runtime/JSProxy.cpp:

(JSC::JSProxy::isExtensible):

  • runtime/JSProxy.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r214905 r215072  
    11591159            if (!hasProperty) {
    11601160                PutPropertySlot slot(variableObject);
     1161                if (!variableObject->isExtensible(callFrame))
     1162                    return checkedReturn(throwTypeError(callFrame, throwScope, ASCIILiteral(NonExtensibleObjectPropertyDefineError)));
    11611163                variableObject->methodTable()->put(variableObject, callFrame, ident, jsUndefined(), slot);
    11621164                RETURN_IF_EXCEPTION(throwScope, checkedReturn(throwScope.exception()));
Note: See TracChangeset for help on using the changeset viewer.