Changeset 260732 in webkit
- Timestamp:
- Apr 26, 2020 2:30:38 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r260730 r260732 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 InternalFunction::createSubclassStructure should use newTarget's globalObject 4 https://bugs.webkit.org/show_bug.cgi?id=202599 5 6 Reviewed by Yusuke Suzuki. 7 8 * stress/promise-proto-from-ctor-realm.js: Added. 9 * test262/expectations.yaml: Mark 88 test cases as passing. 10 1 11 2020-04-26 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/JSTests/test262/expectations.yaml
r260697 r260732 634 634 default: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true' 635 635 strict mode: 'Test262Error: Expected SameValue(«undefined», «[object Function]») to be true' 636 test/built-ins/Array/proto-from-ctor-realm-one.js:637 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'638 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'639 test/built-ins/Array/proto-from-ctor-realm-two.js:640 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'641 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'642 test/built-ins/Array/proto-from-ctor-realm-zero.js:643 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'644 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«», «») to be true'645 636 test/built-ins/Array/prototype/concat/arg-length-exceeding-integer-limit.js: 646 637 default: 'Test262Error: Expected a TypeError but got a RangeError' … … 709 700 default: 'Test262Error: Length is 2**53 - 1 Expected SameValue(«4294967295», «9007199254740991») to be true' 710 701 strict mode: 'Test262Error: Length is 2**53 - 1 Expected SameValue(«4294967295», «9007199254740991») to be true' 711 test/built-ins/ArrayBuffer/proto-from-ctor-realm.js:712 default: 'Test262Error: Expected SameValue(«[object ArrayBuffer]», «[object ArrayBuffer]») to be true'713 strict mode: 'Test262Error: Expected SameValue(«[object ArrayBuffer]», «[object ArrayBuffer]») to be true'714 702 test/built-ins/ArrayBuffer/prototype/byteLength/detached-buffer.js: 715 703 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' … … 748 736 default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true' 749 737 strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«1», «0») to be true' 750 test/built-ins/AsyncFunction/proto-from-ctor-realm.js:751 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object AsyncFunction]», «[object AsyncFunction]») to be true'752 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object AsyncFunction]», «[object AsyncFunction]») to be true'753 test/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm.js:754 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object AsyncGeneratorFunction]», «[object AsyncGeneratorFunction]») to be true'755 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object AsyncGeneratorFunction]», «[object AsyncGeneratorFunction]») to be true'756 738 test/built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-promise.js: 757 739 default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: AsyncGeneratorResolve(generator, resultValue, true) Expected SameValue(«[object Promise]», «unwrapped-value») to be true' … … 817 799 default: 'Test262Error: Expected SameValue(«0», «2») to be true' 818 800 strict mode: 'Test262Error: Expected SameValue(«0», «2») to be true' 819 test/built-ins/Boolean/proto-from-ctor-realm.js:820 default: 'Test262Error: Expected SameValue(«false», «false») to be true'821 strict mode: 'Test262Error: Expected SameValue(«false», «false») to be true'822 801 test/built-ins/DataView/custom-proto-access-detaches-buffer.js: 823 802 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' … … 829 808 default: 'Test262Error: descriptor value should be 1' 830 809 strict mode: 'Test262Error: descriptor value should be 1' 831 test/built-ins/DataView/proto-from-ctor-realm.js:832 default: 'Test262Error: Expected SameValue(«[object DataView]», «[object DataView]») to be true'833 strict mode: 'Test262Error: Expected SameValue(«[object DataView]», «[object DataView]») to be true'834 810 test/built-ins/DataView/prototype/byteLength/detached-buffer.js: 835 811 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' … … 934 910 default: 'Test262Error: Expected a TypeError but got a RangeError' 935 911 strict mode: 'Test262Error: Expected a TypeError but got a RangeError' 936 test/built-ins/Date/proto-from-ctor-realm-one.js:937 default: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'938 strict mode: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'939 test/built-ins/Date/proto-from-ctor-realm-two.js:940 default: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'941 strict mode: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'942 test/built-ins/Date/proto-from-ctor-realm-zero.js:943 default: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'944 strict mode: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'945 test/built-ins/Error/proto-from-ctor-realm.js:946 default: 'Test262Error: Expected SameValue(«Error», «Error») to be true'947 strict mode: 'Test262Error: Expected SameValue(«Error», «Error») to be true'948 912 test/built-ins/Function/call-bind-this-realm-undef.js: 949 913 default: 'Test262Error: implicit undefined Expected SameValue(«[object global]», «[object Undefined]») to be true' … … 964 928 default: 'Test262Error: Expected a ReferenceError but got a ReferenceError' 965 929 strict mode: 'Test262Error: Expected a ReferenceError but got a ReferenceError' 966 test/built-ins/Function/proto-from-ctor-realm.js:967 default: 'Test262Error: Expected SameValue(«function () {'968 strict mode: 'Test262Error: Expected SameValue(«function () {'969 test/built-ins/Function/prototype/bind/get-fn-realm-recursive.js:970 default: 'Test262Error: Expected true but got false'971 strict mode: 'Test262Error: Expected true but got false'972 test/built-ins/Function/prototype/bind/get-fn-realm.js:973 default: 'Test262Error: Expected true but got false'974 strict mode: 'Test262Error: Expected true but got false'975 930 test/built-ins/Function/prototype/bind/length-exceeds-int32.js: 976 931 default: 'Test262Error: Expected SameValue(«0», «2147483648») to be true' … … 1111 1066 default: "Test262Error: Conforms to NativeFunction Syntax: 'function a(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; }'.(function \\u0061(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; })" 1112 1067 strict mode: "Test262Error: Conforms to NativeFunction Syntax: 'function a(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; }'.(function \\u0061(\\u{62}, \\u0063) { \\u0062 = \\u{00063}; return b; })" 1113 test/built-ins/GeneratorFunction/proto-from-ctor-realm.js:1114 default: 'Test262Error: Expected SameValue(«[object GeneratorFunction]», «[object GeneratorFunction]») to be true'1115 strict mode: 'Test262Error: Expected SameValue(«[object GeneratorFunction]», «[object GeneratorFunction]») to be true'1116 1068 test/built-ins/JSON/parse/reviver-object-non-configurable-prop-create.js: 1117 1069 default: 'Test262Error: Expected SameValue(«22», «2») to be true' 1118 1070 strict mode: 'Test262Error: Expected SameValue(«22», «2») to be true' 1119 test/built-ins/Map/proto-from-ctor-realm.js:1120 default: 'Test262Error: Expected SameValue(«[object Map]», «[object Map]») to be true'1121 strict mode: 'Test262Error: Expected SameValue(«[object Map]», «[object Map]») to be true'1122 test/built-ins/NativeErrors/EvalError/proto-from-ctor-realm.js:1123 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«EvalError», «EvalError») to be true'1124 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«EvalError», «EvalError») to be true'1125 test/built-ins/NativeErrors/RangeError/proto-from-ctor-realm.js:1126 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«RangeError», «RangeError») to be true'1127 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«RangeError», «RangeError») to be true'1128 test/built-ins/NativeErrors/ReferenceError/proto-from-ctor-realm.js:1129 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«ReferenceError», «ReferenceError») to be true'1130 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«ReferenceError», «ReferenceError») to be true'1131 test/built-ins/NativeErrors/SyntaxError/proto-from-ctor-realm.js:1132 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«SyntaxError», «SyntaxError») to be true'1133 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«SyntaxError», «SyntaxError») to be true'1134 test/built-ins/NativeErrors/TypeError/proto-from-ctor-realm.js:1135 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«TypeError», «TypeError») to be true'1136 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«TypeError», «TypeError») to be true'1137 test/built-ins/NativeErrors/URIError/proto-from-ctor-realm.js:1138 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«URIError», «URIError») to be true'1139 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«URIError», «URIError») to be true'1140 1071 test/built-ins/Number/bigint-conversion.js: 1141 1072 default: "TypeError: Conversion from 'BigInt' to 'number' is not allowed." 1142 1073 strict mode: "TypeError: Conversion from 'BigInt' to 'number' is not allowed." 1143 test/built-ins/Number/proto-from-ctor-realm.js:1144 default: 'Test262Error: Expected SameValue(«0», «0») to be true'1145 strict mode: 'Test262Error: Expected SameValue(«0», «0») to be true'1146 1074 test/built-ins/Object/entries/order-after-define-property.js: 1147 1075 default: 'Test262Error: Expected [b, a] and [a, b] to have the same contents. ' … … 1166 1094 default: 'Test262Error: Expected [b, a] and [a, b] to have the same contents. ' 1167 1095 strict mode: 'Test262Error: Expected [b, a] and [a, b] to have the same contents. ' 1168 test/built-ins/Object/proto-from-ctor-realm.js:1169 default: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'1170 strict mode: 'Test262Error: Expected SameValue(«[object Object]», «[object Object]») to be true'1171 1096 test/built-ins/Object/prototype/toString/proxy-function.js: 1172 1097 default: 'Test262Error: function proxy Expected SameValue(«[object Object]», «[object Function]») to be true' … … 1199 1124 default: 'Test262Error: Expected SameValue(«true», «false») to be true' 1200 1125 strict mode: 'Test262Error: Expected SameValue(«true», «false») to be true' 1201 test/built-ins/Promise/proto-from-ctor-realm.js:1202 default: 'Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true'1203 strict mode: 'Test262Error: Expected SameValue(«[object Promise]», «[object Promise]») to be true'1204 1126 test/built-ins/Promise/prototype/finally/invokes-then-with-function.js: 1205 1127 default: 'Test262Error: fulfillment handler is not constructor' … … 1253 1175 default: 'Test262Error: Expected a TypeError but got a TypeError' 1254 1176 strict mode: 'Test262Error: Expected a TypeError but got a TypeError' 1255 test/built-ins/Proxy/get-fn-realm-recursive.js:1256 default: 'Test262Error: Expected true but got false'1257 strict mode: 'Test262Error: Expected true but got false'1258 test/built-ins/Proxy/get-fn-realm.js:1259 default: 'Test262Error: Expected true but got false'1260 strict mode: 'Test262Error: Expected true but got false'1261 1177 test/built-ins/Proxy/ownKeys/trap-is-undefined-target-is-proxy.js: 1262 1178 default: 'Test262Error: Expected [length, foo, 0, Symbol()] and [Symbol(), length, foo, 0] to have the same contents. ' … … 1658 1574 default: 'Test262Error: `\p{XID_Start}` should match U+001CFA (`ᳺ`)' 1659 1575 strict mode: 'Test262Error: `\p{XID_Start}` should match U+001CFA (`ᳺ`)' 1660 test/built-ins/RegExp/proto-from-ctor-realm.js:1661 default: 'Test262Error: Expected SameValue(«/(?:)/», «/(?:)/») to be true'1662 strict mode: 'Test262Error: Expected SameValue(«/(?:)/», «/(?:)/») to be true'1663 1576 test/built-ins/RegExp/prototype/Symbol.match/builtin-infer-unicode.js: 1664 1577 default: 'Test262Error: Expected SameValue(«�», «null») to be true' … … 1697 1610 default: 'SyntaxError: Invalid regular expression: number too large in {} quantifier' 1698 1611 strict mode: 'SyntaxError: Invalid regular expression: number too large in {} quantifier' 1699 test/built-ins/Set/proto-from-ctor-realm.js:1700 default: 'Test262Error: Expected SameValue(«[object Set]», «[object Set]») to be true'1701 strict mode: 'Test262Error: Expected SameValue(«[object Set]», «[object Set]») to be true'1702 test/built-ins/String/proto-from-ctor-realm.js:1703 default: 'Test262Error: Expected SameValue(«», «») to be true'1704 strict mode: 'Test262Error: Expected SameValue(«», «») to be true'1705 1612 test/built-ins/String/prototype/replace/cstm-replace-is-null.js: 1706 1613 default: 'TypeError: null is not a function' … … 1777 1684 default: 'Test262Error: Expected a TypeError but got a RangeError (Testing with Float64Array.)' 1778 1685 strict mode: 'Test262Error: Expected a TypeError but got a RangeError (Testing with Float64Array.)' 1779 test/built-ins/TypedArrayConstructors/ctors/buffer-arg/proto-from-ctor-realm.js:1780 default: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1781 strict mode: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1782 test/built-ins/TypedArrayConstructors/ctors/length-arg/proto-from-ctor-realm.js:1783 default: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1784 strict mode: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1785 test/built-ins/TypedArrayConstructors/ctors/no-args/proto-from-ctor-realm.js:1786 default: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1787 strict mode: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1788 1686 test/built-ins/TypedArrayConstructors/ctors/object-arg/length-excessive-throws.js: 1789 1687 default: 'Test262Error: Expected a RangeError to be thrown but no exception was thrown at all (Testing with Float64Array.)' 1790 1688 strict mode: 'Test262Error: Expected a RangeError to be thrown but no exception was thrown at all (Testing with Float64Array.)' 1791 test/built-ins/TypedArrayConstructors/ctors/object-arg/proto-from-ctor-realm.js:1792 default: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1793 strict mode: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1794 1689 test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/detached-when-species-retrieved-different-type.js: 1795 1690 default: 'Test262Error: TypeError thrown for detached source buffer Expected a TypeError to be thrown but no exception was thrown at all (Testing with Float64Array.)' … … 1819 1714 default: 'Test262Error: Expected a Test262Error to be thrown but no exception was thrown at all (Testing with Float64Array.)' 1820 1715 strict mode: 'Test262Error: Expected a Test262Error to be thrown but no exception was thrown at all (Testing with Float64Array.)' 1821 test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/proto-from-ctor-realm.js:1822 default: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1823 strict mode: 'Test262Error: Expected SameValue(«[object Float64ArrayPrototype]», «[object Float64ArrayPrototype]») to be true (Testing with Float64Array.)'1824 1716 test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/same-ctor-buffer-ctor-access-throws.js: 1825 1717 default: 'Test262Error: Expected a Test262Error to be thrown but no exception was thrown at all (Testing with Float64Array.)' … … 1909 1801 default: 'TypeError: TypedArray.of requires its this argument to subclass a TypedArray constructor (Testing with Float64Array.)' 1910 1802 strict mode: 'TypeError: TypedArray.of requires its this argument to subclass a TypedArray constructor (Testing with Float64Array.)' 1911 test/built-ins/WeakMap/proto-from-ctor-realm.js:1912 default: 'Test262Error: Expected SameValue(«[object WeakMap]», «[object WeakMap]») to be true'1913 strict mode: 'Test262Error: Expected SameValue(«[object WeakMap]», «[object WeakMap]») to be true'1914 test/built-ins/WeakRef/proto-from-ctor-realm.js:1915 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object WeakRef]», «[object WeakRef]») to be true'1916 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object WeakRef]», «[object WeakRef]») to be true'1917 test/built-ins/WeakSet/proto-from-ctor-realm.js:1918 default: 'Test262Error: Expected SameValue(«[object WeakSet]», «[object WeakSet]») to be true'1919 strict mode: 'Test262Error: Expected SameValue(«[object WeakSet]», «[object WeakSet]») to be true'1920 1803 test/intl402/Collator/missing-unicode-ext-value-defaults-to-true.js: 1921 1804 default: "Test262Error: \"kn-true\" is returned in locale, but shouldn't be. Expected SameValue(«7», «-1») to be true" 1922 1805 strict mode: "Test262Error: \"kn-true\" is returned in locale, but shouldn't be. Expected SameValue(«7», «-1») to be true" 1923 test/intl402/Collator/proto-from-ctor-realm.js:1924 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1925 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1926 1806 test/intl402/Collator/usage-de.js: 1927 1807 default: 'Test262Error: Expected [Ä, AE] and [AE, Ä] to have the same contents. search' 1928 1808 strict mode: 'Test262Error: Expected [Ä, AE] and [AE, Ä] to have the same contents. search' 1929 test/intl402/DateTimeFormat/proto-from-ctor-realm.js:1930 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1931 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1932 1809 test/intl402/DateTimeFormat/prototype/resolvedOptions/hourCycle-default.js: 1933 1810 default: 'Test262Error: Expected SameValue(«h24», «h23») to be true' … … 1975 1852 default: 'Test262Error: Expected a RangeError to be thrown but no exception was thrown at all' 1976 1853 strict mode: 'Test262Error: Expected a RangeError to be thrown but no exception was thrown at all' 1977 test/intl402/NumberFormat/proto-from-ctor-realm.js:1978 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1979 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1980 test/intl402/PluralRules/proto-from-ctor-realm.js:1981 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1982 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Object]», «[object Object]») to be true'1983 1854 test/intl402/RelativeTimeFormat/constructor/constructor/locales-valid.js: 1984 1855 default: 'Test262Error: Grandfathered Expected a RangeError to be thrown but no exception was thrown at all' 1985 1856 strict mode: 'Test262Error: Grandfathered Expected a RangeError to be thrown but no exception was thrown at all' 1986 test/intl402/RelativeTimeFormat/constructor/constructor/proto-from-ctor-realm.js:1987 default: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Intl.RelativeTimeFormat]», «[object Intl.RelativeTimeFormat]») to be true'1988 strict mode: 'Test262Error: newTarget.prototype is undefined Expected SameValue(«[object Intl.RelativeTimeFormat]», «[object Intl.RelativeTimeFormat]») to be true'1989 1857 test/intl402/RelativeTimeFormat/prototype/format/pl-pl-style-long.js: 1990 1858 default: 'Test262Error: Expected SameValue(«za 1000 sekund», «za 1 000 sekund») to be true' -
trunk/LayoutTests/imported/w3c/ChangeLog
r260707 r260732 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 InternalFunction::createSubclassStructure should use newTarget's globalObject 4 https://bugs.webkit.org/show_bug.cgi?id=202599 5 6 Reviewed by Yusuke Suzuki. 7 8 * web-platform-tests/WebIDL/ecmascript-binding/constructors-expected.txt: 9 * web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt: 10 * web-platform-tests/wasm/jsapi/proto-from-ctor-realm-expected.txt: 11 1 12 2020-04-25 Darin Adler <darin@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/constructors-expected.txt
r256716 r260732 11 11 PASS Constructor in child window with bad NewTarget from parent window 12 12 PASS Constructor in parent window with bad NewTarget from child window 13 FAIL Constructor in parent window with bad NewTarget from parent window that's a bound child window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 14 FAIL Constructor in child window with bad NewTarget from child window that's a bound parent window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 15 FAIL Constructor in parent window with bad NewTarget from parent window that's a proxy for a child window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 16 FAIL Constructor in child window with bad NewTarget from child window that's a proxy for a parent window function assert_equals: expected object "[object DOMParserPrototype]" but got object "[object DOMParserPrototype]" 13 PASS Constructor in parent window with bad NewTarget from parent window that's a bound child window function 14 PASS Constructor in child window with bad NewTarget from child window that's a bound parent window function 15 PASS Constructor in parent window with bad NewTarget from parent window that's a proxy for a child window function 16 PASS Constructor in child window with bad NewTarget from child window that's a proxy for a parent window function 17 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt
r260670 r260732 3 3 PASS Rethrow any exceptions thrown while getting the prototype 4 4 PASS If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements) 5 FAIL If prototype is not object (null), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 5 PASS If prototype is not object (null), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) 6 6 PASS If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements) 7 FAIL If prototype is not object (undefined), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 7 PASS If prototype is not object (undefined), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) 8 8 PASS If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements) 9 FAIL If prototype is not object (5), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 9 PASS If prototype is not object (5), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) 10 10 PASS If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements) 11 FAIL If prototype is not object (string), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]" 11 PASS If prototype is not object (string), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements) 12 12 FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor" 13 13 FAIL If prototype is not object (null), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument be a constructor" -
trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/proto-from-ctor-realm-expected.txt
r260690 r260732 1 1 2 FAIL WebAssembly.Module: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 3 FAIL WebAssembly.Module: cross-realm NewTarget with `null` prototype assert_true: expected true got false 4 FAIL WebAssembly.Module: cross-realm NewTarget with `false` prototype assert_true: expected true got false 5 FAIL WebAssembly.Module: cross-realm NewTarget with `true` prototype assert_true: expected true got false 6 FAIL WebAssembly.Module: cross-realm NewTarget with `0` prototype assert_true: expected true got false 7 FAIL WebAssembly.Module: cross-realm NewTarget with `-1` prototype assert_true: expected true got false 8 FAIL WebAssembly.Module: cross-realm NewTarget with `""` prototype assert_true: expected true got false 9 FAIL WebAssembly.Module: cross-realm NewTarget with `"str"` prototype assert_true: expected true got false 10 FAIL WebAssembly.Module: cross-realm NewTarget with `symbol "Symbol()"` prototype assert_true: expected true got false 11 FAIL WebAssembly.Module: bound cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 12 FAIL WebAssembly.Module: bound bound cross-realm NewTarget with `null` prototype assert_true: expected true got false 13 FAIL WebAssembly.Module: bound Proxy of cross-realm NewTarget with `false` prototype assert_true: expected true got false 14 FAIL WebAssembly.Module: Proxy of cross-realm NewTarget with `true` prototype assert_true: expected true got false 15 FAIL WebAssembly.Module: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 16 FAIL WebAssembly.Module: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 17 FAIL WebAssembly.Instance: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 18 FAIL WebAssembly.Instance: cross-realm NewTarget with `null` prototype assert_true: expected true got false 19 FAIL WebAssembly.Instance: cross-realm NewTarget with `false` prototype assert_true: expected true got false 20 FAIL WebAssembly.Instance: cross-realm NewTarget with `true` prototype assert_true: expected true got false 21 FAIL WebAssembly.Instance: cross-realm NewTarget with `0` prototype assert_true: expected true got false 22 FAIL WebAssembly.Instance: cross-realm NewTarget with `-1` prototype assert_true: expected true got false 23 FAIL WebAssembly.Instance: cross-realm NewTarget with `""` prototype assert_true: expected true got false 24 FAIL WebAssembly.Instance: cross-realm NewTarget with `"str"` prototype assert_true: expected true got false 25 FAIL WebAssembly.Instance: cross-realm NewTarget with `symbol "Symbol()"` prototype assert_true: expected true got false 26 FAIL WebAssembly.Instance: bound cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 27 FAIL WebAssembly.Instance: bound bound cross-realm NewTarget with `null` prototype assert_true: expected true got false 28 FAIL WebAssembly.Instance: bound Proxy of cross-realm NewTarget with `false` prototype assert_true: expected true got false 29 FAIL WebAssembly.Instance: Proxy of cross-realm NewTarget with `true` prototype assert_true: expected true got false 30 FAIL WebAssembly.Instance: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 31 FAIL WebAssembly.Instance: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 2 PASS WebAssembly.Module: cross-realm NewTarget with `undefined` prototype 3 PASS WebAssembly.Module: cross-realm NewTarget with `null` prototype 4 PASS WebAssembly.Module: cross-realm NewTarget with `false` prototype 5 PASS WebAssembly.Module: cross-realm NewTarget with `true` prototype 6 PASS WebAssembly.Module: cross-realm NewTarget with `0` prototype 7 PASS WebAssembly.Module: cross-realm NewTarget with `-1` prototype 8 PASS WebAssembly.Module: cross-realm NewTarget with `""` prototype 9 PASS WebAssembly.Module: cross-realm NewTarget with `"str"` prototype 10 PASS WebAssembly.Module: cross-realm NewTarget with `symbol "Symbol()"` prototype 11 PASS WebAssembly.Module: bound cross-realm NewTarget with `undefined` prototype 12 PASS WebAssembly.Module: bound bound cross-realm NewTarget with `null` prototype 13 PASS WebAssembly.Module: bound Proxy of cross-realm NewTarget with `false` prototype 14 PASS WebAssembly.Module: Proxy of cross-realm NewTarget with `true` prototype 15 PASS WebAssembly.Module: Proxy of Proxy of cross-realm NewTarget with `-0` prototype 16 PASS WebAssembly.Module: Proxy of bound cross-realm NewTarget with `NaN` prototype 17 PASS WebAssembly.Instance: cross-realm NewTarget with `undefined` prototype 18 PASS WebAssembly.Instance: cross-realm NewTarget with `null` prototype 19 PASS WebAssembly.Instance: cross-realm NewTarget with `false` prototype 20 PASS WebAssembly.Instance: cross-realm NewTarget with `true` prototype 21 PASS WebAssembly.Instance: cross-realm NewTarget with `0` prototype 22 PASS WebAssembly.Instance: cross-realm NewTarget with `-1` prototype 23 PASS WebAssembly.Instance: cross-realm NewTarget with `""` prototype 24 PASS WebAssembly.Instance: cross-realm NewTarget with `"str"` prototype 25 PASS WebAssembly.Instance: cross-realm NewTarget with `symbol "Symbol()"` prototype 26 PASS WebAssembly.Instance: bound cross-realm NewTarget with `undefined` prototype 27 PASS WebAssembly.Instance: bound bound cross-realm NewTarget with `null` prototype 28 PASS WebAssembly.Instance: bound Proxy of cross-realm NewTarget with `false` prototype 29 PASS WebAssembly.Instance: Proxy of cross-realm NewTarget with `true` prototype 30 PASS WebAssembly.Instance: Proxy of Proxy of cross-realm NewTarget with `-0` prototype 31 PASS WebAssembly.Instance: Proxy of bound cross-realm NewTarget with `NaN` prototype 32 32 FAIL WebAssembly.Memory: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 33 33 FAIL WebAssembly.Memory: cross-realm NewTarget with `null` prototype assert_true: expected true got false … … 75 75 FAIL WebAssembly.Global: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 76 76 FAIL WebAssembly.Global: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 77 FAIL WebAssembly.CompileError: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 78 FAIL WebAssembly.CompileError: cross-realm NewTarget with `null` prototype assert_true: expected true got false 79 FAIL WebAssembly.CompileError: cross-realm NewTarget with `false` prototype assert_true: expected true got false 80 FAIL WebAssembly.CompileError: cross-realm NewTarget with `true` prototype assert_true: expected true got false 81 FAIL WebAssembly.CompileError: cross-realm NewTarget with `0` prototype assert_true: expected true got false 82 FAIL WebAssembly.CompileError: cross-realm NewTarget with `-1` prototype assert_true: expected true got false 83 FAIL WebAssembly.CompileError: cross-realm NewTarget with `""` prototype assert_true: expected true got false 84 FAIL WebAssembly.CompileError: cross-realm NewTarget with `"str"` prototype assert_true: expected true got false 85 FAIL WebAssembly.CompileError: cross-realm NewTarget with `symbol "Symbol()"` prototype assert_true: expected true got false 86 FAIL WebAssembly.CompileError: bound cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 87 FAIL WebAssembly.CompileError: bound bound cross-realm NewTarget with `null` prototype assert_true: expected true got false 88 FAIL WebAssembly.CompileError: bound Proxy of cross-realm NewTarget with `false` prototype assert_true: expected true got false 89 FAIL WebAssembly.CompileError: Proxy of cross-realm NewTarget with `true` prototype assert_true: expected true got false 90 FAIL WebAssembly.CompileError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 91 FAIL WebAssembly.CompileError: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 92 FAIL WebAssembly.LinkError: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 93 FAIL WebAssembly.LinkError: cross-realm NewTarget with `null` prototype assert_true: expected true got false 94 FAIL WebAssembly.LinkError: cross-realm NewTarget with `false` prototype assert_true: expected true got false 95 FAIL WebAssembly.LinkError: cross-realm NewTarget with `true` prototype assert_true: expected true got false 96 FAIL WebAssembly.LinkError: cross-realm NewTarget with `0` prototype assert_true: expected true got false 97 FAIL WebAssembly.LinkError: cross-realm NewTarget with `-1` prototype assert_true: expected true got false 98 FAIL WebAssembly.LinkError: cross-realm NewTarget with `""` prototype assert_true: expected true got false 99 FAIL WebAssembly.LinkError: cross-realm NewTarget with `"str"` prototype assert_true: expected true got false 100 FAIL WebAssembly.LinkError: cross-realm NewTarget with `symbol "Symbol()"` prototype assert_true: expected true got false 101 FAIL WebAssembly.LinkError: bound cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 102 FAIL WebAssembly.LinkError: bound bound cross-realm NewTarget with `null` prototype assert_true: expected true got false 103 FAIL WebAssembly.LinkError: bound Proxy of cross-realm NewTarget with `false` prototype assert_true: expected true got false 104 FAIL WebAssembly.LinkError: Proxy of cross-realm NewTarget with `true` prototype assert_true: expected true got false 105 FAIL WebAssembly.LinkError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 106 FAIL WebAssembly.LinkError: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 107 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 108 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `null` prototype assert_true: expected true got false 109 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `false` prototype assert_true: expected true got false 110 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `true` prototype assert_true: expected true got false 111 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `0` prototype assert_true: expected true got false 112 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `-1` prototype assert_true: expected true got false 113 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `""` prototype assert_true: expected true got false 114 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `"str"` prototype assert_true: expected true got false 115 FAIL WebAssembly.RuntimeError: cross-realm NewTarget with `symbol "Symbol()"` prototype assert_true: expected true got false 116 FAIL WebAssembly.RuntimeError: bound cross-realm NewTarget with `undefined` prototype assert_true: expected true got false 117 FAIL WebAssembly.RuntimeError: bound bound cross-realm NewTarget with `null` prototype assert_true: expected true got false 118 FAIL WebAssembly.RuntimeError: bound Proxy of cross-realm NewTarget with `false` prototype assert_true: expected true got false 119 FAIL WebAssembly.RuntimeError: Proxy of cross-realm NewTarget with `true` prototype assert_true: expected true got false 120 FAIL WebAssembly.RuntimeError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype assert_true: expected true got false 121 FAIL WebAssembly.RuntimeError: Proxy of bound cross-realm NewTarget with `NaN` prototype assert_true: expected true got false 77 PASS WebAssembly.CompileError: cross-realm NewTarget with `undefined` prototype 78 PASS WebAssembly.CompileError: cross-realm NewTarget with `null` prototype 79 PASS WebAssembly.CompileError: cross-realm NewTarget with `false` prototype 80 PASS WebAssembly.CompileError: cross-realm NewTarget with `true` prototype 81 PASS WebAssembly.CompileError: cross-realm NewTarget with `0` prototype 82 PASS WebAssembly.CompileError: cross-realm NewTarget with `-1` prototype 83 PASS WebAssembly.CompileError: cross-realm NewTarget with `""` prototype 84 PASS WebAssembly.CompileError: cross-realm NewTarget with `"str"` prototype 85 PASS WebAssembly.CompileError: cross-realm NewTarget with `symbol "Symbol()"` prototype 86 PASS WebAssembly.CompileError: bound cross-realm NewTarget with `undefined` prototype 87 PASS WebAssembly.CompileError: bound bound cross-realm NewTarget with `null` prototype 88 PASS WebAssembly.CompileError: bound Proxy of cross-realm NewTarget with `false` prototype 89 PASS WebAssembly.CompileError: Proxy of cross-realm NewTarget with `true` prototype 90 PASS WebAssembly.CompileError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype 91 PASS WebAssembly.CompileError: Proxy of bound cross-realm NewTarget with `NaN` prototype 92 PASS WebAssembly.LinkError: cross-realm NewTarget with `undefined` prototype 93 PASS WebAssembly.LinkError: cross-realm NewTarget with `null` prototype 94 PASS WebAssembly.LinkError: cross-realm NewTarget with `false` prototype 95 PASS WebAssembly.LinkError: cross-realm NewTarget with `true` prototype 96 PASS WebAssembly.LinkError: cross-realm NewTarget with `0` prototype 97 PASS WebAssembly.LinkError: cross-realm NewTarget with `-1` prototype 98 PASS WebAssembly.LinkError: cross-realm NewTarget with `""` prototype 99 PASS WebAssembly.LinkError: cross-realm NewTarget with `"str"` prototype 100 PASS WebAssembly.LinkError: cross-realm NewTarget with `symbol "Symbol()"` prototype 101 PASS WebAssembly.LinkError: bound cross-realm NewTarget with `undefined` prototype 102 PASS WebAssembly.LinkError: bound bound cross-realm NewTarget with `null` prototype 103 PASS WebAssembly.LinkError: bound Proxy of cross-realm NewTarget with `false` prototype 104 PASS WebAssembly.LinkError: Proxy of cross-realm NewTarget with `true` prototype 105 PASS WebAssembly.LinkError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype 106 PASS WebAssembly.LinkError: Proxy of bound cross-realm NewTarget with `NaN` prototype 107 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `undefined` prototype 108 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `null` prototype 109 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `false` prototype 110 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `true` prototype 111 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `0` prototype 112 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `-1` prototype 113 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `""` prototype 114 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `"str"` prototype 115 PASS WebAssembly.RuntimeError: cross-realm NewTarget with `symbol "Symbol()"` prototype 116 PASS WebAssembly.RuntimeError: bound cross-realm NewTarget with `undefined` prototype 117 PASS WebAssembly.RuntimeError: bound bound cross-realm NewTarget with `null` prototype 118 PASS WebAssembly.RuntimeError: bound Proxy of cross-realm NewTarget with `false` prototype 119 PASS WebAssembly.RuntimeError: Proxy of cross-realm NewTarget with `true` prototype 120 PASS WebAssembly.RuntimeError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype 121 PASS WebAssembly.RuntimeError: Proxy of bound cross-realm NewTarget with `NaN` prototype 122 122 -
trunk/Source/JavaScriptCore/ChangeLog
r260730 r260732 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 InternalFunction::createSubclassStructure should use newTarget's globalObject 4 https://bugs.webkit.org/show_bug.cgi?id=202599 5 6 Reviewed by Yusuke Suzuki. 7 8 If "prototype" of NewTarget is not an object, built-in constructors [1] should acquire 9 default [[Prototype]] from realm of NewTarget, utilizing GetFunctionRealm helper [2]. 10 Before this change, realm of active constructor was used instead. This patch introduces 11 GetFunctionRealm and aligns all subclassable constructors with the spec, V8, and SpiderMonkey. 12 13 This change inlines fast paths checks of InternalFunction::createSubclassStructure() and 14 simplifies its signature; getFunctionRealm() is invoked in slow paths only. 15 16 While a dynamically created function uses NewTarget's realm for its default [[Prototype]] 17 similar to other built-ins, its "prototype" object inherit from ObjectPrototype 18 of active constructor's realm [3] (just like their scope), making it retain references 19 to 2 different global objects. To accomodate this behavior, this change introduces 20 `scopeGlobalObject` in JSFunction.cpp methods. 21 22 Above-mentioned behavior also simplifies creation of JSGenerator and JSAsyncGenerator 23 instances since NewTarget's realm is irrelevant to them. 24 25 IntlCollatorConstructor::collatorStructure() and 6 similar methods are removed: 26 a) to impose good practice of using newTarget's globalObject; 27 b) with this change, each of them have 1 call site max; 28 c) other JSC constructors have no methods alike. 29 30 [1]: https://tc39.es/ecma262/#sec-map-constructor (step 2) 31 [2]: https://tc39.es/ecma262/#sec-getfunctionrealm 32 [3]: https://tc39.es/ecma262/#sec-createdynamicfunction (steps 23-25) 33 34 * dfg/DFGOperations.cpp: 35 * runtime/AggregateErrorConstructor.cpp: 36 (JSC::callAggregateErrorConstructor): 37 (JSC::constructAggregateErrorConstructor): 38 * runtime/AggregateErrorConstructor.h: 39 * runtime/AsyncFunctionConstructor.cpp: 40 (JSC::constructAsyncFunctionConstructor): 41 * runtime/AsyncGeneratorFunctionConstructor.cpp: 42 (JSC::constructAsyncGeneratorFunctionConstructor): 43 * runtime/BooleanConstructor.cpp: 44 (JSC::constructWithBooleanConstructor): 45 * runtime/CommonSlowPaths.cpp: 46 (JSC::SLOW_PATH_DECL): 47 (JSC::createInternalFieldObject): 48 * runtime/DateConstructor.cpp: 49 (JSC::constructDate): 50 * runtime/ErrorConstructor.cpp: 51 (JSC::constructErrorConstructor): 52 * runtime/FunctionConstructor.cpp: 53 (JSC::constructFunctionSkippingEvalEnabledCheck): 54 * runtime/InternalFunction.cpp: 55 (JSC::InternalFunction::createSubclassStructure): 56 (JSC::getFunctionRealm): 57 (JSC::InternalFunction::createSubclassStructureSlow): Deleted. 58 * runtime/InternalFunction.h: 59 (JSC::InternalFunction::createSubclassStructure): Deleted. 60 * runtime/IntlCollatorConstructor.cpp: 61 (JSC::constructIntlCollator): 62 (JSC::callIntlCollator): 63 * runtime/IntlCollatorConstructor.h: 64 * runtime/IntlDateTimeFormatConstructor.cpp: 65 (JSC::constructIntlDateTimeFormat): 66 (JSC::callIntlDateTimeFormat): 67 * runtime/IntlDateTimeFormatConstructor.h: 68 * runtime/IntlNumberFormatConstructor.cpp: 69 (JSC::constructIntlNumberFormat): 70 (JSC::callIntlNumberFormat): 71 * runtime/IntlNumberFormatConstructor.h: 72 * runtime/IntlPluralRulesConstructor.cpp: 73 (JSC::constructIntlPluralRules): 74 * runtime/IntlPluralRulesConstructor.h: 75 * runtime/IntlRelativeTimeFormatConstructor.cpp: 76 (JSC::constructIntlRelativeTimeFormat): 77 * runtime/IntlRelativeTimeFormatConstructor.h: 78 * runtime/JSArrayBufferConstructor.cpp: 79 (JSC::JSGenericArrayBufferConstructor<sharingMode>::constructArrayBuffer): 80 * runtime/JSFunction.cpp: 81 (JSC::JSFunction::prototypeForConstruction): 82 (JSC::JSFunction::getOwnPropertySlot): 83 * runtime/JSGenericTypedArrayViewConstructorInlines.h: 84 (JSC::constructGenericTypedArrayView): 85 * runtime/JSGlobalObjectInlines.h: 86 (JSC::JSGlobalObject::arrayStructureForIndexingTypeDuringAllocation const): 87 * runtime/MapConstructor.cpp: 88 (JSC::constructMap): 89 * runtime/NativeErrorConstructor.cpp: 90 (JSC::NativeErrorConstructor<errorType>::constructNativeErrorConstructor): 91 (JSC::NativeErrorConstructor<errorType>::callNativeErrorConstructor): 92 * runtime/NativeErrorConstructor.h: 93 * runtime/NumberConstructor.cpp: 94 (JSC::constructNumberConstructor): 95 * runtime/ObjectConstructor.cpp: 96 (JSC::constructObjectWithNewTarget): 97 * runtime/RegExpConstructor.cpp: 98 (JSC::getRegExpStructure): 99 (JSC::constructRegExp): 100 (JSC::esSpecRegExpCreate): 101 * runtime/RegExpConstructor.h: 102 * runtime/SetConstructor.cpp: 103 (JSC::constructSet): 104 * runtime/StringConstructor.cpp: 105 (JSC::constructWithStringConstructor): 106 * runtime/WeakMapConstructor.cpp: 107 (JSC::constructWeakMap): 108 * runtime/WeakObjectRefConstructor.cpp: 109 (JSC::constructWeakRef): 110 * runtime/WeakSetConstructor.cpp: 111 (JSC::constructWeakSet): 112 * wasm/js/WebAssemblyCompileErrorConstructor.cpp: 113 (JSC::constructJSWebAssemblyCompileError): 114 * wasm/js/WebAssemblyInstanceConstructor.cpp: 115 (JSC::constructJSWebAssemblyInstance): 116 * wasm/js/WebAssemblyLinkErrorConstructor.cpp: 117 (JSC::constructJSWebAssemblyLinkError): 118 * wasm/js/WebAssemblyModuleConstructor.cpp: 119 (JSC::WebAssemblyModuleConstructor::createModule): 120 * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: 121 (JSC::constructJSWebAssemblyRuntimeError): 122 1 123 2020-04-26 Yusuke Suzuki <ysuzuki@apple.com> 2 124 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r260683 r260732 345 345 JITOperationPrologueCallFrameTracer tracer(vm, callFrame); 346 346 auto scope = DECLARE_THROW_SCOPE(vm); 347 Structure* structure = InternalFunction::createSubclassStructure(globalObject, globalObject->promiseConstructor(), constructor, globalObject->promiseStructure()); 347 Structure* structure = constructor == globalObject->promiseConstructor() 348 ? globalObject->promiseStructure() 349 : InternalFunction::createSubclassStructure(globalObject, constructor, getFunctionRealm(vm, constructor)->promiseStructure()); 348 350 RETURN_IF_EXCEPTION(scope, nullptr); 349 351 RELEASE_AND_RETURN(scope, JSPromise::create(vm, structure)); … … 356 358 JITOperationPrologueCallFrameTracer tracer(vm, callFrame); 357 359 auto scope = DECLARE_THROW_SCOPE(vm); 358 Structure* structure = InternalFunction::createSubclassStructure(globalObject, globalObject->internalPromiseConstructor(), constructor, globalObject->internalPromiseStructure()); 360 Structure* structure = constructor == globalObject->internalPromiseConstructor() 361 ? globalObject->internalPromiseStructure() 362 : InternalFunction::createSubclassStructure(globalObject, constructor, getFunctionRealm(vm, constructor)->internalPromiseStructure()); 359 363 RETURN_IF_EXCEPTION(scope, nullptr); 360 364 RELEASE_AND_RETURN(scope, JSInternalPromise::create(vm, structure)); … … 367 371 JITOperationPrologueCallFrameTracer tracer(vm, callFrame); 368 372 auto scope = DECLARE_THROW_SCOPE(vm); 369 Structure* structure = InternalFunction::createSubclassStructure(globalObject, nullptr,constructor, globalObject->generatorStructure());373 Structure* structure = InternalFunction::createSubclassStructure(globalObject, constructor, globalObject->generatorStructure()); 370 374 RETURN_IF_EXCEPTION(scope, nullptr); 371 375 RELEASE_AND_RETURN(scope, JSGenerator::create(vm, structure)); … … 378 382 JITOperationPrologueCallFrameTracer tracer(vm, callFrame); 379 383 auto scope = DECLARE_THROW_SCOPE(vm); 380 Structure* structure = InternalFunction::createSubclassStructure(globalObject, nullptr,constructor, globalObject->asyncGeneratorStructure());384 Structure* structure = InternalFunction::createSubclassStructure(globalObject, constructor, globalObject->asyncGeneratorStructure()); 381 385 RETURN_IF_EXCEPTION(scope, nullptr); 382 386 RELEASE_AND_RETURN(scope, JSAsyncGenerator::create(vm, structure)); -
trunk/Source/JavaScriptCore/runtime/AggregateErrorConstructor.cpp
r260417 r260732 64 64 JSValue errors = callFrame->argument(0); 65 65 JSValue message = callFrame->argument(1); 66 Structure* errorStructure = jsCast<AggregateErrorConstructor*>(callFrame->jsCallee())->errorStructure(vm);66 Structure* errorStructure = globalObject->errorStructure(ErrorType::AggregateError); 67 67 return JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, nullptr, TypeNothing, false)); 68 68 } … … 74 74 JSValue errors = callFrame->argument(0); 75 75 JSValue message = callFrame->argument(1); 76 JSValue newTarget = callFrame->newTarget(); 77 ASSERT(newTarget.isObject()); 78 Structure* baseStructure = asObject(newTarget)->globalObject(vm)->errorStructure(ErrorType::AggregateError); 79 Structure* errorStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), newTarget, baseStructure); 80 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 76 77 JSObject* newTarget = asObject(callFrame->newTarget()); 78 Structure* errorStructure = newTarget == callFrame->jsCallee() 79 ? globalObject->errorStructure(ErrorType::AggregateError) 80 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->errorStructure(ErrorType::AggregateError)); 81 RETURN_IF_EXCEPTION(scope, { }); 81 82 ASSERT(errorStructure); 83 82 84 RELEASE_AND_RETURN(scope, JSValue::encode(AggregateError::create(globalObject, vm, errorStructure, errors, message, nullptr, TypeNothing, false))); 83 85 } -
trunk/Source/JavaScriptCore/runtime/AggregateErrorConstructor.h
r260273 r260732 56 56 } 57 57 58 Structure* errorStructure(VM&) { return globalObject()->errorStructure(ErrorType::AggregateError); }59 60 58 private: 61 59 explicit AggregateErrorConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/AsyncFunctionConstructor.cpp
r252520 r260732 46 46 { 47 47 ArgList args(callFrame); 48 return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::Async ));48 return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::Async, callFrame->newTarget())); 49 49 } 50 50 -
trunk/Source/JavaScriptCore/runtime/AsyncGeneratorFunctionConstructor.cpp
r252520 r260732 46 46 { 47 47 ArgList args(callFrame); 48 return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::AsyncGenerator ));48 return JSValue::encode(constructFunction(globalObject, callFrame, args, FunctionConstructionMode::AsyncGenerator, callFrame->newTarget())); 49 49 } 50 50 -
trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp
r252520 r260732 44 44 auto scope = DECLARE_THROW_SCOPE(vm); 45 45 JSValue boolean = jsBoolean(callFrame->argument(0).toBoolean(globalObject)); 46 Structure* booleanStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->booleanObjectStructure()); 47 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 46 47 JSObject* newTarget = asObject(callFrame->newTarget()); 48 Structure* booleanStructure = newTarget == callFrame->jsCallee() 49 ? globalObject->booleanObjectStructure() 50 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->booleanObjectStructure()); 51 RETURN_IF_EXCEPTION(scope, { }); 52 48 53 BooleanObject* obj = BooleanObject::create(vm, booleanStructure); 49 54 obj->setInternalValue(vm, boolean); -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r260683 r260732 284 284 JSPromise* result = nullptr; 285 285 if (bytecode.m_isInternalPromise) { 286 Structure* structure = InternalFunction::createSubclassStructure(globalObject, globalObject->internalPromiseConstructor(), constructorAsObject, globalObject->internalPromiseStructure()); 286 Structure* structure = constructorAsObject == globalObject->internalPromiseConstructor() 287 ? globalObject->internalPromiseStructure() 288 : InternalFunction::createSubclassStructure(globalObject, constructorAsObject, getFunctionRealm(vm, constructorAsObject)->internalPromiseStructure()); 287 289 CHECK_EXCEPTION(); 288 290 result = JSInternalPromise::create(vm, structure); 289 291 } else { 290 Structure* structure = InternalFunction::createSubclassStructure(globalObject, globalObject->promiseConstructor(), constructorAsObject, globalObject->promiseStructure()); 292 Structure* structure = constructorAsObject == globalObject->promiseConstructor() 293 ? globalObject->promiseStructure() 294 : InternalFunction::createSubclassStructure(globalObject, constructorAsObject, getFunctionRealm(vm, constructorAsObject)->promiseStructure()); 291 295 CHECK_EXCEPTION(); 292 296 result = JSPromise::create(vm, structure); … … 321 325 auto scope = DECLARE_THROW_SCOPE(vm); 322 326 323 Structure* structure = InternalFunction::createSubclassStructure(globalObject, nullptr,constructorAsObject, baseStructure);327 Structure* structure = InternalFunction::createSubclassStructure(globalObject, constructorAsObject, baseStructure); 324 328 RETURN_IF_EXCEPTION(scope, nullptr); 325 329 JSClass* result = JSClass::create(vm, structure); -
trunk/Source/JavaScriptCore/runtime/DateConstructor.cpp
r252520 r260732 144 144 RETURN_IF_EXCEPTION(scope, nullptr); 145 145 146 Structure* dateStructure = InternalFunction::createSubclassStructure(globalObject, globalObject->dateConstructor(), newTarget, globalObject->dateStructure()); 146 Structure* dateStructure = !newTarget || newTarget == globalObject->dateConstructor() 147 ? globalObject->dateStructure() 148 : InternalFunction::createSubclassStructure(globalObject, asObject(newTarget), getFunctionRealm(vm, asObject(newTarget))->dateStructure()); 147 149 RETURN_IF_EXCEPTION(scope, nullptr); 148 150 -
trunk/Source/JavaScriptCore/runtime/ErrorConstructor.cpp
r257399 r260732 58 58 auto scope = DECLARE_THROW_SCOPE(vm); 59 59 JSValue message = callFrame->argument(0); 60 Structure* errorStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->errorStructure()); 61 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 60 61 JSObject* newTarget = asObject(callFrame->newTarget()); 62 Structure* errorStructure = newTarget == callFrame->jsCallee() 63 ? globalObject->errorStructure() 64 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->errorStructure()); 65 RETURN_IF_EXCEPTION(scope, { }); 66 62 67 RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, false))); 63 68 } -
trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp
r252520 r260732 153 153 } 154 154 155 bool needsSubclassStructure = newTarget && newTarget != globalObject->functionConstructor(); 156 JSGlobalObject* structureGlobalObject = needsSubclassStructure ? getFunctionRealm(vm, asObject(newTarget)) : globalObject; 155 157 Structure* structure = nullptr; 156 158 switch (functionConstructionMode) { 157 159 case FunctionConstructionMode::Function: 158 structure = JSFunction::selectStructureForNewFuncExp( globalObject, function);160 structure = JSFunction::selectStructureForNewFuncExp(structureGlobalObject, function); 159 161 break; 160 162 case FunctionConstructionMode::Generator: 161 structure = globalObject->generatorFunctionStructure();163 structure = structureGlobalObject->generatorFunctionStructure(); 162 164 break; 163 165 case FunctionConstructionMode::Async: 164 structure = globalObject->asyncFunctionStructure();166 structure = structureGlobalObject->asyncFunctionStructure(); 165 167 break; 166 168 case FunctionConstructionMode::AsyncGenerator: 167 structure = globalObject->asyncGeneratorFunctionStructure(); 168 break; 169 } 170 171 Structure* subclassStructure = InternalFunction::createSubclassStructure(globalObject, globalObject->functionConstructor(), newTarget, structure); 172 RETURN_IF_EXCEPTION(scope, nullptr); 169 structure = structureGlobalObject->asyncGeneratorFunctionStructure(); 170 break; 171 } 172 173 if (needsSubclassStructure) { 174 structure = InternalFunction::createSubclassStructure(globalObject, asObject(newTarget), structure); 175 RETURN_IF_EXCEPTION(scope, nullptr); 176 } 173 177 174 178 switch (functionConstructionMode) { 175 179 case FunctionConstructionMode::Function: 176 return JSFunction::create(vm, function, globalObject->globalScope(), s ubclassStructure);180 return JSFunction::create(vm, function, globalObject->globalScope(), structure); 177 181 case FunctionConstructionMode::Generator: 178 return JSGeneratorFunction::create(vm, function, globalObject->globalScope(), s ubclassStructure);182 return JSGeneratorFunction::create(vm, function, globalObject->globalScope(), structure); 179 183 case FunctionConstructionMode::Async: 180 return JSAsyncFunction::create(vm, function, globalObject->globalScope(), s ubclassStructure);184 return JSAsyncFunction::create(vm, function, globalObject->globalScope(), structure); 181 185 case FunctionConstructionMode::AsyncGenerator: 182 return JSAsyncGeneratorFunction::create(vm, function, globalObject->globalScope(), s ubclassStructure);186 return JSAsyncGeneratorFunction::create(vm, function, globalObject->globalScope(), structure); 183 187 } 184 188 -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r253932 r260732 25 25 26 26 #include "FunctionPrototype.h" 27 #include "JSBoundFunction.h" 28 #include "JSCInlines.h" 27 29 #include "JSGlobalObject.h" 28 30 #include "JSString.h" 29 #include " JSCInlines.h"31 #include "ProxyObject.h" 30 32 31 33 namespace JSC { … … 113 115 } 114 116 115 Structure* InternalFunction::createSubclassStructure Slow(JSGlobalObject* globalObject, JSValuenewTarget, Structure* baseClass)117 Structure* InternalFunction::createSubclassStructure(JSGlobalObject* globalObject, JSObject* newTarget, Structure* baseClass) 116 118 { 117 119 VM& vm = globalObject->vm(); … … 136 138 return rareData->createInternalFunctionAllocationStructureFromBase(vm, baseGlobalObject, prototype, baseClass); 137 139 } else { 138 JSValue prototypeValue = newTarget .get(globalObject, vm.propertyNames->prototype);140 JSValue prototypeValue = newTarget->get(globalObject, vm.propertyNames->prototype); 139 141 RETURN_IF_EXCEPTION(scope, nullptr); 140 142 if (JSObject* prototype = jsDynamicCast<JSObject*>(vm, prototypeValue)) { … … 148 150 } 149 151 152 // https://tc39.es/ecma262/#sec-getfunctionrealm 153 JSGlobalObject* getFunctionRealm(VM& vm, JSObject* object) 154 { 155 ASSERT(object->isFunction(vm)); 156 157 if (object->inherits<JSBoundFunction>(vm)) 158 return getFunctionRealm(vm, jsCast<JSBoundFunction*>(object)->targetFunction()); 159 160 if (object->type() == ProxyObjectType) { 161 auto* proxy = jsCast<ProxyObject*>(object); 162 // Per step 4.a, a TypeError should be thrown for revoked Proxy, yet we skip it since: 163 // a) It is barely observable anyway: "prototype" lookup in createSubclassStructure() will throw for revoked Proxy. 164 // b) Throwing getFunctionRealm() will restrict calling it inline as an argument of createSubclassStructure(). 165 // c) There is ongoing discussion on removing it: https://github.com/tc39/ecma262/issues/1798. 166 if (!proxy->isRevoked()) 167 return getFunctionRealm(vm, proxy->target()); 168 } 169 170 return object->globalObject(vm); 171 } 172 150 173 151 174 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/InternalFunction.h
r252875 r260732 58 58 } 59 59 60 static Structure* createSubclassStructure(JSGlobalObject*, JSObject* baseCallee, JSValuenewTarget, Structure*);60 JS_EXPORT_PRIVATE static Structure* createSubclassStructure(JSGlobalObject*, JSObject* newTarget, Structure*); 61 61 62 62 TaggedNativeFunction nativeFunctionFor(CodeSpecializationKind kind) … … 89 89 JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name, NameAdditionMode = NameAdditionMode::WithStructureTransition); 90 90 91 JS_EXPORT_PRIVATE static Structure* createSubclassStructureSlow(JSGlobalObject*, JSValue newTarget, Structure*);92 93 91 JS_EXPORT_PRIVATE static ConstructType getConstructData(JSCell*, ConstructData&); 94 92 JS_EXPORT_PRIVATE static CallType getCallData(JSCell*, CallData&); … … 100 98 }; 101 99 102 ALWAYS_INLINE Structure* InternalFunction::createSubclassStructure(JSGlobalObject* globalObject, JSObject* baseCallee, JSValue newTarget, Structure* baseClass) 103 { 104 // We allow newTarget == JSValue() because the API needs to be able to create classes without having a real JS frame. 105 // Since we don't allow subclassing in the API we just treat newTarget == JSValue() as newTarget == callFrame->jsCallee() 106 if (newTarget && newTarget != baseCallee) 107 return createSubclassStructureSlow(globalObject, newTarget, baseClass); 108 return baseClass; 109 } 100 JS_EXPORT_PRIVATE JSGlobalObject* getFunctionRealm(VM&, JSObject*); 110 101 111 102 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
r259767 r260732 92 92 // 2. Let collator be OrdinaryCreateFromConstructor(newTarget, %CollatorPrototype%). 93 93 // 3. ReturnIfAbrupt(collator). 94 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<IntlCollatorConstructor*>(callFrame->jsCallee())->collatorStructure(vm)); 95 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 94 JSObject* newTarget = asObject(callFrame->newTarget()); 95 Structure* structure = newTarget == callFrame->jsCallee() 96 ? globalObject->collatorStructure() 97 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->collatorStructure()); 98 RETURN_IF_EXCEPTION(scope, { }); 99 96 100 IntlCollator* collator = IntlCollator::create(vm, structure); 97 101 ASSERT(collator); … … 110 114 111 115 VM& vm = globalObject->vm(); 112 IntlCollatorConstructor* callee = jsCast<IntlCollatorConstructor*>(callFrame->jsCallee()); 113 114 // FIXME: Collator does not get the workaround for ECMA-402 1.0 compatibility. 116 // Collator does not require the workaround for ECMA-402 1.0 compatibility. 115 117 // https://bugs.webkit.org/show_bug.cgi?id=153679 116 118 117 119 // 2. Let collator be OrdinaryCreateFromConstructor(newTarget, %CollatorPrototype%). 118 120 // 3. ReturnIfAbrupt(collator). 119 IntlCollator* collator = IntlCollator::create(vm, callee->collatorStructure(vm));121 IntlCollator* collator = IntlCollator::create(vm, globalObject->collatorStructure()); 120 122 ASSERT(collator); 121 123 -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.h
r260415 r260732 44 44 DECLARE_INFO; 45 45 46 Structure* collatorStructure(VM&) const { return globalObject()->collatorStructure(); }47 48 46 private: 49 47 IntlCollatorConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
r259767 r260732 92 92 // 2. Let dateTimeFormat be OrdinaryCreateFromConstructor(newTarget, %DateTimeFormatPrototype%). 93 93 // 3. ReturnIfAbrupt(dateTimeFormat). 94 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<IntlDateTimeFormatConstructor*>(callFrame->jsCallee())->dateTimeFormatStructure(vm)); 95 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 94 JSObject* newTarget = asObject(callFrame->newTarget()); 95 Structure* structure = newTarget == callFrame->jsCallee() 96 ? globalObject->dateTimeFormatStructure() 97 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->dateTimeFormatStructure()); 98 RETURN_IF_EXCEPTION(scope, { }); 99 96 100 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, structure); 97 101 ASSERT(dateTimeFormat); … … 109 113 // NewTarget is always undefined when called as a function. 110 114 111 IntlDateTimeFormatConstructor* callee = jsCast<IntlDateTimeFormatConstructor*>(callFrame->jsCallee());112 113 115 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 114 116 // https://bugs.webkit.org/show_bug.cgi?id=153679 115 return JSValue::encode(constructIntlInstanceWithWorkaroundForLegacyIntlConstructor<IntlDateTimeFormat>(globalObject, callFrame->thisValue(), call ee, [&] (VM& vm) {117 return JSValue::encode(constructIntlInstanceWithWorkaroundForLegacyIntlConstructor<IntlDateTimeFormat>(globalObject, callFrame->thisValue(), callFrame->jsCallee(), [&] (VM& vm) { 116 118 // 2. Let dateTimeFormat be OrdinaryCreateFromConstructor(newTarget, %DateTimeFormatPrototype%). 117 119 // 3. ReturnIfAbrupt(dateTimeFormat). 118 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, callee->dateTimeFormatStructure(vm));120 IntlDateTimeFormat* dateTimeFormat = IntlDateTimeFormat::create(vm, globalObject->dateTimeFormatStructure()); 119 121 ASSERT(dateTimeFormat); 120 122 -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.h
r260415 r260732 44 44 DECLARE_INFO; 45 45 46 Structure* dateTimeFormatStructure(VM&) const { return globalObject()->dateTimeFormatStructure(); }47 48 46 private: 49 47 IntlDateTimeFormatConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
r259767 r260732 92 92 // 2. Let numberFormat be OrdinaryCreateFromConstructor(newTarget, %NumberFormatPrototype%). 93 93 // 3. ReturnIfAbrupt(numberFormat). 94 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<IntlNumberFormatConstructor*>(callFrame->jsCallee())->numberFormatStructure(vm)); 95 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 94 JSObject* newTarget = asObject(callFrame->newTarget()); 95 Structure* structure = newTarget == callFrame->jsCallee() 96 ? globalObject->numberFormatStructure() 97 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->numberFormatStructure()); 98 RETURN_IF_EXCEPTION(scope, { }); 99 96 100 IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, structure); 97 101 ASSERT(numberFormat); … … 109 113 // NewTarget is always undefined when called as a function. 110 114 111 IntlNumberFormatConstructor* callee = jsCast<IntlNumberFormatConstructor*>(callFrame->jsCallee());112 113 115 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 114 116 // https://bugs.webkit.org/show_bug.cgi?id=153679 115 return JSValue::encode(constructIntlInstanceWithWorkaroundForLegacyIntlConstructor<IntlNumberFormat>(globalObject, callFrame->thisValue(), call ee, [&] (VM& vm) {117 return JSValue::encode(constructIntlInstanceWithWorkaroundForLegacyIntlConstructor<IntlNumberFormat>(globalObject, callFrame->thisValue(), callFrame->jsCallee(), [&] (VM& vm) { 116 118 // 2. Let numberFormat be OrdinaryCreateFromConstructor(newTarget, %NumberFormatPrototype%). 117 119 // 3. ReturnIfAbrupt(numberFormat). 118 IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, callee->numberFormatStructure(vm));120 IntlNumberFormat* numberFormat = IntlNumberFormat::create(vm, globalObject->numberFormatStructure()); 119 121 ASSERT(numberFormat); 120 122 -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.h
r260415 r260732 44 44 DECLARE_INFO; 45 45 46 Structure* numberFormatStructure(VM&) const { return globalObject()->numberFormatStructure(); }47 48 46 private: 49 47 IntlNumberFormatConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/IntlPluralRulesConstructor.cpp
r259767 r260732 90 90 // 13.2.1 Intl.PluralRules ([ locales [ , options ] ]) 91 91 // https://tc39.github.io/ecma402/#sec-intl.pluralrules 92 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<IntlPluralRulesConstructor*>(callFrame->jsCallee())->pluralRulesStructure(vm)); 93 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 92 JSObject* newTarget = asObject(callFrame->newTarget()); 93 Structure* structure = newTarget == callFrame->jsCallee() 94 ? globalObject->pluralRulesStructure() 95 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->pluralRulesStructure()); 96 RETURN_IF_EXCEPTION(scope, { }); 97 94 98 IntlPluralRules* pluralRules = IntlPluralRules::create(vm, structure); 95 99 ASSERT(pluralRules); -
trunk/Source/JavaScriptCore/runtime/IntlPluralRulesConstructor.h
r260415 r260732 44 44 DECLARE_INFO; 45 45 46 Structure* pluralRulesStructure(VM&) const { return globalObject()->pluralRulesStructure(); }47 48 46 private: 49 47 IntlPluralRulesConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/IntlRelativeTimeFormatConstructor.cpp
r260349 r260732 88 88 auto scope = DECLARE_THROW_SCOPE(vm); 89 89 90 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<IntlRelativeTimeFormatConstructor*>(callFrame->jsCallee())->relativeTimeFormatStructure(vm)); 91 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 90 JSObject* newTarget = asObject(callFrame->newTarget()); 91 Structure* structure = newTarget == callFrame->jsCallee() 92 ? globalObject->relativeTimeFormatStructure() 93 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->relativeTimeFormatStructure()); 94 RETURN_IF_EXCEPTION(scope, { }); 95 92 96 IntlRelativeTimeFormat* relativeTimeFormat = IntlRelativeTimeFormat::create(vm, structure); 93 97 ASSERT(relativeTimeFormat); -
trunk/Source/JavaScriptCore/runtime/IntlRelativeTimeFormatConstructor.h
r260415 r260732 43 43 DECLARE_INFO; 44 44 45 Structure* relativeTimeFormatStructure(VM&) const { return globalObject()->relativeTimeFormatStructure(); }46 47 45 private: 48 46 IntlRelativeTimeFormatConstructor(VM&, Structure*); -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
r252520 r260732 80 80 auto scope = DECLARE_THROW_SCOPE(vm); 81 81 82 JSGenericArrayBufferConstructor* constructor = jsCast<JSGenericArrayBufferConstructor*>(callFrame->jsCallee()); 83 84 Structure* arrayBufferStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), constructor->globalObject()->arrayBufferStructure(sharingMode)); 82 JSObject* newTarget = asObject(callFrame->newTarget()); 83 Structure* arrayBufferStructure = newTarget == callFrame->jsCallee() 84 ? globalObject->arrayBufferStructure(sharingMode) 85 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->arrayBufferStructure(sharingMode)); 85 86 RETURN_IF_EXCEPTION(scope, { }); 86 87 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r259676 r260732 175 175 if (LIKELY(prototype.isObject())) 176 176 return asObject(prototype); 177 178 JSGlobalObject* thisGlobalObject = this->globalObject(); 179 if (!isHostOrBuiltinFunction()) { 180 // https://tc39.github.io/ecma262/#sec-generator-function-definitions-runtime-semantics-evaluatebody 181 if (isGeneratorWrapperParseMode(jsExecutable()->parseMode())) 182 return thisGlobalObject->generatorPrototype(); 183 184 // https://tc39.github.io/ecma262/#sec-asyncgenerator-definitions-evaluatebody 185 if (isAsyncGeneratorWrapperParseMode(jsExecutable()->parseMode())) 186 return thisGlobalObject->asyncGeneratorPrototype(); 187 } 188 return thisGlobalObject->objectPrototype(); 177 if (isHostOrBuiltinFunction()) 178 return this->globalObject()->objectPrototype(); 179 180 JSGlobalObject* scopeGlobalObject = this->scope()->globalObject(); 181 // https://tc39.github.io/ecma262/#sec-generator-function-definitions-runtime-semantics-evaluatebody 182 if (isGeneratorWrapperParseMode(jsExecutable()->parseMode())) 183 return scopeGlobalObject->generatorPrototype(); 184 // https://tc39.github.io/ecma262/#sec-asyncgenerator-definitions-evaluatebody 185 if (isAsyncGeneratorWrapperParseMode(jsExecutable()->parseMode())) 186 return scopeGlobalObject->asyncGeneratorPrototype(); 187 return scopeGlobalObject->objectPrototype(); 189 188 } 190 189 … … 461 460 PropertyOffset offset = thisObject->getDirectOffset(vm, propertyName, attributes); 462 461 if (!isValidOffset(offset)) { 462 JSGlobalObject* scopeGlobalObject = thisObject->scope()->globalObject(); 463 463 JSObject* prototype = nullptr; 464 464 if (isGeneratorWrapperParseMode(thisObject->jsExecutable()->parseMode())) { … … 466 466 // property does not have a constructor property whose value is the GeneratorFunction instance. 467 467 // https://tc39.github.io/ecma262/#sec-generatorfunction-instances-prototype 468 prototype = constructEmptyObject(globalObject, thisObject->globalObject()->generatorPrototype());468 prototype = constructEmptyObject(globalObject, scopeGlobalObject->generatorPrototype()); 469 469 } else if (isAsyncGeneratorWrapperParseMode(thisObject->jsExecutable()->parseMode())) 470 prototype = constructEmptyObject(globalObject, thisObject->globalObject()->asyncGeneratorPrototype());470 prototype = constructEmptyObject(globalObject, scopeGlobalObject->asyncGeneratorPrototype()); 471 471 else { 472 prototype = constructEmptyObject(globalObject );472 prototype = constructEmptyObject(globalObject, scopeGlobalObject->objectPrototype()); 473 473 prototype->putDirect(vm, vm.propertyNames->constructor, thisObject, static_cast<unsigned>(PropertyAttribute::DontEnum)); 474 474 } -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
r252520 r260732 212 212 auto scope = DECLARE_THROW_SCOPE(vm); 213 213 214 InternalFunction* function = jsCast<InternalFunction*>(callFrame->jsCallee()); 215 Structure* parentStructure = function->globalObject()->typedArrayStructure(ViewClass::TypedArrayStorageType); 216 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), parentStructure); 217 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 214 JSObject* newTarget = asObject(callFrame->newTarget()); 215 Structure* structure = newTarget == callFrame->jsCallee() 216 ? globalObject->typedArrayStructure(ViewClass::TypedArrayStorageType) 217 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->typedArrayStructure(ViewClass::TypedArrayStorageType)); 218 RETURN_IF_EXCEPTION(scope, { }); 218 219 219 220 size_t argCount = callFrame->argumentCount(); -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h
r252032 r260732 102 102 ALWAYS_INLINE Structure* JSGlobalObject::arrayStructureForIndexingTypeDuringAllocation(JSGlobalObject* globalObject, IndexingType indexingType, JSValue newTarget) const 103 103 { 104 return InternalFunction::createSubclassStructure(globalObject, globalObject->arrayConstructor(), newTarget, arrayStructureForIndexingTypeDuringAllocation(indexingType)); 104 return !newTarget || newTarget == globalObject->arrayConstructor() 105 ? globalObject->arrayStructureForIndexingTypeDuringAllocation(indexingType) 106 : InternalFunction::createSubclassStructure(globalObject, asObject(newTarget), getFunctionRealm(globalObject->vm(), asObject(newTarget))->arrayStructureForIndexingTypeDuringAllocation(indexingType)); 105 107 } 106 108 -
trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp
r252520 r260732 68 68 auto scope = DECLARE_THROW_SCOPE(vm); 69 69 70 Structure* mapStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->mapStructure()); 71 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 70 JSObject* newTarget = asObject(callFrame->newTarget()); 71 Structure* mapStructure = newTarget == callFrame->jsCallee() 72 ? globalObject->mapStructure() 73 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->mapStructure()); 74 RETURN_IF_EXCEPTION(scope, { }); 72 75 73 76 JSValue iterable = callFrame->argument(0); -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
r252520 r260732 56 56 auto scope = DECLARE_THROW_SCOPE(vm); 57 57 JSValue message = callFrame->argument(0); 58 Structure* errorStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), jsCast<NativeErrorConstructor*>(callFrame->jsCallee())->errorStructure(vm)); 59 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 58 59 JSObject* newTarget = asObject(callFrame->newTarget()); 60 Structure* errorStructure = newTarget == callFrame->jsCallee() 61 ? globalObject->errorStructure(errorType) 62 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->errorStructure(errorType)); 63 RETURN_IF_EXCEPTION(scope, { }); 60 64 ASSERT(errorStructure); 65 61 66 RELEASE_AND_RETURN(scope, JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, false))); 62 67 } … … 65 70 EncodedJSValue JSC_HOST_CALL NativeErrorConstructor<errorType>::callNativeErrorConstructor(JSGlobalObject* globalObject, CallFrame* callFrame) 66 71 { 67 VM& vm = globalObject->vm();68 72 JSValue message = callFrame->argument(0); 69 Structure* errorStructure = jsCast<NativeErrorConstructor*>(callFrame->jsCallee())->errorStructure(vm);73 Structure* errorStructure = globalObject->errorStructure(errorType); 70 74 return JSValue::encode(ErrorInstance::create(globalObject, errorStructure, message, nullptr, TypeNothing, false)); 71 75 } -
trunk/Source/JavaScriptCore/runtime/NativeErrorConstructor.h
r253019 r260732 60 60 return constructor; 61 61 } 62 63 Structure* errorStructure(VM&) { return globalObject()->errorStructure(errorType); }64 62 private: 65 63 static EncodedJSValue JSC_HOST_CALL callNativeErrorConstructor(JSGlobalObject*, CallFrame*); -
trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp
r252520 r260732 93 93 double n = callFrame->argumentCount() ? callFrame->uncheckedArgument(0).toNumber(globalObject) : 0; 94 94 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 95 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->numberObjectStructure()); 96 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 95 96 JSObject* newTarget = asObject(callFrame->newTarget()); 97 Structure* structure = newTarget == callFrame->jsCallee() 98 ? globalObject->numberObjectStructure() 99 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->numberObjectStructure()); 100 RETURN_IF_EXCEPTION(scope, { }); 97 101 98 102 NumberObject* object = NumberObject::create(vm, structure); -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r260722 r260732 127 127 if (newTarget && newTarget != objectConstructor) { 128 128 // a. Return ? OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%"). 129 Structure* objectStructure = InternalFunction::createSubclassStructure(globalObject, objectConstructor, newTarget, globalObject->objectStructureForObjectConstructor()); 129 Structure* baseStructure = getFunctionRealm(vm, asObject(newTarget))->objectStructureForObjectConstructor(); 130 Structure* objectStructure = InternalFunction::createSubclassStructure(globalObject, asObject(newTarget), baseStructure); 130 131 RETURN_IF_EXCEPTION(scope, nullptr); 131 132 return constructEmptyObject(vm, objectStructure); -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r252520 r260732 173 173 inline Structure* getRegExpStructure(JSGlobalObject* globalObject, JSValue newTarget) 174 174 { 175 Structure* structure = globalObject->regExpStructure(); 176 if (newTarget != jsUndefined()) 177 structure = InternalFunction::createSubclassStructure(globalObject, globalObject->regExpConstructor(), newTarget, structure); 178 return structure; 175 return !newTarget || newTarget == globalObject->regExpConstructor() 176 ? globalObject->regExpStructure() 177 : InternalFunction::createSubclassStructure(globalObject, asObject(newTarget), getFunctionRealm(globalObject->vm(), asObject(newTarget))->regExpStructure()); 179 178 } 180 179 … … 230 229 RETURN_IF_EXCEPTION(scope, nullptr); 231 230 232 if ( newTarget.isUndefined()&& constructAsRegexp && flagsArg.isUndefined()) {231 if (!newTarget && constructAsRegexp && flagsArg.isUndefined()) { 233 232 JSValue constructor = patternArg.get(globalObject, vm.propertyNames->constructor); 234 233 RETURN_IF_EXCEPTION(scope, nullptr); … … 275 274 JSValue patternArg = callFrame->argument(0); 276 275 JSValue flagsArg = callFrame->argument(1); 277 return JSValue::encode(regExpCreate(globalObject, jsUndefined(), patternArg, flagsArg));276 return JSValue::encode(regExpCreate(globalObject, JSValue(), patternArg, flagsArg)); 278 277 } 279 278 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.h
r260415 r260732 56 56 STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(RegExpConstructor, InternalFunction); 57 57 58 JSObject* constructRegExp(JSGlobalObject*, const ArgList&, JSObject* callee = nullptr, JSValue newTarget = jsUndefined());58 JSObject* constructRegExp(JSGlobalObject*, const ArgList&, JSObject* callee = nullptr, JSValue newTarget = JSValue()); 59 59 60 60 ALWAYS_INLINE bool isRegExp(VM& vm, JSGlobalObject* globalObject, JSValue value) -
trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp
r252520 r260732 68 68 auto scope = DECLARE_THROW_SCOPE(vm); 69 69 70 Structure* setStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->setStructure()); 71 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 70 JSObject* newTarget = asObject(callFrame->newTarget()); 71 Structure* setStructure = newTarget == callFrame->jsCallee() 72 ? globalObject->setStructure() 73 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->setStructure()); 74 RETURN_IF_EXCEPTION(scope, { }); 72 75 73 76 JSValue iterable = callFrame->argument(0); -
trunk/Source/JavaScriptCore/runtime/StringConstructor.cpp
r252520 r260732 145 145 auto scope = DECLARE_THROW_SCOPE(vm); 146 146 147 Structure* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->stringObjectStructure()); 148 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 147 JSObject* newTarget = asObject(callFrame->newTarget()); 148 Structure* structure = newTarget == callFrame->jsCallee() 149 ? globalObject->stringObjectStructure() 150 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->stringObjectStructure()); 151 RETURN_IF_EXCEPTION(scope, { }); 149 152 150 153 if (!callFrame->argumentCount()) -
trunk/Source/JavaScriptCore/runtime/WeakMapConstructor.cpp
r252520 r260732 66 66 auto scope = DECLARE_THROW_SCOPE(vm); 67 67 68 Structure* weakMapStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->weakMapStructure()); 69 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 68 JSObject* newTarget = asObject(callFrame->newTarget()); 69 Structure* weakMapStructure = newTarget == callFrame->jsCallee() 70 ? globalObject->weakMapStructure() 71 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->weakMapStructure()); 72 RETURN_IF_EXCEPTION(scope, { }); 73 70 74 JSWeakMap* weakMap = JSWeakMap::create(vm, weakMapStructure); 71 75 JSValue iterable = callFrame->argument(0); -
trunk/Source/JavaScriptCore/runtime/WeakObjectRefConstructor.cpp
r252520 r260732 69 69 return throwVMTypeError(globalObject, scope, "First argument to WeakRef should be an object"_s); 70 70 71 Structure* WeakObjectRefStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->weakObjectRefStructure()); 72 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 73 RELEASE_AND_RETURN(scope, JSValue::encode(JSWeakObjectRef::create(vm, WeakObjectRefStructure, callFrame->uncheckedArgument(0).getObject()))); 71 JSObject* newTarget = asObject(callFrame->newTarget()); 72 Structure* weakObjectRefStructure = newTarget == callFrame->jsCallee() 73 ? globalObject->weakObjectRefStructure() 74 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->weakObjectRefStructure()); 75 RETURN_IF_EXCEPTION(scope, { }); 76 77 RELEASE_AND_RETURN(scope, JSValue::encode(JSWeakObjectRef::create(vm, weakObjectRefStructure, callFrame->uncheckedArgument(0).getObject()))); 74 78 } 75 79 -
trunk/Source/JavaScriptCore/runtime/WeakSetConstructor.cpp
r252520 r260732 66 66 auto scope = DECLARE_THROW_SCOPE(vm); 67 67 68 Structure* weakSetStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->weakSetStructure()); 69 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 68 JSObject* newTarget = asObject(callFrame->newTarget()); 69 Structure* weakSetStructure = newTarget == callFrame->jsCallee() 70 ? globalObject->weakSetStructure() 71 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->weakSetStructure()); 72 RETURN_IF_EXCEPTION(scope, { }); 73 70 74 JSWeakSet* weakSet = JSWeakSet::create(vm, weakSetStructure); 71 75 JSValue iterable = callFrame->argument(0); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyCompileErrorConstructor.cpp
r252520 r260732 50 50 auto scope = DECLARE_THROW_SCOPE(vm); 51 51 JSValue message = callFrame->argument(0); 52 auto* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->webAssemblyCompileErrorStructure()); 53 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 52 53 JSObject* newTarget = asObject(callFrame->newTarget()); 54 Structure* structure = newTarget == callFrame->jsCallee() 55 ? globalObject->webAssemblyCompileErrorStructure() 56 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->webAssemblyCompileErrorStructure()); 57 RETURN_IF_EXCEPTION(scope, { }); 58 54 59 RELEASE_AND_RETURN(scope, JSValue::encode(JSWebAssemblyCompileError::create(globalObject, vm, structure, message))); 55 60 } -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp
r253140 r260732 75 75 if (!importArgument.isUndefined() && !importObject) 76 76 return JSValue::encode(throwException(globalObject, scope, createTypeError(globalObject, "second argument to WebAssembly.Instance must be undefined or an Object"_s, defaultSourceAppender, runtimeTypeForValue(vm, importArgument)))); 77 78 Structure* instanceStructure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->webAssemblyInstanceStructure()); 77 78 JSObject* newTarget = asObject(callFrame->newTarget()); 79 Structure* instanceStructure = newTarget == callFrame->jsCallee() 80 ? globalObject->webAssemblyInstanceStructure() 81 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->webAssemblyInstanceStructure()); 79 82 RETURN_IF_EXCEPTION(scope, { }); 80 83 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyLinkErrorConstructor.cpp
r252520 r260732 50 50 auto scope = DECLARE_THROW_SCOPE(vm); 51 51 JSValue message = callFrame->argument(0); 52 auto* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->webAssemblyLinkErrorStructure()); 53 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 52 53 JSObject* newTarget = asObject(callFrame->newTarget()); 54 Structure* structure = newTarget == callFrame->jsCallee() 55 ? globalObject->webAssemblyLinkErrorStructure() 56 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->webAssemblyLinkErrorStructure()); 57 RETURN_IF_EXCEPTION(scope, { }); 58 54 59 RELEASE_AND_RETURN(scope, JSValue::encode(JSWebAssemblyLinkError::create(globalObject, vm, structure, message))); 55 60 } -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
r252520 r260732 182 182 auto scope = DECLARE_THROW_SCOPE(vm); 183 183 184 auto* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->webAssemblyModuleStructure()); 184 JSObject* newTarget = asObject(callFrame->newTarget()); 185 Structure* structure = newTarget == callFrame->jsCallee() 186 ? globalObject->webAssemblyModuleStructure() 187 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->webAssemblyModuleStructure()); 185 188 RETURN_IF_EXCEPTION(scope, nullptr); 186 189 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyRuntimeErrorConstructor.cpp
r252520 r260732 52 52 String messageString = message.isUndefined() ? String() : message.toWTFString(globalObject); 53 53 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 54 auto* structure = InternalFunction::createSubclassStructure(globalObject, callFrame->jsCallee(), callFrame->newTarget(), globalObject->webAssemblyRuntimeErrorStructure()); 55 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 54 55 JSObject* newTarget = asObject(callFrame->newTarget()); 56 Structure* structure = newTarget == callFrame->jsCallee() 57 ? globalObject->webAssemblyRuntimeErrorStructure() 58 : InternalFunction::createSubclassStructure(globalObject, newTarget, getFunctionRealm(vm, newTarget)->webAssemblyRuntimeErrorStructure()); 59 RETURN_IF_EXCEPTION(scope, { }); 60 56 61 return JSValue::encode(JSWebAssemblyRuntimeError::create(globalObject, vm, structure, WTFMove(messageString))); 57 62 } -
trunk/Source/WebCore/ChangeLog
r260731 r260732 1 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 InternalFunction::createSubclassStructure should use newTarget's globalObject 4 https://bugs.webkit.org/show_bug.cgi?id=202599 5 6 Reviewed by Yusuke Suzuki. 7 8 Accounts for InternalFunction::createSubclassStructure() signature change and 9 utilizes getFunctionRealm() helper to handle cross-realm JSBoundFunction and 10 ProxyObject instances as NewTarget value. 11 12 Tests: web-platform-tests/WebIDL/ecmascript-binding/constructors.html 13 web-platform-tests/custom-elements/htmlconstructor/newtarget.html 14 15 * bindings/js/JSDOMWrapperCache.h: 16 (WebCore::setSubclassStructureIfNeeded): 17 * bindings/js/JSHTMLElementCustom.cpp: 18 (WebCore::constructJSHTMLElement): 19 1 20 2020-04-26 Yusuke Suzuki <ysuzuki@apple.com> 2 21 -
trunk/Source/WebCore/bindings/js/JSDOMWrapperCache.h
r256716 r260732 214 214 auto scope = DECLARE_THROW_SCOPE(vm); 215 215 216 auto* newTargetGlobalObject = JSC::jsCast<JSDOMGlobalObject*>( newTarget->globalObject(vm));216 auto* newTargetGlobalObject = JSC::jsCast<JSDOMGlobalObject*>(JSC::getFunctionRealm(vm, newTarget)); 217 217 auto* baseStructure = getDOMStructure<WrapperClass>(vm, *newTargetGlobalObject); 218 auto* subclassStructure = JSC::InternalFunction::createSubclassStructure(lexicalGlobalObject, constructor,newTarget, baseStructure);218 auto* subclassStructure = JSC::InternalFunction::createSubclassStructure(lexicalGlobalObject, newTarget, baseStructure); 219 219 RETURN_IF_EXCEPTION(scope, void()); 220 220 jsObject->setStructure(vm, subclassStructure); -
trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
r251425 r260732 55 55 ASSERT(context->isDocument()); 56 56 57 JSValue newTargetValue = callFrame.thisValue(); 58 auto* newTarget = newTargetValue.getObject(); 59 auto* newTargetGlobalObject = jsCast<JSDOMGlobalObject*>(newTarget->globalObject(vm)); 57 auto* newTarget = callFrame.newTarget().getObject(); 58 auto* newTargetGlobalObject = jsCast<JSDOMGlobalObject*>(getFunctionRealm(vm, newTarget)); 60 59 JSValue htmlElementConstructorValue = JSHTMLElement::getConstructor(vm, newTargetGlobalObject); 61 if (newTarget Value== htmlElementConstructorValue)60 if (newTarget == htmlElementConstructorValue) 62 61 return throwVMTypeError(lexicalGlobalObject, scope, "new.target is not a valid custom element constructor"_s); 63 62 … … 78 77 if (!elementInterface->isUpgradingElement()) { 79 78 Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *newTargetGlobalObject); 80 auto* newElementStructure = InternalFunction::createSubclassStructure(lexicalGlobalObject, jsConstructor, newTargetValue, baseStructure);81 RETURN_IF_EXCEPTION(scope, encodedJSValue());79 auto* newElementStructure = InternalFunction::createSubclassStructure(lexicalGlobalObject, newTarget, baseStructure); 80 RETURN_IF_EXCEPTION(scope, { }); 82 81 83 82 Ref<HTMLElement> element = HTMLElement::create(elementInterface->name(), document);
Note: See TracChangeset
for help on using the changeset viewer.