| Differences between
and this patch
- a/Source/JavaScriptCore/ChangeLog +25 lines
Lines 1-3 a/Source/JavaScriptCore/ChangeLog_sec1
1
2020-10-20  Ross Kirsling  <ross.kirsling@sony.com>
2
3
        [JSC] Rename item() to at() and move it behind a flag
4
        https://bugs.webkit.org/show_bug.cgi?id=217942
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        {Array, %TypedArray%}.prototype.item is official web-incompatible,
9
        but it is expected to be renamed to `at` instead of being scrapped entirely:
10
        https://github.com/tc39/proposal-item-method/issues/34
11
12
        This patch performs the renaming, but does so behind a runtime flag since this has yet to achieve consensus.
13
14
        * builtins/ArrayPrototype.js:
15
        (at):
16
        (item): Deleted.
17
        * builtins/TypedArrayPrototype.js:
18
        (at):
19
        (item): Deleted.
20
        * runtime/ArrayPrototype.cpp:
21
        (JSC::ArrayPrototype::finishCreation):
22
        * runtime/JSTypedArrayViewPrototype.cpp:
23
        (JSC::JSTypedArrayViewPrototype::finishCreation):
24
        * runtime/OptionsList.h:
25
1
2020-10-19  Mark Cohen  <m@mpc.sh>
26
2020-10-19  Mark Cohen  <m@mpc.sh>
2
27
3
        test262: test/language/expressions/conditional/in-branch-1.js
28
        test262: test/language/expressions/conditional/in-branch-1.js
- a/Source/JavaScriptCore/builtins/ArrayPrototype.js -2 / +2 lines
Lines 696-706 function flatMap(callback) a/Source/JavaScriptCore/builtins/ArrayPrototype.js_sec1
696
    return @flatIntoArrayWithCallback(result, array, length, 0, callback, thisArg);
696
    return @flatIntoArrayWithCallback(result, array, length, 0, callback, thisArg);
697
}
697
}
698
698
699
function item(index)
699
function at(index)
700
{
700
{
701
    "use strict";
701
    "use strict";
702
702
703
    var array = @toObject(this, "Array.prototype.item requires that |this| not be null or undefined");
703
    var array = @toObject(this, "Array.prototype.at requires that |this| not be null or undefined");
704
    var length = @toLength(array.length);
704
    var length = @toLength(array.length);
705
705
706
    var k = @toInteger(index);
706
    var k = @toInteger(index);
- a/Source/JavaScriptCore/builtins/TypedArrayPrototype.js -1 / +1 lines
Lines 383-389 function toLocaleString(/* locale, options */) a/Source/JavaScriptCore/builtins/TypedArrayPrototype.js_sec1
383
    return string;
383
    return string;
384
}
384
}
385
385
386
function item(index)
386
function at(index)
387
{
387
{
388
    "use strict";
388
    "use strict";
389
389
- a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp -2 / +5 lines
Lines 110-116 void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec1
110
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
110
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().findIndexPublicName(), arrayPrototypeFindIndexCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
111
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
111
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().includesPublicName(), arrayPrototypeIncludesCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
112
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
112
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().copyWithinPublicName(), arrayPrototypeCopyWithinCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
113
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().itemPublicName(), arrayPrototypeItemCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
113
114
    if (Options::useAtMethod())
115
        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().atPublicName(), arrayPrototypeAtCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
114
116
115
    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
117
    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().entriesPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
116
    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().forEachPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().forEachPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
118
    putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().forEachPrivateName(), getDirect(vm, vm.propertyNames->builtinNames().forEachPublicName()), static_cast<unsigned>(PropertyAttribute::ReadOnly));
Lines 128-137 void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) a/Source/JavaScriptCore/runtime/ArrayPrototype.cpp_sec2
128
        &vm.propertyNames->builtinNames().flatPublicName(),
130
        &vm.propertyNames->builtinNames().flatPublicName(),
129
        &vm.propertyNames->builtinNames().flatMapPublicName(),
131
        &vm.propertyNames->builtinNames().flatMapPublicName(),
130
        &vm.propertyNames->builtinNames().includesPublicName(),
132
        &vm.propertyNames->builtinNames().includesPublicName(),
131
        &vm.propertyNames->builtinNames().itemPublicName(),
132
        &vm.propertyNames->builtinNames().keysPublicName(),
133
        &vm.propertyNames->builtinNames().keysPublicName(),
133
        &vm.propertyNames->builtinNames().valuesPublicName()
134
        &vm.propertyNames->builtinNames().valuesPublicName()
134
    };
135
    };
136
    if (Options::useAtMethod())
137
        unscopables->putDirect(vm, vm.propertyNames->builtinNames().atPublicName(), jsBoolean(true));
135
    for (const auto* unscopableName : unscopableNames)
138
    for (const auto* unscopableName : unscopableNames)
136
        unscopables->putDirect(vm, *unscopableName, jsBoolean(true));
139
        unscopables->putDirect(vm, *unscopableName, jsBoolean(true));
137
    putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, unscopables, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
140
    putDirectWithoutTransition(vm, vm.propertyNames->unscopablesSymbol, unscopables, PropertyAttribute::DontEnum | PropertyAttribute::ReadOnly);
- a/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp -1 / +3 lines
Lines 375-381 void JSTypedArrayViewPrototype::finishCreation(VM& vm, JSGlobalObject* globalObj a/Source/JavaScriptCore/runtime/JSTypedArrayViewPrototype.cpp_sec1
375
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("some", typedArrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
375
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION("some", typedArrayPrototypeSomeCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
376
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->subarray, typedArrayPrototypeSubarrayCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
376
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->subarray, typedArrayPrototypeSubarrayCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
377
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toLocaleString, typedArrayPrototypeToLocaleStringCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
377
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->toLocaleString, typedArrayPrototypeToLocaleStringCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
378
    JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().itemPublicName(), typedArrayPrototypeItemCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
378
379
    if (Options::useAtMethod())
380
        JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->builtinNames().atPublicName(), typedArrayPrototypeAtCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum));
379
381
380
    JSFunction* toStringTagFunction = JSFunction::create(vm, globalObject, 0, "get [Symbol.toStringTag]"_s, typedArrayViewProtoGetterFuncToStringTag, NoIntrinsic);
382
    JSFunction* toStringTagFunction = JSFunction::create(vm, globalObject, 0, "get [Symbol.toStringTag]"_s, typedArrayViewProtoGetterFuncToStringTag, NoIntrinsic);
381
    GetterSetter* toStringTagAccessor = GetterSetter::create(vm, globalObject, toStringTagFunction, nullptr);
383
    GetterSetter* toStringTagAccessor = GetterSetter::create(vm, globalObject, toStringTagFunction, nullptr);
- a/Source/JavaScriptCore/runtime/OptionsList.h +1 lines
Lines 491-496 constexpr bool enableWebAssemblyStreamingApi = false; a/Source/JavaScriptCore/runtime/OptionsList.h_sec1
491
    v(Bool, useWebAssemblyMultiValues, true, Normal, "Allow types from the wasm mulit-values spec.") \
491
    v(Bool, useWebAssemblyMultiValues, true, Normal, "Allow types from the wasm mulit-values spec.") \
492
    v(Bool, useWeakRefs, true, Normal, "Expose the WeakRef constructor.") \
492
    v(Bool, useWeakRefs, true, Normal, "Expose the WeakRef constructor.") \
493
    v(Bool, useIntlDateTimeFormatDayPeriod, true, Normal, "Expose the Intl.DateTimeFormat dayPeriod feature.") \
493
    v(Bool, useIntlDateTimeFormatDayPeriod, true, Normal, "Expose the Intl.DateTimeFormat dayPeriod feature.") \
494
    v(Bool, useAtMethod, false, Normal, "Expose the at() method on Array and %TypedArray%.") \
494
    v(Bool, useArrayAllocationProfiling, true, Normal, "If true, we will use our normal array allocation profiling. If false, the allocation profile will always claim to be undecided.") \
495
    v(Bool, useArrayAllocationProfiling, true, Normal, "If true, we will use our normal array allocation profiling. If false, the allocation profile will always claim to be undecided.") \
495
    v(Bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \
496
    v(Bool, forcePolyProto, false, Normal, "If true, create_this will always create an object with a poly proto structure.") \
496
    v(Bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \
497
    v(Bool, forceMiniVMMode, false, Normal, "If true, it will force mini VM mode on.") \
- a/LayoutTests/ChangeLog +13 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2020-10-20  Ross Kirsling  <ross.kirsling@sony.com>
2
3
        [JSC] Rename item() to at() and move it behind a flag
4
        https://bugs.webkit.org/show_bug.cgi?id=217942
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * inspector/model/remote-object-get-properties-expected.txt:
9
        * js/array-unscopables-properties-expected.txt:
10
        * js/Object-getOwnPropertyNames-expected.txt:
11
        * js/script-tests/Object-getOwnPropertyNames.js:
12
        * js/script-tests/array-unscopables-properties.js:
13
1
2020-10-19  Antti Koivisto  <antti@apple.com>
14
2020-10-19  Antti Koivisto  <antti@apple.com>
2
15
3
        Update imported/w3c/web-platform-tests/css/selectors/
16
        Update imported/w3c/web-platform-tests/css/selectors/
- a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt -4 lines
Lines 85-91 ALL PROPERTIES: a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt_sec1
85
    findIndex
85
    findIndex
86
    includes
86
    includes
87
    copyWithin
87
    copyWithin
88
    item
89
    constructor
88
    constructor
90
    Symbol(Symbol.iterator)
89
    Symbol(Symbol.iterator)
91
    Symbol(Symbol.unscopables)
90
    Symbol(Symbol.unscopables)
Lines 139-145 OWN PROPERTIES: a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt_sec2
139
    findIndex
138
    findIndex
140
    includes
139
    includes
141
    copyWithin
140
    copyWithin
142
    item
143
    constructor
141
    constructor
144
    Symbol(Symbol.iterator)
142
    Symbol(Symbol.iterator)
145
    Symbol(Symbol.unscopables)
143
    Symbol(Symbol.unscopables)
Lines 178-184 DISPLAYABLE PROPERTIES: a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt_sec3
178
    findIndex
176
    findIndex
179
    includes
177
    includes
180
    copyWithin
178
    copyWithin
181
    item
182
    constructor
179
    constructor
183
    Symbol(Symbol.iterator)
180
    Symbol(Symbol.iterator)
184
    Symbol(Symbol.unscopables)
181
    Symbol(Symbol.unscopables)
Lines 217-223 ALL PROPERTIES: a/LayoutTests/inspector/model/remote-object-get-properties-expected.txt_sec4
217
    findIndex
214
    findIndex
218
    includes
215
    includes
219
    copyWithin
216
    copyWithin
220
    item
221
    constructor
217
    constructor
222
    Symbol(Symbol.iterator)
218
    Symbol(Symbol.iterator)
223
    Symbol(Symbol.unscopables)
219
    Symbol(Symbol.unscopables)
- a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt -1 / +1 lines
Lines 47-53 PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defi a/LayoutTests/js/Object-getOwnPropertyNames-expected.txt_sec1
47
PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
47
PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype']
48
PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']
48
PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']
49
PASS getSortedOwnPropertyNames(Array) is ['from', 'isArray', 'length', 'name', 'of', 'prototype']
49
PASS getSortedOwnPropertyNames(Array) is ['from', 'isArray', 'length', 'name', 'of', 'prototype']
50
PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'item', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
50
PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
51
PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']
51
PASS getSortedOwnPropertyNames(String) is ['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']
52
PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']
52
PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']
53
PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']
53
PASS getSortedOwnPropertyNames(Boolean) is ['length', 'name', 'prototype']
- a/LayoutTests/js/array-unscopables-properties-expected.txt -4 lines
Lines 42-51 PASS Array.prototype[Symbol.unscopables]["includes"] is true a/LayoutTests/js/array-unscopables-properties-expected.txt_sec1
42
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true
42
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").writable is true
43
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true
43
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").enumerable is true
44
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").configurable is true
44
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "includes").configurable is true
45
PASS Array.prototype[Symbol.unscopables]["item"] is true
46
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").writable is true
47
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").enumerable is true
48
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "item").configurable is true
49
PASS Array.prototype[Symbol.unscopables]["keys"] is true
45
PASS Array.prototype[Symbol.unscopables]["keys"] is true
50
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").writable is true
46
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").writable is true
51
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").enumerable is true
47
PASS Object.getOwnPropertyDescriptor(Array.prototype[Symbol.unscopables], "keys").enumerable is true
- a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js -1 / +1 lines
Lines 56-62 var expectedPropertyNamesSet = { a/LayoutTests/js/script-tests/Object-getOwnPropertyNames.js_sec1
56
    "Function": "['length', 'name', 'prototype']",
56
    "Function": "['length', 'name', 'prototype']",
57
    "Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']",
57
    "Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']",
58
    "Array": "['from', 'isArray', 'length', 'name', 'of', 'prototype']",
58
    "Array": "['from', 'isArray', 'length', 'name', 'of', 'prototype']",
59
    "Array.prototype": "['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'item', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
59
    "Array.prototype": "['concat', 'constructor', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
60
    "String": "['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']",
60
    "String": "['fromCharCode', 'fromCodePoint', 'length', 'name', 'prototype', 'raw']",
61
    "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']",
61
    "String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'codePointAt', 'concat', 'constructor', 'endsWith', 'fixed', 'fontcolor', 'fontsize', 'includes', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'matchAll', 'normalize', 'padEnd', 'padStart', 'repeat', 'replace', 'replaceAll', 'search', 'slice', 'small', 'split', 'startsWith', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimEnd', 'trimLeft', 'trimRight', 'trimStart', 'valueOf']",
62
    "Boolean": "['length', 'name', 'prototype']",
62
    "Boolean": "['length', 'name', 'prototype']",
- a/LayoutTests/js/script-tests/array-unscopables-properties.js -1 lines
Lines 15-21 let expectedEntries = [ a/LayoutTests/js/script-tests/array-unscopables-properties.js_sec1
15
    "flat",
15
    "flat",
16
    "flatMap",
16
    "flatMap",
17
    "includes",
17
    "includes",
18
    "item",
19
    "keys",
18
    "keys",
20
    "values"
19
    "values"
21
];
20
];
- a/JSTests/ChangeLog +10 lines
Lines 1-3 a/JSTests/ChangeLog_sec1
1
2020-10-20  Ross Kirsling  <ross.kirsling@sony.com>
2
3
        [JSC] Rename item() to at() and move it behind a flag
4
        https://bugs.webkit.org/show_bug.cgi?id=217942
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * stress/at-method.js: Renamed from JSTests/stress/item-method.js.
9
        * test262/config.yaml: Add skips until the feature is renamed.
10
1
2020-10-19  Mark Cohen  <m@mpc.sh>
11
2020-10-19  Mark Cohen  <m@mpc.sh>
2
12
3
        test262: test/language/expressions/conditional/in-branch-1.js
13
        test262: test/language/expressions/conditional/in-branch-1.js
- a/JSTests/stress/at-method.js +51 lines
Line 0 a/JSTests/stress/at-method.js_sec1
1
//@ requireOptions("--useAtMethod=1")
2
3
function shouldBe(actual, expected) {
4
    if (actual !== expected)
5
        throw new Error(`expected ${expected} but got ${actual}`);
6
}
7
8
function shouldThrowTypeError(func) {
9
    let error;
10
    try {
11
        func();
12
    } catch (e) {
13
        error = e;
14
    }
15
16
    if (!(error instanceof TypeError))
17
        throw new Error('Expected TypeError!');
18
}
19
20
shouldBe(Array.prototype.at.length, 1);
21
shouldThrowTypeError(() => Array.prototype.at.call(undefined));
22
shouldThrowTypeError(() => Array.prototype.at.call(null));
23
24
const array = [42, 'b', true];
25
// intentionally go one too far to ensure that we get undefined instead of wrapping
26
for (let i = 0; i <= array.length; i++) {
27
  shouldBe(array.at(i), array[i]);
28
  shouldBe(array.at(-i - 1), array[array.length - i - 1]);
29
}
30
shouldBe(array.at(), array[0]);
31
shouldBe(array.at(null), array[0]);
32
shouldBe(array.at({ valueOf: () => -1 }), array[array.length - 1]);
33
34
const weirdArrayLike = { length: 1, get '0'() { return 3; }, get '1'() { throw 'oops'; } };
35
shouldBe(Array.prototype.at.call(weirdArrayLike, 0), 3);
36
shouldBe(Array.prototype.at.call(weirdArrayLike, 1), undefined);
37
38
for (const TA of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) {
39
  shouldBe(TA.prototype.at.length, 1);
40
  shouldThrowTypeError(() => TA.prototype.at.call([]));
41
42
  const ta = [1, 2, 3];
43
  // intentionally go one too far to ensure that we get undefined instead of wrapping
44
  for (let i = 0; i <= ta.length; i++) {
45
    shouldBe(ta.at(i), ta[i]);
46
    shouldBe(ta.at(-i - 1), ta[ta.length - i - 1]);
47
  }
48
  shouldBe(ta.at(), ta[0]);
49
  shouldBe(ta.at(null), ta[0]);
50
  shouldBe(ta.at({ valueOf: () => -1 }), ta[ta.length - 1]);
51
}
- a/JSTests/stress/item-method.js -49 lines
Lines 1-49 a/JSTests/stress/item-method.js_sec1
1
function shouldBe(actual, expected) {
2
    if (actual !== expected)
3
        throw new Error(`expected ${expected} but got ${actual}`);
4
}
5
6
function shouldThrowTypeError(func) {
7
    let error;
8
    try {
9
        func();
10
    } catch (e) {
11
        error = e;
12
    }
13
14
    if (!(error instanceof TypeError))
15
        throw new Error('Expected TypeError!');
16
}
17
18
shouldBe(Array.prototype.item.length, 1);
19
shouldThrowTypeError(() => Array.prototype.item.call(undefined));
20
shouldThrowTypeError(() => Array.prototype.item.call(null));
21
22
const array = [42, 'b', true];
23
// intentionally go one too far to ensure that we get undefined instead of wrapping
24
for (let i = 0; i <= array.length; i++) {
25
  shouldBe(array.item(i), array[i]);
26
  shouldBe(array.item(-i - 1), array[array.length - i - 1]);
27
}
28
shouldBe(array.item(), array[0]);
29
shouldBe(array.item(null), array[0]);
30
shouldBe(array.item({ valueOf: () => -1 }), array[array.length - 1]);
31
32
const weirdArrayLike = { length: 1, get '0'() { return 3; }, get '1'() { throw 'oops'; } };
33
shouldBe(Array.prototype.item.call(weirdArrayLike, 0), 3);
34
shouldBe(Array.prototype.item.call(weirdArrayLike, 1), undefined);
35
36
for (const TA of [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]) {
37
  shouldBe(TA.prototype.item.length, 1);
38
  shouldThrowTypeError(() => TA.prototype.item.call([]));
39
40
  const ta = [1, 2, 3];
41
  // intentionally go one too far to ensure that we get undefined instead of wrapping
42
  for (let i = 0; i <= ta.length; i++) {
43
    shouldBe(ta.item(i), ta[i]);
44
    shouldBe(ta.item(-i - 1), ta[ta.length - i - 1]);
45
  }
46
  shouldBe(ta.item(), ta[0]);
47
  shouldBe(ta.item(null), ta[0]);
48
  shouldBe(ta.item({ valueOf: () => -1 }), ta[ta.length - 1]);
49
}
- a/JSTests/stress/unscopables.js -1 / +3 lines
Lines 1-3 a/JSTests/stress/unscopables.js_sec1
1
//@ requireOptions("--useAtMethod=1")
2
1
function test(actual, expected) {
3
function test(actual, expected) {
2
    if (actual !== expected)
4
    if (actual !== expected)
3
        throw new Error('bad value: ' + actual);
5
        throw new Error('bad value: ' + actual);
Lines 9-15 function test(actual, expected) { a/JSTests/stress/unscopables.js_sec2
9
11
10
    test(typeof unscopables, "object");
12
    test(typeof unscopables, "object");
11
    test(unscopables.__proto__, undefined);
13
    test(unscopables.__proto__, undefined);
12
    test(String(Object.keys(unscopables).sort()), "copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,item,keys,values");
14
    test(String(Object.keys(unscopables).sort()), "at,copyWithin,entries,fill,find,findIndex,flat,flatMap,includes,keys,values");
13
}());
15
}());
14
16
15
(function () {
17
(function () {
- a/JSTests/test262/config.yaml +4 lines
Lines 27-32 skip: a/JSTests/test262/config.yaml_sec1
27
    - top-level-await
27
    - top-level-await
28
    - Intl.ListFormat
28
    - Intl.ListFormat
29
29
30
    # remove once it's been renamed in test262
31
    - Array.prototype.item
32
    - TypedArray.prototype.item
33
30
    # remove once it's no longer in test262
34
    # remove once it's no longer in test262
31
    - String.prototype.item
35
    - String.prototype.item
32
  paths:
36
  paths:

Return to Bug 217942