Changeset 207023 in webkit


Ignore:
Timestamp:
Oct 10, 2016 2:13:26 PM (8 years ago)
Author:
mark.lam@apple.com
Message:

Rename the StrictModeReadonlyPropertyWriteError string to ReadonlyPropertyWriteError.
https://bugs.webkit.org/show_bug.cgi?id=163239

Reviewed by Filip Pizlo.

This string is also used for reporting the same error in cases which have nothing
to do with strict mode.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitReadOnlyExceptionIfNeeded):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/GetterSetter.cpp:

(JSC::callSetter):

  • runtime/JSArray.cpp:

(JSC::JSArray::setLengthWithArrayStorage):
(JSC::JSArray::pop):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::putToPrimitive):
(JSC::JSValue::putToPrimitiveByIndex):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::put):

  • runtime/JSModuleEnvironment.cpp:

(JSC::JSModuleEnvironment::put):

  • runtime/JSModuleNamespaceObject.cpp:

(JSC::JSModuleNamespaceObject::put):
(JSC::JSModuleNamespaceObject::putByIndex):

  • runtime/JSObject.cpp:

(JSC::ordinarySetSlow):
(JSC::JSObject::putInlineSlow):
(JSC::JSObject::setPrototypeWithCycleCheck):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putDirectIndexBeyondVectorLengthWithArrayStorage):

  • runtime/JSObject.h:
  • runtime/JSObjectInlines.h:

(JSC::JSObject::putInline):

  • runtime/JSSymbolTableObject.h:

(JSC::symbolTablePut):

  • runtime/Lookup.h:

(JSC::putEntry):

  • runtime/RegExpObject.h:

(JSC::RegExpObject::setLastIndex):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayEntry::put):

  • runtime/StringObject.cpp:

(JSC::StringObject::put):
(JSC::StringObject::putByIndex):

Location:
trunk/Source/JavaScriptCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r207017 r207023  
     12016-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
    1522016-10-10  Saam Barati  <sbarati@apple.com>
    253
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r206870 r207023  
    41324132    // If we're not in strict mode, we throw for "const" variables but not the function callee.
    41334133    if (isStrictMode() || variable.isConst()) {
    4134         emitThrowTypeError(Identifier::fromString(m_vm, StrictModeReadonlyPropertyWriteError));
     4134        emitThrowTypeError(Identifier::fromString(m_vm, ReadonlyPropertyWriteError));
    41354135        return true;
    41364136    }
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

    r206853 r207023  
    277277{
    278278    BEGIN();
    279     THROW(createTypeError(exec, ASCIILiteral(StrictModeReadonlyPropertyWriteError)));
     279    THROW(createTypeError(exec, ASCIILiteral(ReadonlyPropertyWriteError)));
    280280}
    281281
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp

    r206386 r207023  
    9696    if (getterSetterObj->isSetterNull()) {
    9797        if (ecmaMode == StrictMode)
    98             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     98            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    9999        return false;
    100100    }
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r206555 r207023  
    407407        // Fail if the length is not writable.
    408408        if (map->lengthIsReadOnly())
    409             return reject(exec, throwException, StrictModeReadonlyPropertyWriteError);
     409            return reject(exec, throwException, ReadonlyPropertyWriteError);
    410410
    411411        if (newLength < length) {
     
    626626        if (!length) {
    627627            if (!isLengthWritable())
    628                 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     628                throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    629629            return jsUndefined();
    630630        }
  • trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp

    r206386 r207023  
    164164            if (prototype.isNull()) {
    165165                if (slot.isStrictMode())
    166                     throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     166                    throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    167167                return false;
    168168            }
     
    176176            if (attributes & ReadOnly) {
    177177                if (slot.isStrictMode())
    178                     throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     178                    throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    179179                return false;
    180180            }
     
    199199   
    200200    if (slot.isStrictMode())
    201         throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     201        throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    202202    return false;
    203203}
     
    223223   
    224224    if (shouldThrow)
    225         throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     225        throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    226226    return false;
    227227}
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r206738 r207023  
    456456    if (propertyName == vm.propertyNames->arguments || propertyName == vm.propertyNames->caller) {
    457457        if (slot.isStrictMode())
    458             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     458            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    459459        return false;
    460460    }
  • trunk/Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp

    r205569 r207023  
    120120    JSModuleRecord::Resolution resolution = thisObject->moduleRecord()->resolveImport(exec, Identifier::fromUid(exec, propertyName.uid()));
    121121    if (resolution.type == JSModuleRecord::Resolution::Type::Resolved) {
    122         throwTypeError(exec, scope, ASCIILiteral(StrictModeReadonlyPropertyWriteError));
     122        throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError));
    123123        return false;
    124124    }
  • trunk/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp

    r205569 r207023  
    168168    // http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-set-p-v-receiver
    169169    if (slot.isStrictMode())
    170         throwTypeError(exec, scope, ASCIILiteral(StrictModeReadonlyPropertyWriteError));
     170        throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError));
    171171    return false;
    172172}
     
    178178
    179179    if (shouldThrow)
    180         throwTypeError(exec, scope, ASCIILiteral(StrictModeReadonlyPropertyWriteError));
     180        throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError));
    181181    return false;
    182182}
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r206476 r207023  
    6262STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSFinalObject);
    6363
    64 const char* StrictModeReadonlyPropertyWriteError = "Attempted to assign to readonly property.";
     64const char* ReadonlyPropertyWriteError = "Attempted to assign to readonly property.";
    6565const char* UnconfigurablePropertyChangeAccessMechanismError = "Attempting to change access mechanism for an unconfigurable property.";
    6666
     
    390390        // 9.1.9.1-4-a If ownDesc.[[Writable]] is false, return false.
    391391        if (!ownDescriptor.writable())
    392             return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);
     392            return reject(exec, shouldThrow, ReadonlyPropertyWriteError);
    393393
    394394        // 9.1.9.1-4-b If Type(Receiver) is not Object, return false.
    395395        if (!receiver.isObject())
    396             return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);
     396            return reject(exec, shouldThrow, ReadonlyPropertyWriteError);
    397397
    398398        // In OrdinarySet, the receiver may not be the same to the object.
     
    409409            // 9.1.9.1-4-d-i If IsAccessorDescriptor(existingDescriptor) is true, return false.
    410410            if (existingDescriptor.isAccessorDescriptor())
    411                 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);
     411                return reject(exec, shouldThrow, ReadonlyPropertyWriteError);
    412412
    413413            // 9.1.9.1-4-d-ii If existingDescriptor.[[Writable]] is false, return false.
    414414            if (!existingDescriptor.writable())
    415                 return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);
     415                return reject(exec, shouldThrow, ReadonlyPropertyWriteError);
    416416
    417417            // 9.1.9.1-4-d-iii Let valueDesc be the PropertyDescriptor{[[Value]]: V}.
     
    435435    JSValue setter = ownDescriptor.setter();
    436436    if (!setter.isObject())
    437         return reject(exec, shouldThrow, StrictModeReadonlyPropertyWriteError);
     437        return reject(exec, shouldThrow, ReadonlyPropertyWriteError);
    438438
    439439    // 9.1.9.1-8 Perform ? Call(setter, Receiver, << V >>).
     
    469469            if (attributes & ReadOnly) {
    470470                ASSERT(structure(vm)->prototypeChainMayInterceptStoreTo(exec->vm(), propertyName) || obj == this);
    471                 return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);
     471                return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError);
    472472            }
    473473
     
    514514    ASSERT(!structure(vm)->prototypeChainMayInterceptStoreTo(exec->vm(), propertyName) || obj == this);
    515515    if (!putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot))
    516         return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);
     516        return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError);
    517517    return true;
    518518}
     
    12981298    if (!isExtensible) {
    12991299        if (shouldThrowIfCantSet)
    1300             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     1300            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    13011301        return false;
    13021302    }
     
    22652265        if (map->lengthIsReadOnly() || !isStructureExtensible()) {
    22662266            if (shouldThrow)
    2267                 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     2267                throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    22682268            return false;
    22692269        }
     
    24032403            // Prohibit growing the array if length is not writable.
    24042404            if (map->lengthIsReadOnly())
    2405                 return reject(exec, mode == PutDirectIndexShouldThrow, StrictModeReadonlyPropertyWriteError);
     2405                return reject(exec, mode == PutDirectIndexShouldThrow, ReadonlyPropertyWriteError);
    24062406            if (!isStructureExtensible())
    24072407                return reject(exec, mode == PutDirectIndexShouldThrow, "Attempting to define property on object that is not extensible.");
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r206779 r207023  
    6969
    7070JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*, ThrowScope&, const String&);
    71 extern JS_EXPORTDATA const char* StrictModeReadonlyPropertyWriteError;
     71extern JS_EXPORTDATA const char* ReadonlyPropertyWriteError;
    7272extern JS_EXPORTDATA const char* UnconfigurablePropertyChangeAccessMechanismError;
    7373
  • trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r206525 r207023  
    180180        if (!thisObject->putDirectInternal<PutModePut>(vm, propertyName, value, 0, slot)) {
    181181            if (slot.isStrictMode())
    182                 throwTypeError(exec, scope, ASCIILiteral(StrictModeReadonlyPropertyWriteError));
     182                throwTypeError(exec, scope, ASCIILiteral(ReadonlyPropertyWriteError));
    183183            return false;
    184184        }
  • trunk/Source/JavaScriptCore/runtime/JSSymbolTableObject.h

    r206525 r207023  
    184184        if (fastEntry.isReadOnly() && !ignoreReadOnlyErrors) {
    185185            if (shouldThrowReadOnlyError)
    186                 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     186                throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    187187            putResult = false;
    188188            return true;
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r206779 r207023  
    263263            return true;
    264264        }
    265         return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);
     265        return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError);
    266266    }
    267267
    268268    if (entry->attributes() & Accessor)
    269         return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);
     269        return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError);
    270270
    271271    if (!(entry->attributes() & ReadOnly)) {
     
    281281    }
    282282
    283     return reject(exec, slot.isStrictMode(), StrictModeReadonlyPropertyWriteError);
     283    return reject(exec, slot.isStrictMode(), ReadonlyPropertyWriteError);
    284284}
    285285
  • trunk/Source/JavaScriptCore/runtime/RegExpObject.h

    r206525 r207023  
    5151            return true;
    5252        }
    53         throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     53        throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    5454        return false;
    5555    }
     
    6565
    6666        if (shouldThrow)
    67             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     67            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    6868        return false;
    6969    }
  • trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp

    r205198 r207023  
    104104        remove(result.iterator);
    105105        if (shouldThrow)
    106             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     106            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    107107        return false;
    108108    }
     
    157157        if (attributes & ReadOnly) {
    158158            if (shouldThrow)
    159                 throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     159                throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    160160            return false;
    161161        }
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r206386 r207023  
    7373    if (propertyName == exec->propertyNames().length) {
    7474        if (slot.isStrictMode())
    75             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     75            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    7676        return false;
    7777    }
     
    8989    if (thisObject->internalValue()->canGetIndex(propertyName)) {
    9090        if (shouldThrow)
    91             throwTypeError(exec, scope, StrictModeReadonlyPropertyWriteError);
     91            throwTypeError(exec, scope, ReadonlyPropertyWriteError);
    9292        return false;
    9393    }
Note: See TracChangeset for help on using the changeset viewer.