Ignore:
Timestamp:
Dec 26, 2011, 8:56:37 PM (13 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=75231
Fail to throw in strict mode on assign to read only static properties

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

There are three bugs here:

  • symbolTablePut should throw for strict mode accesses.
  • lookupPut should throw for strict mode accesses.
  • NumberConstructor should override put to call lookupPut, to trap assignment to readonly properties.
  • runtime/JSActivation.cpp:

(JSC::JSActivation::symbolTablePut):
(JSC::JSActivation::put):

  • runtime/JSActivation.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::put):

  • runtime/JSStaticScopeObject.cpp:

(JSC::JSStaticScopeObject::put):

  • runtime/JSVariableObject.h:

(JSC::JSVariableObject::symbolTablePut):

  • runtime/Lookup.h:

(JSC::lookupPut):

  • runtime/NumberConstructor.cpp:

(JSC::NumberConstructor::put):

  • runtime/NumberConstructor.h:

LayoutTests:

Added test cases / updated now-passing results.

  • fast/js/mozilla/strict/15.10.7-expected.txt:
  • fast/js/script-tests/strict-readonly-statics.js: Added.

(testWindowUndefined):
(testNumberMAX_VALUE):

  • fast/js/strict-readonly-statics-expected.txt: Added.
  • fast/js/strict-readonly-statics.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSActivation.h

    r103243 r103697  
    8484        bool symbolTableGet(const Identifier&, PropertyDescriptor&);
    8585        bool symbolTableGet(const Identifier&, PropertySlot&, bool& slotIsWriteable);
    86         bool symbolTablePut(JSGlobalData&, const Identifier&, JSValue);
     86        bool symbolTablePut(ExecState*, const Identifier&, JSValue, bool shouldThrow);
    8787        bool symbolTablePutWithAttributes(JSGlobalData&, const Identifier&, JSValue, unsigned attributes);
    8888
Note: See TracChangeset for help on using the changeset viewer.