Changeset 207023 in webkit
- Timestamp:
- Oct 10, 2016 2:13:26 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r207017 r207023 1 2016-10-10 Mark Lam <mark.lam@apple.com> 2 3 Rename the StrictModeReadonlyPropertyWriteError string to ReadonlyPropertyWriteError. 4 https://bugs.webkit.org/show_bug.cgi?id=163239 5 6 Reviewed by Filip Pizlo. 7 8 This string is also used for reporting the same error in cases which have nothing 9 to do with strict mode. 10 11 * bytecompiler/BytecodeGenerator.cpp: 12 (JSC::BytecodeGenerator::emitReadOnlyExceptionIfNeeded): 13 * runtime/CommonSlowPaths.cpp: 14 (JSC::SLOW_PATH_DECL): 15 * runtime/GetterSetter.cpp: 16 (JSC::callSetter): 17 * runtime/JSArray.cpp: 18 (JSC::JSArray::setLengthWithArrayStorage): 19 (JSC::JSArray::pop): 20 * runtime/JSCJSValue.cpp: 21 (JSC::JSValue::putToPrimitive): 22 (JSC::JSValue::putToPrimitiveByIndex): 23 * runtime/JSFunction.cpp: 24 (JSC::JSFunction::put): 25 * runtime/JSModuleEnvironment.cpp: 26 (JSC::JSModuleEnvironment::put): 27 * runtime/JSModuleNamespaceObject.cpp: 28 (JSC::JSModuleNamespaceObject::put): 29 (JSC::JSModuleNamespaceObject::putByIndex): 30 * runtime/JSObject.cpp: 31 (JSC::ordinarySetSlow): 32 (JSC::JSObject::putInlineSlow): 33 (JSC::JSObject::setPrototypeWithCycleCheck): 34 (JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage): 35 (JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage): 36 * runtime/JSObject.h: 37 * runtime/JSObjectInlines.h: 38 (JSC::JSObject::putInline): 39 * runtime/JSSymbolTableObject.h: 40 (JSC::symbolTablePut): 41 * runtime/Lookup.h: 42 (JSC::putEntry): 43 * runtime/RegExpObject.h: 44 (JSC::RegExpObject::setLastIndex): 45 * runtime/SparseArrayValueMap.cpp: 46 (JSC::SparseArrayValueMap::putEntry): 47 (JSC::SparseArrayEntry::put): 48 * runtime/StringObject.cpp: 49 (JSC::StringObject::put): 50 (JSC::StringObject::putByIndex): 51 1 52 2016-10-10 Saam Barati <sbarati@apple.com> 2 53 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r206870 r207023 4132 4132 // If we're not in strict mode, we throw for "const" variables but not the function callee. 4133 4133 if (isStrictMode() || variable.isConst()) { 4134 emitThrowTypeError(Identifier::fromString(m_vm, StrictModeReadonlyPropertyWriteError));4134 emitThrowTypeError(Identifier::fromString(m_vm, ReadonlyPropertyWriteError)); 4135 4135 return true; 4136 4136 } -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r206853 r207023 277 277 { 278 278 BEGIN(); 279 THROW(createTypeError(exec, ASCIILiteral( StrictModeReadonlyPropertyWriteError)));279 THROW(createTypeError(exec, ASCIILiteral(ReadonlyPropertyWriteError))); 280 280 } 281 281 -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r206386 r207023 96 96 if (getterSetterObj->isSetterNull()) { 97 97 if (ecmaMode == StrictMode) 98 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);98 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 99 99 return false; 100 100 } -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r206555 r207023 407 407 // Fail if the length is not writable. 408 408 if (map->lengthIsReadOnly()) 409 return reject(exec, throwException, StrictModeReadonlyPropertyWriteError);409 return reject(exec, throwException, ReadonlyPropertyWriteError); 410 410 411 411 if (newLength < length) { … … 626 626 if (!length) { 627 627 if (!isLengthWritable()) 628 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);628 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 629 629 return jsUndefined(); 630 630 } -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r206386 r207023 164 164 if (prototype.isNull()) { 165 165 if (slot.isStrictMode()) 166 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);166 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 167 167 return false; 168 168 } … … 176 176 if (attributes & ReadOnly) { 177 177 if (slot.isStrictMode()) 178 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);178 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 179 179 return false; 180 180 } … … 199 199 200 200 if (slot.isStrictMode()) 201 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);201 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 202 202 return false; 203 203 } … … 223 223 224 224 if (shouldThrow) 225 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);225 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 226 226 return false; 227 227 } -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r206738 r207023 456 456 if (propertyName == vm.propertyNames->arguments || propertyName == vm.propertyNames->caller) { 457 457 if (slot.isStrictMode()) 458 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);458 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 459 459 return false; 460 460 } -
trunk/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp
r205569 r207023 120 120 JSModuleRecord::Resolution resolution = thisObject->moduleRecord()->resolveImport(exec, Identifier::fromUid(exec, propertyName.uid())); 121 121 if (resolution.type == JSModuleRecord::Resolution::Type::Resolved) { 122 throwTypeError(exec, scope, ASCIILiteral( StrictModeReadonlyPropertyWriteError));122 throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError)); 123 123 return false; 124 124 } -
trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
r205569 r207023 168 168 // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-set-p-v-receiver 169 169 if (slot.isStrictMode()) 170 throwTypeError(exec, scope, ASCIILiteral( StrictModeReadonlyPropertyWriteError));170 throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError)); 171 171 return false; 172 172 } … … 178 178 179 179 if (shouldThrow) 180 throwTypeError(exec, scope, ASCIILiteral( StrictModeReadonlyPropertyWriteError));180 throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError)); 181 181 return false; 182 182 } -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r206476 r207023 62 62 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSFinalObject); 63 63 64 const char* StrictModeReadonlyPropertyWriteError = "Attempted to assign to readonly property.";64 const char* ReadonlyPropertyWriteError = "Attempted to assign to readonly property."; 65 65 const char* UnconfigurablePropertyChangeAccessMechanismError = "Attempting to change access mechanism for an unconfigurable property."; 66 66 … … 390 390 // 9.1.9.1-4-a If ownDesc.[[Writable]] is false, return false. 391 391 if (!ownDescriptor.writable()) 392 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);392 return reject(exec, shouldThrow, ReadonlyPropertyWriteError); 393 393 394 394 // 9.1.9.1-4-b If Type(Receiver) is not Object, return false. 395 395 if (!receiver.isObject()) 396 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);396 return reject(exec, shouldThrow, ReadonlyPropertyWriteError); 397 397 398 398 // In OrdinarySet, the receiver may not be the same to the object. … … 409 409 // 9.1.9.1-4-d-i If IsAccessorDescriptor(existingDescriptor) is true, return false. 410 410 if (existingDescriptor.isAccessorDescriptor()) 411 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);411 return reject(exec, shouldThrow, ReadonlyPropertyWriteError); 412 412 413 413 // 9.1.9.1-4-d-ii If existingDescriptor.[[Writable]] is false, return false. 414 414 if (!existingDescriptor.writable()) 415 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);415 return reject(exec, shouldThrow, ReadonlyPropertyWriteError); 416 416 417 417 // 9.1.9.1-4-d-iii Let valueDesc be the PropertyDescriptor{[[Value]]: V}. … … 435 435 JSValue setter = ownDescriptor.setter(); 436 436 if (!setter.isObject()) 437 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);437 return reject(exec, shouldThrow, ReadonlyPropertyWriteError); 438 438 439 439 // 9.1.9.1-8 Perform ? Call(setter, Receiver, << V >>). … … 469 469 if (attributes & ReadOnly) { 470 470 ASSERT(structure(vm)->prototypeChainMayInterceptStoreTo(exec->vm(), propertyName) || obj == this); 471 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);471 return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError); 472 472 } 473 473 … … 514 514 ASSERT(!structure(vm)->prototypeChainMayInterceptStoreTo(exec->vm(), propertyName) || obj == this); 515 515 if (!putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot)) 516 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);516 return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError); 517 517 return true; 518 518 } … … 1298 1298 if (!isExtensible) { 1299 1299 if (shouldThrowIfCantSet) 1300 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);1300 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 1301 1301 return false; 1302 1302 } … … 2265 2265 if (map->lengthIsReadOnly() || !isStructureExtensible()) { 2266 2266 if (shouldThrow) 2267 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);2267 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 2268 2268 return false; 2269 2269 } … … 2403 2403 // Prohibit growing the array if length is not writable. 2404 2404 if (map->lengthIsReadOnly()) 2405 return reject(exec, mode == PutDirectIndexShouldThrow, StrictModeReadonlyPropertyWriteError);2405 return reject(exec, mode == PutDirectIndexShouldThrow, ReadonlyPropertyWriteError); 2406 2406 if (!isStructureExtensible()) 2407 2407 return reject(exec, mode == PutDirectIndexShouldThrow, "Attempting to define property on object that is not extensible."); -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r206779 r207023 69 69 70 70 JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*, ThrowScope&, const String&); 71 extern JS_EXPORTDATA const char* StrictModeReadonlyPropertyWriteError;71 extern JS_EXPORTDATA const char* ReadonlyPropertyWriteError; 72 72 extern JS_EXPORTDATA const char* UnconfigurablePropertyChangeAccessMechanismError; 73 73 -
trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h
r206525 r207023 180 180 if (!thisObject->putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot)) { 181 181 if (slot.isStrictMode()) 182 throwTypeError(exec, scope, ASCIILiteral( StrictModeReadonlyPropertyWriteError));182 throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError)); 183 183 return false; 184 184 } -
trunk/Source/JavaScriptCore/runtime/JSSymbolTableObject.h
r206525 r207023 184 184 if (fastEntry.isReadOnly() && !ignoreReadOnlyErrors) { 185 185 if (shouldThrowReadOnlyError) 186 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);186 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 187 187 putResult = false; 188 188 return true; -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r206779 r207023 263 263 return true; 264 264 } 265 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);265 return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError); 266 266 } 267 267 268 268 if (entry->attributes() & Accessor) 269 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);269 return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError); 270 270 271 271 if (!(entry->attributes() & ReadOnly)) { … … 281 281 } 282 282 283 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);283 return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError); 284 284 } 285 285 -
trunk/Source/JavaScriptCore/runtime/RegExpObject.h
r206525 r207023 51 51 return true; 52 52 } 53 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);53 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 54 54 return false; 55 55 } … … 65 65 66 66 if (shouldThrow) 67 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);67 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 68 68 return false; 69 69 } -
trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
r205198 r207023 104 104 remove(result.iterator); 105 105 if (shouldThrow) 106 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);106 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 107 107 return false; 108 108 } … … 157 157 if (attributes & ReadOnly) { 158 158 if (shouldThrow) 159 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);159 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 160 160 return false; 161 161 } -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r206386 r207023 73 73 if (propertyName == exec->propertyNames().length) { 74 74 if (slot.isStrictMode()) 75 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);75 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 76 76 return false; 77 77 } … … 89 89 if (thisObject->internalValue()->canGetIndex(propertyName)) { 90 90 if (shouldThrow) 91 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);91 throwTypeError(exec, scope, ReadonlyPropertyWriteError); 92 92 return false; 93 93 }
Note: See TracChangeset
for help on using the changeset viewer.