ladybird/Userland/Libraries/LibJS/Tests/builtins/Array
Linus Groh 00b8ce4a6d LibJS: Pass this value to fallback func in Array.prototype.toString()
The existing code looks innocently correct, implementing the following
step:

    3. If IsCallable(func) is false, set func to the intrinsic function
       %Object.prototype.toString%.

as

    return ObjectPrototype::to_string(vm, global_object);

However, this misses the fact that the next step calls the function with
the previously ToObject()'d this value (`array`):

    4. Return ? Call(func, array).

This doesn't happen in the current implementation, which will use the
unaltered this value from the Array.prototype.toString() call, and make
another, unequal object in %Object.prototype.toString%. Since both that
and Array.prototype.toString() do a Get() call on said object, this
behavior is observable (see newly added test).

Fix this by actually doing what the spec says and calling the fallback
function the regular way.
2022-04-12 00:23:27 +01:00
..
array-basic.js
array-index-from-string.js
array-length-setter.js
array-shrink-during-find-crash.js
array-simple-and-generic-storage-initialization.js
array-spread.js
Array.from.js
Array.isArray.js
Array.js
Array.of.js
Array.prototype-generic-functions.js
Array.prototype.at.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.concat.js
Array.prototype.copyWithin.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.entries.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.every.js
Array.prototype.fill.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.filter.js
Array.prototype.find.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.findIndex.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.findLast.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.findLastIndex.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.flat.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.flatMap.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.forEach.js
Array.prototype.groupBy.js
Array.prototype.groupByToMap.js
Array.prototype.includes.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.indexOf.js
Array.prototype.join.js
Array.prototype.keys.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00
Array.prototype.lastIndexOf.js
Array.prototype.map.js
Array.prototype.pop.js
Array.prototype.push.js
Array.prototype.reduce.js
Array.prototype.reduceRight.js
Array.prototype.reverse.js
Array.prototype.shift.js
Array.prototype.slice.js
Array.prototype.some.js
Array.prototype.sort.js
Array.prototype.splice.js
Array.prototype.toLocaleString.js
Array.prototype.toString.js LibJS: Pass this value to fallback func in Array.prototype.toString() 2022-04-12 00:23:27 +01:00
Array.prototype.unshift.js
Array.prototype.values.js LibJS: Add tests for all the unscopable Array prototype properties 2022-01-05 20:31:25 +01:00