Changeset 109866 in webkit
- Timestamp:
- Mar 5, 2012 11:23:21 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 56 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r109851 r109866 1 2012-03-05 Gavin Barraclough <barraclough@apple.com> 2 3 putByIndex should throw in strict mode 4 https://bugs.webkit.org/show_bug.cgi?id=80335 5 6 Reviewed by Filip Pizlo. 7 8 Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter. 9 10 * fast/js/Object-defineProperty-expected.txt: 11 * fast/js/mozilla/strict/15.4.4.12-expected.txt: 12 * fast/js/mozilla/strict/15.4.4.13-expected.txt: 13 * fast/js/mozilla/strict/15.4.4.8-expected.txt: 14 * fast/js/mozilla/strict/15.4.4.9-expected.txt: 15 * fast/js/mozilla/strict/15.5.5.2-expected.txt: 16 * fast/js/mozilla/strict/8.12.5-expected.txt: 17 * fast/js/preventExtensions-expected.txt: 18 * fast/js/primitive-property-access-edge-cases-expected.txt: 19 - Checking in passing test results. 20 * fast/js/script-tests/Object-defineProperty.js: 21 - Added test cases for putting to numeric properties where property is read-only, 22 length is read-only, or property is accessor with missing set function. 23 * fast/js/script-tests/preventExtensions.js: 24 - Added test case, putting numeric property to non-extensible array. 25 * fast/js/script-tests/primitive-property-access-edge-cases.js: 26 - Enabled test cases for putting numeric properties to primitive strings. 27 1 28 2012-03-05 Adrienne Walker <enne@google.com> 2 29 -
trunk/LayoutTests/fast/js/Object-defineProperty-expected.txt
r109240 r109866 120 120 PASS Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: false}), 'foo').writable is false 121 121 PASS Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: true}), 'foo').writable is true 122 PASS var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a; is false 123 PASS 'use strict'; var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a; threw exception TypeError: Attempted to assign to readonly property.. 124 PASS var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0]; is 42 125 PASS 'use strict'; var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0]; threw exception TypeError: Attempted to assign to readonly property.. 126 PASS var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0]; is undefined. 127 PASS 'use strict'; var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0]; threw exception TypeError: Attempted to assign to readonly property.. 122 128 PASS successfullyParsed is true 123 129 -
trunk/LayoutTests/fast/js/mozilla/strict/15.4.4.12-expected.txt
r78731 r109866 2 2 FAIL var a = arr(); [a.splice(0, 1), a] should throw an instance of TypeError 3 3 PASS true === true 4 FAIL 'use strict'; var o = obj(); [Array.prototype.splice.call(o, 0, 1), o] should throw an instance of TypeError 5 FAIL var o = obj(); [Array.prototype.splice.call(o, 0, 1), o] should throw an instance of TypeError 4 PASS 'use strict'; var o = obj(); [Array.prototype.splice.call(o, 0, 1), o] threw exception of type TypeError. 5 PASS var o = obj(); [Array.prototype.splice.call(o, 0, 1), o] threw exception of type TypeError. 6 6 PASS true === true 7 7 FAIL 'use strict'; var a = agap(); [a.splice(0, 1), a] should throw an instance of TypeError -
trunk/LayoutTests/fast/js/mozilla/strict/15.4.4.13-expected.txt
r78731 r109866 2 2 FAIL var a = arr(); [a.unshift(40, 50), a] should throw an instance of TypeError 3 3 PASS true === true 4 FAIL 'use strict'; var o = obj(); [Array.prototype.unshift.call(o, 40, 50), o] should throw an instance of TypeError 5 FAIL var o = obj(); [Array.prototype.unshift.call(o, 40, 50), o] should throw an instance of TypeError 4 PASS 'use strict'; var o = obj(); [Array.prototype.unshift.call(o, 40, 50), o] threw exception of type TypeError. 5 PASS var o = obj(); [Array.prototype.unshift.call(o, 40, 50), o] threw exception of type TypeError. 6 6 PASS true === true 7 7 FAIL 'use strict'; var a = agap(); [a.unshift(9), a] should throw an instance of TypeError -
trunk/LayoutTests/fast/js/mozilla/strict/15.4.4.8-expected.txt
r78731 r109866 1 FAIL 'use strict'; var a = arr(); a.reverse() should throw an instance of TypeError 2 FAIL var a = arr(); a.reverse() should throw an instance of TypeError 1 PASS 'use strict'; var a = arr(); a.reverse() threw exception of type TypeError. 2 PASS var a = arr(); a.reverse() threw exception of type TypeError. 3 3 PASS true === true 4 FAIL 'use strict'; var o = obj(); Array.prototype.reverse.call(o) should throw an instance of TypeError 5 FAIL var o = obj(); Array.prototype.reverse.call(o) should throw an instance of TypeError 4 PASS 'use strict'; var o = obj(); Array.prototype.reverse.call(o) threw exception of type TypeError. 5 PASS var o = obj(); Array.prototype.reverse.call(o) threw exception of type TypeError. 6 6 PASS true === true 7 7 FAIL 'use strict'; var a = agap(); a.reverse() should throw an instance of TypeError -
trunk/LayoutTests/fast/js/mozilla/strict/15.4.4.9-expected.txt
r78731 r109866 2 2 FAIL var a = arr(); [a.shift(), a] should throw an instance of TypeError 3 3 PASS true === true 4 FAIL 'use strict'; var o = obj(); [Array.prototype.shift.call(o), o] should throw an instance of TypeError 5 FAIL var o = obj(); [Array.prototype.shift.call(o), o] should throw an instance of TypeError 4 PASS 'use strict'; var o = obj(); [Array.prototype.shift.call(o), o] threw exception of type TypeError. 5 PASS var o = obj(); [Array.prototype.shift.call(o), o] threw exception of type TypeError. 6 6 PASS true === true 7 7 FAIL 'use strict'; var a = agap(); [a.shift(), a] should throw an instance of TypeError -
trunk/LayoutTests/fast/js/mozilla/strict/15.5.5.2-expected.txt
r78731 r109866 1 FAIL 'use strict'; "foo"[0] = 1 should throw an instance of TypeError 1 PASS 'use strict'; "foo"[0] = 1 threw exception of type TypeError. 2 2 PASS "foo"[0] = 1 is 1 3 3 PASS true === true -
trunk/LayoutTests/fast/js/mozilla/strict/8.12.5-expected.txt
r104488 r109866 26 26 PASS var a = arr(); a[0] = 2; a[0] is 2 27 27 PASS true === true 28 FAIL 'use strict'; var a = arr(); a[1] = 2; a[1] should throw an instance of TypeError 28 PASS 'use strict'; var a = arr(); a[1] = 2; a[1] threw exception of type TypeError. 29 29 PASS var a = arr(); a[1] = 2; a[1] is 1 30 30 PASS true === true … … 32 32 PASS var a = arr(); a[2] = 2; a[2] is 2 33 33 PASS true === true 34 FAIL 'use strict'; var a = arr(); a[3] = 2; a[3] should throw an instance of TypeError 34 PASS 'use strict'; var a = arr(); a[3] = 2; a[3] threw exception of type TypeError. 35 35 PASS var a = arr(); a[3] = 2; a[3] is 1 36 36 PASS true === true 37 FAIL 'use strict'; arr()[1]++ should throw an instance of TypeError 37 PASS 'use strict'; arr()[1]++ threw exception of type TypeError. 38 38 PASS arr()[1]++ is 1 39 39 PASS true === true 40 FAIL 'use strict'; ++arr()[1] should throw an instance of TypeError 40 PASS 'use strict'; ++arr()[1] threw exception of type TypeError. 41 41 PASS ++arr()[1] is 2 42 42 PASS true === true 43 FAIL 'use strict'; arr()[1]-- should throw an instance of TypeError 43 PASS 'use strict'; arr()[1]-- threw exception of type TypeError. 44 44 PASS arr()[1]-- is 1 45 45 PASS true === true 46 FAIL 'use strict'; --arr()[1] should throw an instance of TypeError 46 PASS 'use strict'; --arr()[1] threw exception of type TypeError. 47 47 PASS --arr()[1] is 0 48 48 PASS true === true -
trunk/LayoutTests/fast/js/preventExtensions-expected.txt
r108651 r109866 17 17 PASS var arr = Object.preventExtensions([]); arr[0] = 42; arr[0] is undefined. 18 18 PASS var arr = Object.preventExtensions([]); arr[0] = 42; arr.length is 0 19 PASS "use strict"; var arr = Object.preventExtensions([]); arr[0] = 42; arr[0] threw exception TypeError: Attempted to assign to readonly property.. 19 20 PASS obj.foo is 1 20 21 PASS array[0] is 0 -
trunk/LayoutTests/fast/js/primitive-property-access-edge-cases-expected.txt
r109824 r109866 38 38 PASS checkNumericGetStrict(true, Boolean) is true 39 39 PASS checkNumericSetStrict(1, Number) is true 40 PASS checkNumericSetStrict('hello', String) is true 40 41 PASS checkNumericSetStrict(true, Boolean) is true 41 42 PASS checkNumericRead(1, Number) is true … … 49 50 PASS checkNumericReadStrict(true, Boolean) is true 50 51 PASS checkNumericWriteStrict(1, Number) threw exception TypeError: Attempted to assign to readonly property.. 52 PASS checkNumericWriteStrict('hello', String) threw exception TypeError: Attempted to assign to readonly property.. 51 53 PASS checkNumericWriteStrict(true, Boolean) threw exception TypeError: Attempted to assign to readonly property.. 52 54 PASS didNotCrash is true -
trunk/LayoutTests/fast/js/script-tests/Object-defineProperty.js
r109240 r109866 172 172 shouldBeFalse("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: false}), 'foo').writable"); 173 173 shouldBeTrue("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: true}), 'foo').writable"); 174 175 // If array length is read-only, [[Put]] should fail. 176 shouldBeFalse("var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a;"); 177 shouldThrow("'use strict'; var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a;"); 178 179 // If array property is read-only, [[Put]] should fail. 180 shouldBe("var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0];", '42'); 181 shouldThrow("'use strict'; var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0];"); 182 183 // If array property is an undefined setter, [[Put]] should fail. 184 shouldBeUndefined("var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];"); 185 shouldThrow("'use strict'; var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];"); -
trunk/LayoutTests/fast/js/script-tests/preventExtensions.js
r108651 r109866 79 79 shouldBeUndefined('var arr = Object.preventExtensions([]); arr[0] = 42; arr[0]'); 80 80 shouldBe('var arr = Object.preventExtensions([]); arr[0] = 42; arr.length', '0'); 81 // In strict mode, this throws. 82 shouldThrow('"use strict"; var arr = Object.preventExtensions([]); arr[0] = 42; arr[0]'); 81 83 82 84 // A read-only property on the prototype should prevent a [[Put]] . -
trunk/LayoutTests/fast/js/script-tests/primitive-property-access-edge-cases.js
r109824 r109866 173 173 shouldBeTrue("checkNumericGetStrict(true, Boolean)"); 174 174 shouldBeTrue("checkNumericSetStrict(1, Number)"); 175 //shouldBeTrue("checkNumericSetStrict('hello', String)"); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=80335 175 shouldBeTrue("checkNumericSetStrict('hello', String)"); 176 176 shouldBeTrue("checkNumericSetStrict(true, Boolean)"); 177 177 … … 210 210 shouldBeTrue("checkNumericReadStrict(true, Boolean)"); 211 211 shouldThrow("checkNumericWriteStrict(1, Number)"); 212 //shouldThrow("checkNumericWriteStrict('hello', String)"); // FIXME: https://bugs.webkit.org/show_bug.cgi?id=80335 212 shouldThrow("checkNumericWriteStrict('hello', String)"); 213 213 shouldThrow("checkNumericWriteStrict(true, Boolean)"); 214 214 -
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r104899 r109866 313 313 JSValue jsValue = toJS(exec, value); 314 314 315 jsObject->methodTable()->putByIndex(jsObject, exec, propertyIndex, jsValue );315 jsObject->methodTable()->putByIndex(jsObject, exec, propertyIndex, jsValue, false); 316 316 if (exec->hadException()) { 317 317 if (exception) -
trunk/Source/JavaScriptCore/ChangeLog
r109865 r109866 1 2012-03-05 Gavin Barraclough <barraclough@apple.com> 2 3 putByIndex should throw in strict mode 4 https://bugs.webkit.org/show_bug.cgi?id=80335 5 6 Reviewed by Filip Pizlo. 7 8 Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter. 9 10 This is a largely mechanical change, simply adding an extra parameter to a number 11 of functions. Some call sites need perform additional exception checks, and 12 operationPutByValBeyondArrayBounds needs to know whether it is strict or not. 13 14 This patch doesn't fix a missing throw from some cases of shift/unshift (this is 15 an existing bug), I'll follow up with a third patch to handle that. 16 17 * API/JSObjectRef.cpp: 18 (JSObjectSetPropertyAtIndex): 19 * JSCTypedArrayStubs.h: 20 (JSC): 21 * dfg/DFGOperations.cpp: 22 (JSC::DFG::putByVal): 23 * dfg/DFGOperations.h: 24 * dfg/DFGSpeculativeJIT32_64.cpp: 25 (JSC::DFG::SpeculativeJIT::compile): 26 * dfg/DFGSpeculativeJIT64.cpp: 27 (JSC::DFG::SpeculativeJIT::compile): 28 * interpreter/Interpreter.cpp: 29 (JSC::Interpreter::privateExecute): 30 * jit/JITStubs.cpp: 31 (JSC::DEFINE_STUB_FUNCTION): 32 * jsc.cpp: 33 (GlobalObject::finishCreation): 34 * llint/LLIntSlowPaths.cpp: 35 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 36 * runtime/Arguments.cpp: 37 (JSC::Arguments::putByIndex): 38 * runtime/Arguments.h: 39 (Arguments): 40 * runtime/ArrayPrototype.cpp: 41 (JSC::arrayProtoFuncPush): 42 (JSC::arrayProtoFuncReverse): 43 (JSC::arrayProtoFuncShift): 44 (JSC::arrayProtoFuncSort): 45 (JSC::arrayProtoFuncSplice): 46 (JSC::arrayProtoFuncUnShift): 47 * runtime/ClassInfo.h: 48 (MethodTable): 49 * runtime/JSArray.cpp: 50 (JSC::SparseArrayValueMap::put): 51 (JSC::JSArray::put): 52 (JSC::JSArray::putByIndex): 53 (JSC::JSArray::putByIndexBeyondVectorLength): 54 (JSC::JSArray::push): 55 (JSC::JSArray::shiftCount): 56 (JSC::JSArray::unshiftCount): 57 * runtime/JSArray.h: 58 (SparseArrayValueMap): 59 (JSArray): 60 * runtime/JSByteArray.cpp: 61 (JSC::JSByteArray::putByIndex): 62 * runtime/JSByteArray.h: 63 (JSByteArray): 64 * runtime/JSCell.cpp: 65 (JSC::JSCell::putByIndex): 66 * runtime/JSCell.h: 67 (JSCell): 68 * runtime/JSNotAnObject.cpp: 69 (JSC::JSNotAnObject::putByIndex): 70 * runtime/JSNotAnObject.h: 71 (JSNotAnObject): 72 * runtime/JSONObject.cpp: 73 (JSC::Walker::walk): 74 * runtime/JSObject.cpp: 75 (JSC::JSObject::putByIndex): 76 * runtime/JSObject.h: 77 (JSC::JSValue::putByIndex): 78 * runtime/RegExpConstructor.cpp: 79 (JSC::RegExpMatchesArray::fillArrayInstance): 80 * runtime/RegExpMatchesArray.h: 81 (JSC::RegExpMatchesArray::putByIndex): 82 * runtime/StringPrototype.cpp: 83 (JSC::stringProtoFuncSplit): 84 1 85 2012-03-05 Yuqiang Xian <yuqiang.xian@intel.com> 2 86 -
trunk/Source/JavaScriptCore/JSCTypedArrayStubs.h
r108432 r109866 152 152 }\ 153 153 \ 154 void JS##name##Array::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value )\154 void JS##name##Array::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool)\ 155 155 {\ 156 156 JS##name##Array* thisObject = jsCast<JS##name##Array*>(cell);\ -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r109837 r109866 159 159 } 160 160 161 JSArray::putByIndex(array, exec, index, value );161 JSArray::putByIndex(array, exec, index, value, strict); 162 162 return; 163 163 } … … 475 475 } 476 476 477 void DFG_OPERATION operationPutByValBeyondArrayBounds (ExecState* exec, JSArray* array, int32_t index, EncodedJSValue encodedValue)477 void DFG_OPERATION operationPutByValBeyondArrayBoundsStrict(ExecState* exec, JSArray* array, int32_t index, EncodedJSValue encodedValue) 478 478 { 479 479 JSGlobalData* globalData = &exec->globalData(); … … 482 482 // We should only get here if index is outside the existing vector. 483 483 ASSERT(!array->canSetIndex(index)); 484 JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue)); 484 JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), true); 485 } 486 487 void DFG_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState* exec, JSArray* array, int32_t index, EncodedJSValue encodedValue) 488 { 489 JSGlobalData* globalData = &exec->globalData(); 490 NativeCallFrameTracer tracer(globalData, exec); 491 492 // We should only get here if index is outside the existing vector. 493 ASSERT(!array->canSetIndex(index)); 494 JSArray::putByIndex(array, exec, index, JSValue::decode(encodedValue), false); 485 495 } 486 496 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r108908 r109866 120 120 void DFG_OPERATION operationPutByValCellStrict(ExecState*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue); 121 121 void DFG_OPERATION operationPutByValCellNonStrict(ExecState*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue); 122 void DFG_OPERATION operationPutByValBeyondArrayBounds(ExecState*, JSArray*, int32_t index, EncodedJSValue encodedValue); 122 void DFG_OPERATION operationPutByValBeyondArrayBoundsStrict(ExecState*, JSArray*, int32_t index, EncodedJSValue encodedValue); 123 void DFG_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState*, JSArray*, int32_t index, EncodedJSValue encodedValue); 123 124 EncodedJSValue DFG_OPERATION operationArrayPush(ExecState*, EncodedJSValue encodedValue, JSArray*); 124 125 EncodedJSValue DFG_OPERATION operationArrayPop(ExecState*, JSArray*); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r109834 r109866 2380 2380 // Code to handle put beyond array bounds. 2381 2381 silentSpillAllRegisters(scratchReg); 2382 callOperation( operationPutByValBeyondArrayBounds, baseReg, propertyReg, valueTagReg, valuePayloadReg);2382 callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByValBeyondArrayBoundsStrict : operationPutByValBeyondArrayBoundsNonStrict, baseReg, propertyReg, valueTagReg, valuePayloadReg); 2383 2383 silentFillAllRegisters(scratchReg); 2384 2384 JITCompiler::Jump wasBeyondArrayBounds = m_jit.jump(); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r109834 r109866 2426 2426 // Code to handle put beyond array bounds. 2427 2427 silentSpillAllRegisters(scratchReg); 2428 callOperation( operationPutByValBeyondArrayBounds, baseReg, propertyReg, valueReg);2428 callOperation(m_jit.codeBlock()->isStrictMode() ? operationPutByValBeyondArrayBoundsStrict : operationPutByValBeyondArrayBoundsNonStrict, baseReg, propertyReg, valueReg); 2429 2429 silentFillAllRegisters(scratchReg); 2430 2430 JITCompiler::Jump wasBeyondArrayBounds = m_jit.jump(); -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r109863 r109866 3778 3778 jsArray->setIndex(*globalData, i, callFrame->r(value).jsValue()); 3779 3779 else 3780 jsArray->JSArray::putByIndex(jsArray, callFrame, i, callFrame->r(value).jsValue() );3780 jsArray->JSArray::putByIndex(jsArray, callFrame, i, callFrame->r(value).jsValue(), codeBlock->isStrictMode()); 3781 3781 } else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 3782 3782 JSByteArray* jsByteArray = asByteArray(baseValue); -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r109837 r109866 2554 2554 jsArray->setIndex(*globalData, i, value); 2555 2555 else 2556 JSArray::putByIndex(jsArray, callFrame, i, value );2556 JSArray::putByIndex(jsArray, callFrame, i, value, callFrame->codeBlock()->isStrictMode()); 2557 2557 } else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i)) { 2558 2558 JSByteArray* jsByteArray = asByteArray(baseValue); -
trunk/Source/JavaScriptCore/jsc.cpp
r108420 r109866 207 207 #endif 208 208 209 JS Object* array = constructEmptyArray(globalExec());209 JSArray* array = constructEmptyArray(globalExec()); 210 210 for (size_t i = 0; i < arguments.size(); ++i) 211 array-> methodTable()->putByIndex(array, globalExec(), i, jsString(globalExec(), arguments[i]));211 array->putDirectIndex(globalExec(), i, jsString(globalExec(), arguments[i]), false); 212 212 putDirect(globalData, Identifier(globalExec(), "arguments"), array); 213 213 } -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r109863 r109866 1045 1045 jsArray->setIndex(globalData, i, value); 1046 1046 else 1047 JSArray::putByIndex(jsArray, exec, i, value );1047 JSArray::putByIndex(jsArray, exec, i, value, exec->codeBlock()->isStrictMode()); 1048 1048 LLINT_END(); 1049 1049 } -
trunk/Source/JavaScriptCore/runtime/Arguments.cpp
r108651 r109866 197 197 } 198 198 199 void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value )199 void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value, bool shouldThrow) 200 200 { 201 201 Arguments* thisObject = jsCast<Arguments*>(cell); … … 205 205 } 206 206 207 PutPropertySlot slot ;207 PutPropertySlot slot(shouldThrow); 208 208 JSObject::put(thisObject, exec, Identifier(exec, UString::number(i)), value, slot); 209 209 } -
trunk/Source/JavaScriptCore/runtime/Arguments.h
r108582 r109866 115 115 static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); 116 116 static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 117 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );117 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 118 118 static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); 119 119 static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName); -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r109673 r109866 427 427 // Check for integer overflow; where safe we can do a fast put by index. 428 428 if (length + n >= length) 429 thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->argument(n) );429 thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->argument(n), true); 430 430 else { 431 431 PutPropertySlot slot; … … 433 433 thisObj->methodTable()->put(thisObj, exec, propertyName, exec->argument(n), slot); 434 434 } 435 if (exec->hadException()) 436 return JSValue::encode(jsUndefined()); 435 437 } 436 438 JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount())); … … 457 459 458 460 if (obj2) 459 thisObj->methodTable()->putByIndex(thisObj, exec, k, obj2 );461 thisObj->methodTable()->putByIndex(thisObj, exec, k, obj2, true); 460 462 else 461 463 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k); 464 if (exec->hadException()) 465 return JSValue::encode(jsUndefined()); 462 466 463 467 if (obj) 464 thisObj->methodTable()->putByIndex(thisObj, exec, lk1, obj );468 thisObj->methodTable()->putByIndex(thisObj, exec, lk1, obj, true); 465 469 else 466 470 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, lk1); 471 if (exec->hadException()) 472 return JSValue::encode(jsUndefined()); 467 473 } 468 474 return JSValue::encode(thisObj); … … 490 496 return JSValue::encode(jsUndefined()); 491 497 if (obj) 492 thisObj->methodTable()->putByIndex(thisObj, exec, k - 1, obj );498 thisObj->methodTable()->putByIndex(thisObj, exec, k - 1, obj, true); 493 499 else 494 500 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k - 1); 501 if (exec->hadException()) 502 return JSValue::encode(jsUndefined()); 495 503 } 496 504 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, length - 1); … … 581 589 // Swap themin and i 582 590 if (themin > i) { 583 thisObj->methodTable()->putByIndex(thisObj, exec, i, minObj); 584 thisObj->methodTable()->putByIndex(thisObj, exec, themin, iObj); 591 thisObj->methodTable()->putByIndex(thisObj, exec, i, minObj, true); 592 if (exec->hadException()) 593 return JSValue::encode(jsUndefined()); 594 thisObj->methodTable()->putByIndex(thisObj, exec, themin, iObj, true); 595 if (exec->hadException()) 596 return JSValue::encode(jsUndefined()); 585 597 } 586 598 } … … 638 650 return JSValue::encode(jsUndefined()); 639 651 if (v) 640 thisObj->methodTable()->putByIndex(thisObj, exec, k + additionalArgs, v );652 thisObj->methodTable()->putByIndex(thisObj, exec, k + additionalArgs, v, true); 641 653 else 642 654 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k + additionalArgs); 655 if (exec->hadException()) 656 return JSValue::encode(jsUndefined()); 643 657 } 644 658 for (unsigned k = length; k > length - deleteCount + additionalArgs; --k) … … 654 668 return JSValue::encode(jsUndefined()); 655 669 if (obj) 656 thisObj->methodTable()->putByIndex(thisObj, exec, k + additionalArgs - 1, obj );670 thisObj->methodTable()->putByIndex(thisObj, exec, k + additionalArgs - 1, obj, true); 657 671 else 658 672 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k + additionalArgs - 1); 673 if (exec->hadException()) 674 return JSValue::encode(jsUndefined()); 659 675 } 660 676 } 661 677 } 662 678 } 663 for (unsigned k = 0; k < additionalArgs; ++k) 664 thisObj->methodTable()->putByIndex(thisObj, exec, k + begin, exec->argument(k + 2)); 679 for (unsigned k = 0; k < additionalArgs; ++k) { 680 thisObj->methodTable()->putByIndex(thisObj, exec, k + begin, exec->argument(k + 2), true); 681 if (exec->hadException()) 682 return JSValue::encode(jsUndefined()); 683 } 665 684 666 685 putProperty(exec, thisObj, exec->propertyNames().length, jsNumber(length - deleteCount + additionalArgs)); … … 687 706 return JSValue::encode(jsUndefined()); 688 707 if (v) 689 thisObj->methodTable()->putByIndex(thisObj, exec, k + nrArgs - 1, v );708 thisObj->methodTable()->putByIndex(thisObj, exec, k + nrArgs - 1, v, true); 690 709 else 691 710 thisObj->methodTable()->deletePropertyByIndex(thisObj, exec, k + nrArgs - 1); 711 if (exec->hadException()) 712 return JSValue::encode(jsUndefined()); 692 713 } 693 714 } 694 715 } 695 for (unsigned k = 0; k < nrArgs; ++k) 696 thisObj->methodTable()->putByIndex(thisObj, exec, k, exec->argument(k)); 716 for (unsigned k = 0; k < nrArgs; ++k) { 717 thisObj->methodTable()->putByIndex(thisObj, exec, k, exec->argument(k), true); 718 if (exec->hadException()) 719 return JSValue::encode(jsUndefined()); 720 } 697 721 JSValue result = jsNumber(length + nrArgs); 698 722 putProperty(exec, thisObj, exec->propertyNames().length, result); -
trunk/Source/JavaScriptCore/runtime/ClassInfo.h
r107544 r109866 49 49 PutFunctionPtr put; 50 50 51 typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue );51 typedef void (*PutByIndexFunctionPtr)(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 52 52 PutByIndexFunctionPtr putByIndex; 53 53 -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r109673 r109866 208 208 } 209 209 210 inline void SparseArrayValueMap::put(ExecState* exec, JSArray* array, unsigned i, JSValue value )210 inline void SparseArrayValueMap::put(ExecState* exec, JSArray* array, unsigned i, JSValue value, bool shouldThrow) 211 211 { 212 212 std::pair<SparseArrayValueMap::iterator, bool> result = add(array, i); … … 218 218 if (result.second && !array->isExtensible()) { 219 219 remove(result.first); 220 // FIXME: should throw in strict mode. 220 if (shouldThrow) 221 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 221 222 return; 222 223 } … … 224 225 if (!(entry.attributes & Accessor)) { 225 226 if (entry.attributes & ReadOnly) { 226 // FIXME: should throw if being called from strict mode.227 //throwTypeError(exec, StrictModeReadonlyPropertyWriteError);227 if (shouldThrow) 228 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 228 229 return; 229 230 } … … 238 239 239 240 if (!setter) { 240 // FIXME: should throw if being called from strict mode.241 // throwTypeError(exec, "setting a property that has only a getter");241 if (shouldThrow) 242 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 242 243 return; 243 244 } … … 726 727 unsigned i = propertyName.toArrayIndex(isArrayIndex); 727 728 if (isArrayIndex) { 728 putByIndex(thisObject, exec, i, value );729 putByIndex(thisObject, exec, i, value, slot.isStrictMode()); 729 730 return; 730 731 } … … 743 744 } 744 745 745 void JSArray::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value )746 void JSArray::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value, bool shouldThrow) 746 747 { 747 748 JSArray* thisObject = jsCast<JSArray*>(cell); … … 770 771 // Handle 2^32-1 - this is not an array index (see ES5.1 15.4), and is treated as a regular property. 771 772 if (UNLIKELY(i > MAX_ARRAY_INDEX)) { 772 PutPropertySlot slot ;773 PutPropertySlot slot(shouldThrow); 773 774 thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, i), value, slot); 774 775 return; … … 776 777 777 778 // For all other cases, call putByIndexBeyondVectorLength. 778 thisObject->putByIndexBeyondVectorLength(exec, i, value );779 thisObject->putByIndexBeyondVectorLength(exec, i, value, shouldThrow); 779 780 thisObject->checkConsistency(); 780 781 } 781 782 782 void JSArray::putByIndexBeyondVectorLength(ExecState* exec, unsigned i, JSValue value )783 void JSArray::putByIndexBeyondVectorLength(ExecState* exec, unsigned i, JSValue value, bool shouldThrow) 783 784 { 784 785 JSGlobalData& globalData = exec->globalData(); … … 811 812 allocateSparseMap(exec->globalData()); 812 813 map = m_sparseValueMap; 813 map->put(exec, this, i, value );814 map->put(exec, this, i, value, shouldThrow); 814 815 return; 815 816 } … … 820 821 // Prohibit growing the array if length is not writable. 821 822 if (map->lengthIsReadOnly() || !isExtensible()) { 822 // FIXME: should throw in strict mode. 823 if (shouldThrow) 824 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 823 825 return; 824 826 } … … 831 833 unsigned numValuesInArray = storage->m_numValuesInVector + map->size(); 832 834 if (map->sparseMode() || !isDenseEnoughForVector(length, numValuesInArray) || !increaseVectorLength(exec->globalData(), length)) { 833 map->put(exec, this, i, value );835 map->put(exec, this, i, value, shouldThrow); 834 836 return; 835 837 } … … 1296 1298 // Pushing to an array of length 2^32-1 stores the property, but throws a range error. 1297 1299 if (UNLIKELY(storage->m_length == 0xFFFFFFFFu)) { 1298 methodTable()->putByIndex(this, exec, storage->m_length, value );1300 methodTable()->putByIndex(this, exec, storage->m_length, value, true); 1299 1301 // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d. 1300 throwError(exec, createRangeError(exec, "Invalid array length")); 1302 if (!exec->hadException()) 1303 throwError(exec, createRangeError(exec, "Invalid array length")); 1301 1304 return; 1302 1305 } 1303 1306 1304 1307 // Handled the same as putIndex. 1305 putByIndexBeyondVectorLength(exec, storage->m_length, value );1308 putByIndexBeyondVectorLength(exec, storage->m_length, value, true); 1306 1309 checkConsistency(); 1307 1310 } … … 1328 1331 JSValue p = prototype(); 1329 1332 if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot))) 1330 methodTable()->putByIndex(this, exec, i, slot.getValue(exec, i) );1333 methodTable()->putByIndex(this, exec, i, slot.getValue(exec, i), false); // FIXME https://bugs.webkit.org/show_bug.cgi?id=80335 1331 1334 } 1332 1335 } … … 1373 1376 JSValue p = prototype(); 1374 1377 if ((!p.isNull()) && (asObject(p)->getPropertySlot(exec, i, slot))) 1375 methodTable()->putByIndex(this, exec, i, slot.getValue(exec, i) );1378 methodTable()->putByIndex(this, exec, i, slot.getValue(exec, i), false); // FIXME https://bugs.webkit.org/show_bug.cgi?id=80335 1376 1379 } 1377 1380 } -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r109673 r109866 86 86 87 87 // These methods may mutate the contents of the map 88 void put(ExecState*, JSArray*, unsigned, JSValue );88 void put(ExecState*, JSArray*, unsigned, JSValue, bool shouldThrow); 89 89 bool putDirect(ExecState*, JSArray*, unsigned, JSValue, bool shouldThrow); 90 90 std::pair<iterator, bool> add(JSArray*, unsigned); … … 161 161 JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); 162 162 static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 163 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );163 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 164 164 // This is similar to the JSObject::putDirect* methods: 165 165 // - the prototype chain is not consulted … … 296 296 297 297 bool getOwnPropertySlotSlowCase(ExecState*, unsigned propertyName, PropertySlot&); 298 void putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue );299 bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow);298 void putByIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 299 JS_EXPORT_PRIVATE bool putDirectIndexBeyondVectorLength(ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 300 300 301 301 unsigned getNewVectorLength(unsigned desiredLength); -
trunk/Source/JavaScriptCore/runtime/JSByteArray.cpp
r104324 r109866 103 103 } 104 104 105 void JSByteArray::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value )105 void JSByteArray::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool) 106 106 { 107 107 jsCast<JSByteArray*>(cell)->setIndex(exec, propertyName, value); -
trunk/Source/JavaScriptCore/runtime/JSByteArray.h
r104900 r109866 93 93 JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 94 94 JS_EXPORT_PRIVATE static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); 95 JS_EXPORT_PRIVATE static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue );95 JS_EXPORT_PRIVATE static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow); 96 96 97 97 JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, EnumerationMode); -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r109177 r109866 106 106 } 107 107 108 void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value) 109 { 110 JSObject* thisObject = cell->toObject(exec, exec->lexicalGlobalObject()); 111 thisObject->methodTable()->putByIndex(thisObject, exec, identifier, value); 108 void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value, bool shouldThrow) 109 { 110 if (cell->isString()) { 111 PutPropertySlot slot(shouldThrow); 112 JSValue(cell).putToPrimitive(exec, Identifier::from(exec, identifier), value, slot); 113 return; 114 } 115 JSObject* thisObject = cell->toObject(exec, exec->lexicalGlobalObject()); 116 thisObject->methodTable()->putByIndex(thisObject, exec, identifier, value, shouldThrow); 112 117 } 113 118 -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r108444 r109866 108 108 const MethodTable* methodTable() const; 109 109 static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 110 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );110 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 111 111 112 112 static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.cpp
r103083 r109866 71 71 } 72 72 73 void JSNotAnObject::putByIndex(JSCell*, ExecState* exec, unsigned, JSValue )73 void JSNotAnObject::putByIndex(JSCell*, ExecState* exec, unsigned, JSValue, bool) 74 74 { 75 75 ASSERT_UNUSED(exec, exec->hadException()); -
trunk/Source/JavaScriptCore/runtime/JSNotAnObject.h
r103243 r109866 74 74 75 75 static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 76 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );76 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 77 77 78 78 static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r105698 r109866 705 705 if (filteredValue.isUndefined()) 706 706 array->methodTable()->deletePropertyByIndex(array, m_exec, indexStack.last()); 707 else { 708 if (isJSArray(array) && array->canSetIndex(indexStack.last())) 709 array->setIndex(m_exec->globalData(), indexStack.last(), filteredValue); 710 else 711 array->methodTable()->putByIndex(array, m_exec, indexStack.last(), filteredValue); 712 } 707 else 708 array->putDirectIndex(m_exec, indexStack.last(), filteredValue, false); 713 709 if (m_exec->hadException()) 714 710 return jsNull(); -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r109240 r109866 186 186 } 187 187 188 void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value )189 { 190 PutPropertySlot slot ;188 void JSObject::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow) 189 { 190 PutPropertySlot slot(shouldThrow); 191 191 JSObject* thisObject = jsCast<JSObject*>(cell); 192 192 thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r109824 r109866 110 110 111 111 JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 112 JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );112 JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 113 113 114 114 // putDirect is effectively an unchecked vesion of 'defineOwnProperty': … … 848 848 return; 849 849 } 850 asCell()->methodTable()->putByIndex(asCell(), exec, propertyName, value );850 asCell()->methodTable()->putByIndex(asCell(), exec, propertyName, value, shouldThrow); 851 851 } 852 852 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r105698 r109866 154 154 int start = m_regExpResult.ovector[2 * i]; 155 155 if (start >= 0) 156 JSArray::putByIndex(this, exec, i, jsSubstring(exec, m_regExpResult.input, start, m_regExpResult.ovector[2 * i + 1] - start));156 putDirectIndex(exec, i, jsSubstring(exec, m_regExpResult.input, start, m_regExpResult.ovector[2 * i + 1] - start), false); 157 157 else 158 JSArray::putByIndex(this, exec, i, jsUndefined());158 putDirectIndex(exec, i, jsUndefined(), false); 159 159 } 160 160 -
trunk/Source/JavaScriptCore/runtime/RegExpMatchesArray.h
r106189 r109866 83 83 } 84 84 85 static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v )85 static void putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue v, bool shouldThrow) 86 86 { 87 87 RegExpMatchesArray* thisObject = jsCast<RegExpMatchesArray*>(cell); 88 88 if (!thisObject->m_didFillArrayInstance) 89 89 thisObject->fillArrayInstance(exec); 90 JSArray::putByIndex(thisObject, exec, propertyName, v );90 JSArray::putByIndex(thisObject, exec, propertyName, v, shouldThrow); 91 91 } 92 92 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r106417 r109866 949 949 // a. Call the [[DefineOwnProperty]] internal method of A with arguments "0", 950 950 // Property Descriptor {[[Value]]: S, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 951 result-> methodTable()->putByIndex(result, exec, 0, jsStringWithReuse(exec, thisValue, input));951 result->putDirectIndex(exec, 0, jsStringWithReuse(exec, thisValue, input), false); 952 952 // b. Return A. 953 953 return JSValue::encode(result); … … 962 962 // d. Return A. 963 963 if (reg->match(*globalData, input, 0) < 0) 964 result-> methodTable()->putByIndex(result, exec, 0, jsStringWithReuse(exec, thisValue, input));964 result->putDirectIndex(exec, 0, jsStringWithReuse(exec, thisValue, input), false); 965 965 return JSValue::encode(result); 966 966 } … … 993 993 // 2. Call the [[DefineOwnProperty]] internal method of A with arguments ToString(lengthA), 994 994 // Property Descriptor {[[Value]]: T, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 995 result-> methodTable()->putByIndex(result, exec, resultLength, jsSubstring(exec, input, position, matchPosition - position));995 result->putDirectIndex(exec, resultLength, jsSubstring(exec, input, position, matchPosition - position), false); 996 996 // 3. Increment lengthA by 1. 997 997 // 4. If lengthA == lim, return A. … … 1012 1012 // true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 1013 1013 int sub = ovector[i * 2]; 1014 result-> methodTable()->putByIndex(result, exec, resultLength, sub < 0 ? jsUndefined() : jsSubstring(exec, input, sub, ovector[i * 2 + 1] - sub));1014 result->putDirectIndex(exec, resultLength, sub < 0 ? jsUndefined() : jsSubstring(exec, input, sub, ovector[i * 2 + 1] - sub), false); 1015 1015 // c Increment lengthA by 1. 1016 1016 // d If lengthA == lim, return A. … … 1031 1031 // a. Call the [[DefineOwnProperty]] internal method of A with arguments "0", 1032 1032 // Property Descriptor {[[Value]]: S, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 1033 result-> methodTable()->putByIndex(result, exec, 0, jsStringWithReuse(exec, thisValue, input));1033 result->putDirectIndex(exec, 0, jsStringWithReuse(exec, thisValue, input), false); 1034 1034 // b. Return A. 1035 1035 return JSValue::encode(result); … … 1044 1044 // d. Return A. 1045 1045 if (!separator.isEmpty()) 1046 result-> methodTable()->putByIndex(result, exec, 0, jsStringWithReuse(exec, thisValue, input));1046 result->putDirectIndex(exec, 0, jsStringWithReuse(exec, thisValue, input), false); 1047 1047 return JSValue::encode(result); 1048 1048 } … … 1055 1055 1056 1056 do { 1057 result-> methodTable()->putByIndex(result, exec, position, jsSingleCharacterSubstring(exec, input, position));1057 result->putDirectIndex(exec, position, jsSingleCharacterSubstring(exec, input, position), false); 1058 1058 } while (++position < limit); 1059 1059 … … 1072 1072 // 2. Call the [[DefineOwnProperty]] internal method of A with arguments ToString(lengthA), 1073 1073 // Property Descriptor {[[Value]]: T, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 1074 result-> methodTable()->putByIndex(result, exec, resultLength, jsSubstring(exec, input, position, matchPosition - position));1074 result->putDirectIndex(exec, resultLength, jsSubstring(exec, input, position, matchPosition - position), false); 1075 1075 // 3. Increment lengthA by 1. 1076 1076 // 4. If lengthA == lim, return A. … … 1088 1088 // 15. Call the [[DefineOwnProperty]] internal method of A with arguments ToString(lengthA), Property Descriptor 1089 1089 // {[[Value]]: T, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. 1090 result-> methodTable()->putByIndex(result, exec, resultLength++, jsSubstring(exec, input, position, input.length() - position));1090 result->putDirectIndex(exec, resultLength++, jsSubstring(exec, input, position, input.length() - position), false); 1091 1091 1092 1092 // 16. Return A. -
trunk/Source/WebCore/ChangeLog
r109864 r109866 1 2012-03-05 Gavin Barraclough <barraclough@apple.com> 2 3 putByIndex should throw in strict mode 4 https://bugs.webkit.org/show_bug.cgi?id=80335 5 6 Reviewed by Filip Pizlo. 7 8 Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter. 9 10 * bindings/js/SerializedScriptValue.cpp: 11 (WebCore::CloneDeserializer::putProperty): 12 * bindings/objc/WebScriptObject.mm: 13 (-[WebScriptObject setWebScriptValueAtIndex:value:]): 14 * bindings/scripts/CodeGeneratorJS.pm: 15 (GenerateHeader): 16 (GenerateImplementation): 17 * bridge/NP_jsobject.cpp: 18 (_NPN_SetProperty): 19 * bridge/jni/jni_jsobject.mm: 20 (JavaJSObject::setSlot): 21 * bridge/runtime_array.cpp: 22 (JSC::RuntimeArray::putByIndex): 23 * bridge/runtime_array.h: 24 (RuntimeArray): 25 1 26 2012-03-05 Shinya Kawanaka <shinyak@chromium.org> 2 27 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r109196 r109866 1233 1233 void putProperty(JSArray* array, unsigned index, JSValue value) 1234 1234 { 1235 if (array->canSetIndex(index)) 1236 array->setIndex(m_exec->globalData(), index, value); 1237 else 1238 array->methodTable()->putByIndex(array, m_exec, index, value); 1235 array->putDirectIndex(m_exec, index, value, false); 1239 1236 } 1240 1237 -
trunk/Source/WebCore/bindings/objc/WebScriptObject.mm
r99993 r109866 487 487 488 488 JSLock lock(SilenceAssertionsOnly); 489 [self _imp]->methodTable()->putByIndex([self _imp], exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]) );489 [self _imp]->methodTable()->putByIndex([self _imp], exec, index, convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), false); 490 490 491 491 if (exec->hadException()) { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r109515 r109866 777 777 if ($hasSetter) { 778 778 push(@headerContent, " static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); 779 push(@headerContent, " static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue );\n") if $dataNode->extendedAttributes->{"CustomIndexedSetter"};779 push(@headerContent, " static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow);\n") if $dataNode->extendedAttributes->{"CustomIndexedSetter"}; 780 780 push(@headerContent, " bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&);\n") if $dataNode->extendedAttributes->{"CustomNamedSetter"}; 781 781 } … … 1856 1856 1857 1857 if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { 1858 push(@implContent, "void ${className}::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value )\n");1858 push(@implContent, "void ${className}::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool)\n"); 1859 1859 push(@implContent, "{\n"); 1860 1860 push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp
r109035 r109866 201 201 } 202 202 203 void JSFloat64Array::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value )203 void JSFloat64Array::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value, bool) 204 204 { 205 205 JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.h
r103295 r109866 44 44 static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); 45 45 static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); 46 static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue );46 static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue, bool shouldThrow); 47 47 static const JSC::ClassInfo s_info; 48 48 -
trunk/Source/WebCore/bridge/NP_jsobject.cpp
r99256 r109866 340 340 obj->imp->methodTable()->put(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()), convertNPVariantToValue(exec, variant, rootObject), slot); 341 341 } else 342 obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject) );342 obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject), false); 343 343 exec->clearException(); 344 344 return true; -
trunk/Source/WebCore/bridge/jni/jni_jsobject.mm
r105698 r109866 394 394 ExecState* exec = rootObject->globalObject()->globalExec(); 395 395 JSLock lock(SilenceAssertionsOnly); 396 _imp->methodTable()->putByIndex(_imp, exec, (unsigned)index, convertJObjectToValue(exec, value) );396 _imp->methodTable()->putByIndex(_imp, exec, (unsigned)index, convertJObjectToValue(exec, value), false); 397 397 } 398 398 -
trunk/Source/WebCore/bridge/runtime_array.cpp
r103083 r109866 158 158 } 159 159 160 void RuntimeArray::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value )160 void RuntimeArray::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool) 161 161 { 162 162 RuntimeArray* thisObject = jsCast<RuntimeArray*>(cell); -
trunk/Source/WebCore/bridge/runtime_array.h
r103243 r109866 56 56 static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 57 57 static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); 58 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue );58 static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow); 59 59 60 60 static bool deleteProperty(JSCell*, ExecState*, const Identifier &propertyName); -
trunk/Source/WebKit/mac/ChangeLog
r109860 r109866 1 2012-03-05 Gavin Barraclough <barraclough@apple.com> 2 3 putByIndex should throw in strict mode 4 https://bugs.webkit.org/show_bug.cgi?id=80335 5 6 Reviewed by Filip Pizlo. 7 8 Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter. 9 10 * Plugins/Hosted/NetscapePluginInstanceProxy.mm: 11 (WebKit::NetscapePluginInstanceProxy::setProperty): 12 1 13 2012-03-05 Joseph Pecoraro <pecoraro@apple.com> 2 14 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
r105698 r109866 1086 1086 1087 1087 JSValue value = demarshalValue(exec, valueData, valueLength); 1088 object->methodTable()->putByIndex(object, exec, propertyName, value );1088 object->methodTable()->putByIndex(object, exec, propertyName, value, false); 1089 1089 1090 1090 exec->clearException(); -
trunk/Source/WebKit2/ChangeLog
r109860 r109866 1 2012-03-05 Gavin Barraclough <barraclough@apple.com> 2 3 putByIndex should throw in strict mode 4 https://bugs.webkit.org/show_bug.cgi?id=80335 5 6 Reviewed by Filip Pizlo. 7 8 Make the MethodTable PutByIndex trap take a boolean 'shouldThrow' parameter. 9 10 * WebProcess/Plugins/Netscape/NPJSObject.cpp: 11 (WebKit::NPJSObject::setProperty): 12 1 13 2012-03-05 Joseph Pecoraro <pecoraro@apple.com> 2 14 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
r99256 r109866 191 191 m_jsObject->methodTable()->put(m_jsObject.get(), exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot); 192 192 } else 193 m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue );193 m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue, false); 194 194 exec->clearException(); 195 195
Note: See TracChangeset
for help on using the changeset viewer.