diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 5661102668a5..ec13744c29eb 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -326817,11 +326817,6 @@ {} ] ], - "wasm/jsapi/wasm-constants.js": [ - [ - {} - ] - ], "wasm/jsapi/wasm-module-builder.js": [ [ {} @@ -359772,6 +359767,12 @@ {} ] ], + "css/css-tables/border-spacing-included-in-sizes-001.tentative.html": [ + [ + "css/css-tables/border-spacing-included-in-sizes-001.tentative.html", + {} + ] + ], "css/css-tables/bounding-box-computation-1.html": [ [ "css/css-tables/bounding-box-computation-1.html", @@ -370691,6 +370692,12 @@ } ] ], + "element-timing/background-image-data-uri.html": [ + [ + "element-timing/background-image-data-uri.html", + {} + ] + ], "element-timing/background-image-multiple-elements.html": [ [ "element-timing/background-image-multiple-elements.html", @@ -370739,6 +370746,12 @@ {} ] ], + "element-timing/image-data-uri.html": [ + [ + "element-timing/image-data-uri.html", + {} + ] + ], "element-timing/image-not-fully-visible.html": [ [ "element-timing/image-not-fully-visible.html", @@ -438448,10 +438461,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438468,10 +438477,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438487,10 +438492,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438508,10 +438509,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438532,10 +438529,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438555,10 +438548,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438580,10 +438569,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438608,10 +438593,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438635,10 +438616,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438664,10 +438641,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438684,10 +438657,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438703,10 +438672,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438920,10 +438885,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438944,10 +438905,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438967,10 +438924,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -438992,10 +438945,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439020,10 +438969,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439047,10 +438992,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439076,10 +439017,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439096,10 +439033,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439115,10 +439048,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439136,10 +439065,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439156,10 +439081,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439175,10 +439096,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439400,10 +439317,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439424,10 +439337,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439447,10 +439356,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439472,10 +439377,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439492,10 +439393,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439511,10 +439408,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439532,10 +439425,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439552,10 +439441,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439571,10 +439456,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439592,10 +439473,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439612,10 +439489,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439631,10 +439504,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439652,10 +439521,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439672,10 +439537,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439691,10 +439552,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439760,10 +439617,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439784,10 +439637,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -439807,10 +439656,6 @@ "global", "jsshell" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440094,10 +439939,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440113,10 +439954,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440132,10 +439969,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440151,10 +439984,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440312,10 +440141,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440335,10 +440160,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440358,10 +440179,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440381,10 +440198,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440406,10 +440219,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440433,10 +440242,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440460,10 +440265,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440487,10 +440288,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440562,10 +440359,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440581,10 +440374,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440600,10 +440389,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -440619,10 +440404,6 @@ "global", "window,worker" ], - [ - "script", - "/wasm/jsapi/wasm-constants.js" - ], [ "script", "/wasm/jsapi/wasm-module-builder.js" @@ -486062,7 +485843,7 @@ "support" ], "common/security-features/resources/common.js": [ - "8b9bd0d0372a0814a6e5785abc64a26763d35edc", + "b18097b1ec2e252a59ec075d0f2c158798e38d08", "support" ], "common/security-features/subresource/__init__.py": [ @@ -578518,7 +578299,7 @@ "reftest" ], "css/css-flexbox/flex-vertical-align-effect.html": [ - "e7d94d00e19d3de268089e4af4387d02c3a5384c", + "8ec6025468997a484950bc7d5d20c3e3bd3cdbe6", "reftest" ], "css/css-flexbox/flex-wrap-001.htm": [ @@ -601989,6 +601770,10 @@ "7248befef57932b2d849630637051e02b480a361", "reftest" ], + "css/css-tables/border-spacing-included-in-sizes-001.tentative.html": [ + "b65e29ed27cc72b2662e919d198790cc84a6bc5e", + "testharness" + ], "css/css-tables/bounding-box-computation-1.html": [ "4173f399bd7cfec93733552fb85890231d8da9c9", "testharness" @@ -640886,7 +640671,7 @@ "support" ], "docs/_writing-tests/testharness.md": [ - "c19fe0ee881bb0517ef0617e6412ee6025a5079f", + "a584e6acd04685dd88fd6f22419afdd9e57c29b5", "support" ], "docs/_writing-tests/visual.md": [ @@ -643261,6 +643046,10 @@ "7cd0be939f16e8aea7b00ff2b13a06102e26cc4d", "testharness" ], + "element-timing/background-image-data-uri.html": [ + "696f34ff14e8bad8ec68a8687cdbf0949ef6fdef", + "testharness" + ], "element-timing/background-image-multiple-elements.html": [ "669f94d6b0189ba387cf90c1b49c7d4120319673", "testharness" @@ -643293,6 +643082,10 @@ "36cf1b15e0df0f99b8312ef56cde211f7c1358dd", "testharness" ], + "element-timing/image-data-uri.html": [ + "22ff91189b1370b703f89f55d83cde014b6d367d", + "testharness" + ], "element-timing/image-not-fully-visible.html": [ "279fa03cc2b42029ed01a68f670829c13b282a5c", "testharness" @@ -643362,7 +643155,7 @@ "support" ], "element-timing/resources/element-timing-helpers.js": [ - "66605df824bb5b9687f6f3611c0041714b8e9c01", + "b0ddf308df2514bed7c14c3d83382afbc1ad0a21", "support" ], "element-timing/resources/iframe-with-square-sends-entry.html": [ @@ -672710,7 +672503,7 @@ "testharness" ], "mixed-content/generic/mixed-content-test-case.js": [ - "a50b61c7e76503abe001ddc714da81036b6c254a", + "e7b0baaaafa357bef3b3d90fa4c14ae669ccbd91", "support" ], "mixed-content/generic/sanity-checker.js": [ @@ -683314,7 +683107,7 @@ "testharness" ], "portals/portals-adopt-predecessor.html": [ - "63a6d75dc42ef552c237a5c092e3a8c702bd27a8", + "99c44f0bfc3c841cd61e6f3f8f7cdfc2a2d8595e", "testharness" ], "portals/portals-create-orphaned.html": [ @@ -683438,11 +683231,11 @@ "support" ], "portals/resources/portals-adopt-predecessor-portal.html": [ - "7b4c86d75bc28452f9e9dba0b8396d67b7696c8b", + "96de3b7e4a403f533f56e057105aca1de6b41109", "support" ], "portals/resources/portals-adopt-predecessor.html": [ - "5ba0b864d0e3eb544f2ddbdedf95eba728e0ab4b", + "b92ad8a17c19cd7cb159880156a25ec5b71371eb", "support" ], "portals/resources/portals-nested-1.html": [ @@ -684242,7 +684035,7 @@ "support" ], "referrer-policy/generic/referrer-policy-test-case.js": [ - "6b5ae7f70f1441038f61b26bc2b29d7cdfe78f4e", + "6d570f1dc0fdb4d2973a8b8534897859ea2ab843", "support" ], "referrer-policy/generic/sandboxed-iframe-with-opaque-origin.html": [ @@ -704710,7 +704503,7 @@ "support" ], "tools/manifest/download.py": [ - "2e505f371ed882dc329409cc24de97b9a923bd31", + "e8f27e7ac100dad8d587a91d67e9a5f2ff0c3433", "support" ], "tools/manifest/item.py": [ @@ -704762,7 +704555,7 @@ "support" ], "tools/manifest/vcs.py": [ - "676e53f678546d52d74df790ea5c4ddf5bb9b832", + "cfb0ff27c364a5a66f85c264bbb4978ae56d9b5b", "support" ], "tools/py27-flake8.ini": [ @@ -709214,7 +709007,7 @@ "support" ], "tools/wpt/commands.json": [ - "161a9defbd1400c69985e031e2edfc4800929359", + "da8804d0607b2ead0bb83e1a38b9633ba7d657f9", "support" ], "tools/wpt/create.py": [ @@ -709534,7 +709327,7 @@ "support" ], "tools/wptrunner/wptrunner/browsers/firefox.py": [ - "1d2286e614f0c3eb2573c8cba131ff16120a5b51", + "22d9c25d12e4d212945aceb3fce87c28dfd09402", "support" ], "tools/wptrunner/wptrunner/browsers/ie.py": [ @@ -709854,11 +709647,11 @@ "support" ], "tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py": [ - "7ad35756d0c6c34282f3d1a278a40b98a882ae9d", + "5719a859fa4bc7e4ab4d1e9329ca74b2af6666f7", "support" ], "tools/wptrunner/wptrunner/wptmanifest/backends/static.py": [ - "b3cbedc3818ee8f04fb69d909f2d8d19c3a5f594", + "7b4f5613c384929cfd48196f4412ffc9d1824e88", "support" ], "tools/wptrunner/wptrunner/wptmanifest/node.py": [ @@ -711102,7 +710895,7 @@ "support" ], "upgrade-insecure-requests/support/testharness-helper.sub.js": [ - "2c854534d56f5cf3d17660b582156c7f8de4e1cd", + "f578e8987a1be5f34fc1fd8b8d8bcc026db4eed7", "support" ], "upgrade-insecure-requests/websocket-upgrade.https.html": [ @@ -712606,19 +712399,19 @@ "support" ], "wasm/jsapi/constructor/compile.any.js": [ - "1442cfccdf1b9c6aaeda2c1fa5af30ff0c89ea09", + "2faa5891c7ba50b6db36e2636d9518aebdc92e5c", "testharness" ], "wasm/jsapi/constructor/instantiate-bad-imports.any.js": [ - "86700298dfae66de6f4d026baa29e6e3584320f7", + "1eaefdfba26c3cff5f0320767e6872ded568c862", "testharness" ], "wasm/jsapi/constructor/instantiate.any.js": [ - "356f87d02d34b0483944f993146927985e5867f6", + "ae8f5ab688a40cea98a48b5ef0d9ecccf61ccf10", "testharness" ], "wasm/jsapi/constructor/validate.any.js": [ - "c8613cbd9b3a467a919d87d3244c4f508dce6317", + "57fa3359770f2c1be7d20186c5ecb8564f72a132", "testharness" ], "wasm/jsapi/global/constructor.any.js": [ @@ -712630,7 +712423,7 @@ "testharness" ], "wasm/jsapi/global/value-get-set.any.js": [ - "6de62d5f58362bab593ae7eb453fa14c1424cf2c", + "7b45ddc20b273f55a7bf1a83de03373100c736e3", "testharness" ], "wasm/jsapi/global/valueOf.any.js": [ @@ -712642,23 +712435,23 @@ "testharness" ], "wasm/jsapi/instance/constructor-bad-imports.any.js": [ - "24c51c10dc5df9d52c06bfb0715e435b17f24f7a", + "b90ada25286901d9fea6a5d1e28a8c8d1b796677", "testharness" ], "wasm/jsapi/instance/constructor.any.js": [ - "e6a0450202e94baa82eb4797fed6a7c248ed00a7", + "1ce4de904e16da04b68137fbcdf71a49c402204b", "testharness" ], "wasm/jsapi/instance/exports.any.js": [ - "cad468660e099b33f0a03b83a09df0498d67a7e0", + "2ba57c5e2fd99c37b866771c573133be97f3a5d0", "testharness" ], "wasm/jsapi/instance/toString.any.js": [ - "08dcb14a50d04f6db196626ddb93f2b50da8f055", + "ccd665eb285379d1c4de00ae19a8dc3693b22d40", "testharness" ], "wasm/jsapi/instanceTestFactory.js": [ - "cb720ceb7095b2fbdd40c6f7385770fee9195ab3", + "7ccf06c234a7ce5c17353f3bd74565b66c289952", "support" ], "wasm/jsapi/interface.any.js": [ @@ -712682,23 +712475,23 @@ "testharness" ], "wasm/jsapi/module/constructor.any.js": [ - "2127e2810cb8d43f1e2e06d3c1e27b9fc664c764", + "03e508aa1e0f10e7476d74c642153470f18a73f7", "testharness" ], "wasm/jsapi/module/customSections.any.js": [ - "387d4e4a31744d16627484650a35ecc86f992c66", + "8e9732e5512d3295c445c110e949905cec0efbe6", "testharness" ], "wasm/jsapi/module/exports.any.js": [ - "4437daa052fad56e66b7bf9991c5f045689564e3", + "eadfc84f1e4e774202c96667e9a6e162359d967e", "testharness" ], "wasm/jsapi/module/imports.any.js": [ - "b3bb8598b080c376f4de1294780e6072eac2b354", + "9d7ef2f0a9b90a69f40cc29a82193efb7ce5aae8", "testharness" ], "wasm/jsapi/module/toString.any.js": [ - "d9231a132ca8bf965f69c3cc81070a2ffe179efa", + "2db2002ffd2ea51a8684e4b52c24b8b18010f0cd", "testharness" ], "wasm/jsapi/table/assertions.js": [ @@ -712710,7 +712503,7 @@ "testharness" ], "wasm/jsapi/table/get-set.any.js": [ - "ce9681142012bdbaf7e041607177f6deff425f9a", + "bd053b389c904ed9b2587ad2817650d31fde7504", "testharness" ], "wasm/jsapi/table/grow.any.js": [ @@ -712725,12 +712518,8 @@ "e576477910ad3198b446b4addf89ba9a571d020b", "testharness" ], - "wasm/jsapi/wasm-constants.js": [ - "e3846386b8dccada9c24da194950627f4c39836f", - "support" - ], "wasm/jsapi/wasm-module-builder.js": [ - "d7dd08b2a603024e7fd002d2cc229a79726f1b06", + "a937eed4c6223ea8554e1f55ffbf8aca6c543404", "support" ], "wasm/resources/load_wasm.js": [ @@ -712882,7 +712671,7 @@ "testharness" ], "wasm/webapi/body.any.js": [ - "65cb78e7503cbcb6177d18dafb8d37027b18e54b", + "58f75b86e5784e08fe521bdca2966c6090a32199", "testharness" ], "wasm/webapi/contenttype.any.js": [ @@ -712898,11 +712687,11 @@ "testharness" ], "wasm/webapi/instantiateStreaming-bad-imports.any.js": [ - "b1efba31e9192654f2790edf3c5c391bb812a9eb", + "9556247e75f441a1ee0ee6d349447899736a73a2", "testharness" ], "wasm/webapi/instantiateStreaming.any.js": [ - "daec185484fbab675d226c52e7548b065bd9e701", + "cf3a5e7331f30ed05f96b26d7a913bebe2d827ac", "testharness" ], "wasm/webapi/invalid-args.any.js": [ @@ -712910,7 +712699,7 @@ "testharness" ], "wasm/webapi/invalid-code.any.js": [ - "e30b7cf339458ea57b38d81ea5feaf00ca5c78fc", + "522f4233f57b08cc8c2ba2883cd38ff179319139", "testharness" ], "wasm/webapi/origin.sub.any.js": [ diff --git a/tests/wpt/metadata/css/css-fonts/variations/at-font-face-font-matching.html.ini b/tests/wpt/metadata/css/css-fonts/variations/at-font-face-font-matching.html.ini index 666f18a1a159..9721e5821307 100644 --- a/tests/wpt/metadata/css/css-fonts/variations/at-font-face-font-matching.html.ini +++ b/tests/wpt/metadata/css/css-fonts/variations/at-font-face-font-matching.html.ini @@ -41,9 +41,6 @@ [Matching font-weight: '399' should prefer '400' over '450 460'] expected: FAIL - [Matching font-style: 'normal' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'] - expected: FAIL - [Matching font-style: 'italic' should prefer 'italic' over 'oblique 20deg'] expected: FAIL @@ -56,9 +53,6 @@ [Matching font-style: 'italic' should prefer 'oblique -60deg -30deg' over 'oblique -50deg -40deg'] expected: FAIL - [Matching font-style: 'oblique 21deg' should prefer 'oblique 20deg' over 'oblique 10deg'] - expected: FAIL - [Matching font-style: 'oblique 21deg' should prefer 'oblique 10deg' over 'italic'] expected: FAIL @@ -158,9 +152,6 @@ [Matching font-weight: '430' should prefer '501 550' over '502 560'] expected: FAIL - [Matching font-weight: '500' should prefer '350 399' over '351 398'] - expected: FAIL - [Matching font-style: 'oblique -20deg' should prefer 'oblique -60deg -40deg' over 'oblique -10deg'] expected: FAIL @@ -179,9 +170,6 @@ [Matching font-style: 'oblique 10deg' should prefer 'oblique 10deg' over 'oblique 5deg'] expected: FAIL - [Matching font-weight: '500' should prefer '400' over '350 399'] - expected: FAIL - [Matching font-style: 'oblique -21deg' should prefer 'oblique -60deg -40deg' over 'oblique -10deg'] expected: FAIL @@ -239,24 +227,15 @@ [Matching font-style: 'oblique 10deg' should prefer 'italic' over 'oblique 0deg'] expected: FAIL - [Matching font-style: 'oblique 10deg' should prefer 'oblique 5deg' over 'oblique 15deg 20deg'] - expected: FAIL - [Matching font-style: 'italic' should prefer 'oblique 20deg' over 'oblique 30deg 60deg'] expected: FAIL [Matching font-style: 'oblique 10deg' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'] expected: FAIL - [Matching font-weight: '399' should prefer '500 501' over '502 510'] - expected: FAIL - [Matching font-stretch: '100%' should prefer '100%' over '110% 120%'] expected: FAIL - [Matching font-style: 'oblique -10deg' should prefer 'oblique -50deg -40deg' over 'italic'] - expected: FAIL - [Matching font-weight: '399' should prefer '340 360' over '200 300'] expected: FAIL diff --git a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini index 82ca2d76f934..7b2de98b3717 100644 --- a/tests/wpt/metadata/encoding/single-byte-decoder.html.ini +++ b/tests/wpt/metadata/encoding/single-byte-decoder.html.ini @@ -32,7 +32,7 @@ [single-byte-decoder.html?XMLHttpRequest] - expected: TIMEOUT + expected: CRASH [ISO-8859-2: iso_8859-2:1987 (XMLHttpRequest)] expected: FAIL diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini new file mode 100644 index 000000000000..87b07c3e6704 --- /dev/null +++ b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_1.html.ini @@ -0,0 +1,4 @@ +[traverse_the_history_1.html] + [Multiple history traversals from the same task] + expected: FAIL + diff --git a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_4.html.ini b/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_4.html.ini deleted file mode 100644 index 385376c7321e..000000000000 --- a/tests/wpt/metadata/html/browsers/history/the-history-interface/traverse_the_history_4.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[traverse_the_history_4.html] - [Multiple history traversals, last would be aborted] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/the-window-object/closed-attribute.window.js.ini b/tests/wpt/metadata/html/browsers/the-window-object/closed-attribute.window.js.ini index 0a61dc7e11ee..ede7a979848d 100644 --- a/tests/wpt/metadata/html/browsers/the-window-object/closed-attribute.window.js.ini +++ b/tests/wpt/metadata/html/browsers/the-window-object/closed-attribute.window.js.ini @@ -1,4 +1,5 @@ [closed-attribute.window.html] + expected: CRASH [closed and cross-site nested browsing context] expected: FAIL diff --git a/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html.ini b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html.ini new file mode 100644 index 000000000000..6cf9d13975c8 --- /dev/null +++ b/tests/wpt/metadata/html/webappapis/dynamic-markup-insertion/document-write/iframe_005.html.ini @@ -0,0 +1,4 @@ +[iframe_005.html] + [document.write external script into iframe write back into parent] + expected: FAIL + diff --git a/tests/wpt/metadata/wasm/jsapi/global/value-get-set.any.js.ini b/tests/wpt/metadata/wasm/jsapi/global/value-get-set.any.js.ini index 096f6b3aec23..cf786304cc47 100644 --- a/tests/wpt/metadata/wasm/jsapi/global/value-get-set.any.js.ini +++ b/tests/wpt/metadata/wasm/jsapi/global/value-get-set.any.js.ini @@ -101,6 +101,63 @@ [Immutable f32 (undefined)] expected: FAIL + [Immutable i32 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (false)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (false)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (null)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (false)] + expected: FAIL + + [i64 with ToNumber side-effects] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (null)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (null)] + expected: FAIL + [value-get-set.any.html] [Mutable f64 (true on prototype)] @@ -205,3 +262,60 @@ [Immutable f32 (undefined)] expected: FAIL + [Immutable i32 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (false)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (false)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (null)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (zero)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (undefined)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (false)] + expected: FAIL + + [i64 with ToNumber side-effects] + expected: FAIL + + [Immutable i32 with ToNumber side-effects (empty string)] + expected: FAIL + + [Immutable f32 with ToNumber side-effects (null)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (missing)] + expected: FAIL + + [Immutable f64 with ToNumber side-effects (null)] + expected: FAIL + diff --git a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini index a56bad443a2d..66bd350083b0 100644 --- a/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini +++ b/tests/wpt/metadata/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html.ini @@ -1,5 +1,4 @@ [realtimeanalyser-fft-scaling.html] - expected: TIMEOUT [X 2048-point FFT peak position is not equal to 64. Got 0.] expected: FAIL diff --git a/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini b/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini new file mode 100644 index 000000000000..dbea4f293ad0 --- /dev/null +++ b/tests/wpt/mozilla/meta/css/transition_calc_implicit.html.ini @@ -0,0 +1,2 @@ +[transition_calc_implicit.html] + expected: TIMEOUT diff --git a/tests/wpt/web-platform-tests/common/security-features/resources/common.js b/tests/wpt/web-platform-tests/common/security-features/resources/common.js index 8b9bd0d0372a..b18097b1ec2e 100644 --- a/tests/wpt/web-platform-tests/common/security-features/resources/common.js +++ b/tests/wpt/web-platform-tests/common/security-features/resources/common.js @@ -192,17 +192,62 @@ function createHelperIframe(name, doBindEvents) { doBindEvents); } -/** - * requestVia*() functions return promises that are resolved on successful - * requests with objects of the same "type", i.e. objects that contains - * the same sets of keys that are fixed within one category of tests (e.g. - * within wpt/referrer-policy tests). - * wrapResult() (that should be defined outside this file) is used to convert - * the response bodies of subresources into the expected result objects in some - * cases, and in other cases the result objects are constructed more directly. - * TODO(https://crbug.com/906850): Clean up the semantics around this, e.g. - * use (or not use) wrapResult() consistently, unify the arguments, etc. - */ +function wrapResult(server_data) { + if (typeof(server_data) === "string") { + throw server_data; + } + return { + referrer: server_data.headers.referer, + headers: server_data.headers + } +} + +// `requestVia*()` functions return promises that are resolved on successful +// requests with objects with the following keys: +// - `headers`: HTTP request headers sent to server. +// - `referrer`: Referrer. +// - `location`: The URL of the subresource. +// +// Category 1: +// `headers`: set. +// `referrer`: set via `document.referrer`. +// `location`: set via `document.location`. +// See `template/document.html.template`. +// Category 2: +// `headers`: set. +// `referrer`: set to `headers.referer` by `wrapResult()`. +// `location`: not set. +// Category 3: +// All the keys listed above are NOT set. +// +// -------------------------------- -------- -------------------------- +// Function name Category Used in +// -------- ------- --------- +// referrer mixed- upgrade- +// policy content insecure- +// policy content request +// -------------------------------- -------- -------- ------- --------- +// requestViaAnchor 1 Y Y - +// requestViaArea 1 Y Y - +// requestViaAudio 3 - Y - +// requestViaDedicatedWorker 2 Y Y Y +// requestViaFetch 2 Y Y - +// requestViaForm 3 - Y - +// requestViaIframe 1 Y Y - +// requestViaImage 3 - Y - +// requestViaImageForReferrerPolicy 2 Y - - +// requestViaLinkPrefetch 3 - Y - +// requestViaLinkStylesheet 3 - Y - +// requestViaObject 3 - Y - +// requestViaPicture 3 - Y - +// requestViaScript 2 Y Y - +// requestViaSendBeacon 3 - Y - +// requestViaSharedWorker 2 Y - - +// requestViaVideo 3 - Y - +// requestViaWebSocket 3 - Y - +// requestViaWorklet 3 - Y Y +// requestViaXhr 2 Y Y - +// -------------------------------- -------- -------- ------- --------- /** * Creates a new iframe, binds load and error events, sets the src attribute and @@ -383,8 +428,9 @@ function requestViaFetch(url) { function dedicatedWorkerUrlThatFetches(url) { return `data:text/javascript, fetch('${url}') - .then(() => postMessage(''), - () => postMessage(''));`; + .then(r => r.json()) + .then(j => postMessage(j)) + .catch((e) => postMessage(e.message));`; } function workerUrlThatImports(url) { diff --git a/tests/wpt/web-platform-tests/css/css-flexbox/flex-vertical-align-effect.html b/tests/wpt/web-platform-tests/css/css-flexbox/flex-vertical-align-effect.html index e7d94d00e19d..8ec602546899 100644 --- a/tests/wpt/web-platform-tests/css/css-flexbox/flex-vertical-align-effect.html +++ b/tests/wpt/web-platform-tests/css/css-flexbox/flex-vertical-align-effect.html @@ -11,6 +11,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/docs/_writing-tests/testharness.md b/tests/wpt/web-platform-tests/docs/_writing-tests/testharness.md index c19fe0ee881b..a584e6acd046 100644 --- a/tests/wpt/web-platform-tests/docs/_writing-tests/testharness.md +++ b/tests/wpt/web-platform-tests/docs/_writing-tests/testharness.md @@ -161,6 +161,8 @@ are: * `dedicatedworker` (default): to be run at x.any.worker.html * `serviceworker`: to be run at x.https.any.serviceworker.html * `sharedworker`: to be run at x.any.sharedworker.html +* `jsshell`: to be run in a JavaScript shell, without access to the DOM + (currently only supported in SpiderMonkey, and skipped in wptrunner) * `default`: shorthand for the default scopes * `worker`: shorthand for the dedicated, shared and service worker scopes diff --git a/tests/wpt/web-platform-tests/element-timing/background-image-data-uri.html b/tests/wpt/web-platform-tests/element-timing/background-image-data-uri.html new file mode 100644 index 000000000000..696f34ff14e8 --- /dev/null +++ b/tests/wpt/web-platform-tests/element-timing/background-image-data-uri.html @@ -0,0 +1,38 @@ + + +Element Timing: observe element with inline background image + + + + + + +
+ diff --git a/tests/wpt/web-platform-tests/element-timing/image-data-uri.html b/tests/wpt/web-platform-tests/element-timing/image-data-uri.html new file mode 100644 index 000000000000..22ff91189b13 --- /dev/null +++ b/tests/wpt/web-platform-tests/element-timing/image-data-uri.html @@ -0,0 +1,36 @@ + + +Element Timing: observe inline image + + + + + + + + diff --git a/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js b/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js index 66605df824bb..b0ddf308df25 100644 --- a/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js +++ b/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js @@ -13,6 +13,19 @@ function checkElement(entry, expectedName, expectedIdentifier, expectedID, befor assert_equals(rt_entries[0].responseEnd, entry.responseEnd); } +function checkElementWithoutResourceTiming(entry, expectedName, expectedIdentifier, + expectedID, beforeRender) { + assert_equals(entry.entryType, 'element'); + assert_equals(entry.name, expectedName); + assert_equals(entry.identifier, expectedIdentifier); + assert_equals(entry.duration, 0); + assert_equals(entry.id, expectedID); + assert_greater_than_equal(entry.startTime, beforeRender); + assert_greater_than_equal(performance.now(), entry.startTime); + // No associated resource from ResourceTiming, so the responseEnd should be 0. + assert_equals(entry.responseEnd, 0); +} + // Checks that the rect matches the desired values [left right top bottom]. function checkRect(entry, expected, description="") { assert_equals(entry.intersectionRect.left, expected[0], diff --git a/tests/wpt/web-platform-tests/mixed-content/generic/mixed-content-test-case.js b/tests/wpt/web-platform-tests/mixed-content/generic/mixed-content-test-case.js index a50b61c7e765..e7b0baaaafa3 100644 --- a/tests/wpt/web-platform-tests/mixed-content/generic/mixed-content-test-case.js +++ b/tests/wpt/web-platform-tests/mixed-content/generic/mixed-content-test-case.js @@ -3,11 +3,6 @@ * @author burnik@google.com (Kristijan Burnik) */ -function wrapResult(server_data) { - // Currently the returned value is not used in mixed-content tests. - return null; -} - /** * MixedContentTestCase exercises all the tests for checking browser behavior * when resources regarded as mixed-content are requested. A single run covers diff --git a/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html b/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html index 63a6d75dc42e..99c44f0bfc3c 100644 --- a/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html +++ b/tests/wpt/web-platform-tests/portals/portals-adopt-predecessor.html @@ -4,11 +4,24 @@ diff --git a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html index 7b4c86d75bc2..96de3b7e4a40 100644 --- a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html +++ b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor-portal.html @@ -1,17 +1,28 @@ diff --git a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html index 5ba0b864d0e3..b92ad8a17c19 100644 --- a/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html +++ b/tests/wpt/web-platform-tests/portals/resources/portals-adopt-predecessor.html @@ -1,20 +1,25 @@ - diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js index 6b5ae7f70f14..6d570f1dc0fd 100644 --- a/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js +++ b/tests/wpt/web-platform-tests/referrer-policy/generic/referrer-policy-test-case.js @@ -1,10 +1,3 @@ -function wrapResult(server_data) { - return { - referrer: server_data.headers.referer, - headers: server_data.headers - } -} - // NOTE: This method only strips the fragment and is not in accordance to the // recommended draft specification: // https://w3c.github.io/webappsec/specs/referrer-policy/#null diff --git a/tests/wpt/web-platform-tests/tools/manifest/download.py b/tests/wpt/web-platform-tests/tools/manifest/download.py index 2e505f371ed8..e8f27e7ac100 100644 --- a/tests/wpt/web-platform-tests/tools/manifest/download.py +++ b/tests/wpt/web-platform-tests/tools/manifest/download.py @@ -1,6 +1,7 @@ from __future__ import absolute_import import argparse +import bz2 import gzip import json import io @@ -9,6 +10,11 @@ from six.moves.urllib.request import urlopen +try: + import zstandard +except ImportError: + zstandard = None + from .vcs import Git from . import log @@ -43,6 +49,21 @@ def merge_pr_tags(repo_root, max_count=50): return tags +def score_name(name): + """Score how much we like each filename, lower wins, None rejects""" + + # Accept both ways of naming the manfest asset, even though + # there's no longer a reason to include the commit sha. + if name.startswith("MANIFEST-") or name.startswith("MANIFEST."): + if zstandard and name.endswith("json.zst"): + return 1 + if name.endswith(".json.bz2"): + return 2 + if name.endswith(".json.gz"): + return 3 + return None + + def github_url(tags): for tag in tags: url = "https://api.github.com/repos/web-platform-tests/wpt/releases/tags/%s" % tag @@ -62,13 +83,13 @@ def github_url(tags): logger.warning("Response was not valid JSON") return None + candidates = [] for item in release["assets"]: - # Accept both ways of naming the manfest asset, even though - # there's no longer a reason to include the commit sha. - if item["name"].startswith("MANIFEST-") and item["name"].endswith(".json.gz"): - return item["browser_download_url"] - elif item["name"] == "MANIFEST.json.gz": - return item["browser_download_url"] + score = score_name(item["name"]) + if score is not None: + candidates.append((score, item["browser_download_url"])) + + return [item[1] for item in sorted(candidates)] return None @@ -79,33 +100,56 @@ def download_manifest(manifest_path, tags_func, url_func, force=False): tags = tags_func() - url = url_func(tags) - if not url: + urls = url_func(tags) + if not urls: logger.warning("No generated manifest found") return False - logger.info("Downloading manifest from %s" % url) - try: - resp = urlopen(url) - except Exception: - logger.warning("Downloading pregenerated manifest failed") - return False - - if resp.code != 200: - logger.warning("Downloading pregenerated manifest failed; got HTTP status %d" % - resp.code) - return False + for url in urls: + logger.info("Downloading manifest from %s" % url) + try: + resp = urlopen(url) + except Exception: + logger.warning("Downloading pregenerated manifest failed") + continue - gzf = gzip.GzipFile(fileobj=io.BytesIO(resp.read())) + if resp.code != 200: + logger.warning("Downloading pregenerated manifest failed; got HTTP status %d" % + resp.code) + continue - try: - decompressed = gzf.read() - except IOError: - logger.warning("Failed to decompress downloaded file") + if url.endswith(".zst"): + if not zstandard: + continue + try: + dctx = zstandard.ZstdDecompressor() + decompressed = dctx.decompress(resp.read()) + except IOError: + logger.warning("Failed to decompress downloaded file") + continue + elif url.endswith(".bz2"): + try: + decompressed = bz2.decompress(resp.read()) + except IOError: + logger.warning("Failed to decompress downloaded file") + continue + elif url.endswith(".gz"): + fileobj = io.BytesIO(resp.read()) + try: + with gzip.GzipFile(fileobj=fileobj) as gzf: + decompressed = gzf.read() + except IOError: + logger.warning("Failed to decompress downloaded file") + continue + else: + logger.warning("Unknown file extension: %s" % url) + continue + break + else: return False try: - with open(manifest_path, "w") as f: + with open(manifest_path, "wb") as f: f.write(decompressed) except Exception: logger.warning("Failed to write manifest") diff --git a/tests/wpt/web-platform-tests/tools/manifest/vcs.py b/tests/wpt/web-platform-tests/tools/manifest/vcs.py index 676e53f67854..cfb0ff27c364 100644 --- a/tests/wpt/web-platform-tests/tools/manifest/vcs.py +++ b/tests/wpt/web-platform-tests/tools/manifest/vcs.py @@ -5,8 +5,15 @@ import subprocess from collections import deque +from six import iteritems + from .sourcefile import SourceFile +MYPY = False +if MYPY: + # MYPY is set to True when run under Mypy. + from typing import Dict, Optional + def get_tree(tests_root, manifest, manifest_path, cache_root, working_copy=False, rebuild=False): @@ -92,13 +99,24 @@ def _show_file(self, path): path = os.path.relpath(os.path.abspath(path), self.root) return self.git("show", "HEAD:%s" % path) - def __iter__(self): + def hash_cache(self): + # type: () -> Dict[str, Optional[str]] + """ + A dict of rel_path -> current git object id if the working tree matches HEAD else None + """ + hash_cache = {} + cmd = ["ls-tree", "-r", "-z", "HEAD"] local_changes = self._local_changes() for result in self.git(*cmd).split("\0")[:-1]: data, rel_path = result.rsplit("\t", 1) - hash = data.split(" ", 3)[2] - if rel_path in local_changes: + hash_cache[rel_path] = None if rel_path in local_changes else data.split(" ", 3)[2] + + return hash_cache + + def __iter__(self): + for rel_path, hash in iteritems(self.hash_cache()): + if hash is None: contents = self._show_file(rel_path) else: contents = None @@ -127,6 +145,11 @@ def __init__(self, root, url_base, cache_path, manifest_path=None, rebuild=False self.path_filter = gitignore.PathFilter(self.root, extras=[".git/"], cache=self.ignore_cache) + git = Git.for_path(root, url_base, cache_path) + if git is not None: + self.hash_cache = git.hash_cache() + else: + self.hash_cache = {} def __iter__(self): mtime_cache = self.mtime_cache @@ -134,7 +157,8 @@ def __iter__(self): for filename, path_stat in filenames: path = os.path.join(dirpath, filename) if mtime_cache is None or mtime_cache.updated(path, path_stat): - yield SourceFile(self.root, path, self.url_base), True + hash = self.hash_cache.get(path, None) + yield SourceFile(self.root, path, self.url_base, hash), True else: yield path, False diff --git a/tests/wpt/web-platform-tests/tools/wpt/commands.json b/tests/wpt/web-platform-tests/tools/wpt/commands.json index 161a9defbd14..da8804d0607b 100644 --- a/tests/wpt/web-platform-tests/tools/wpt/commands.json +++ b/tests/wpt/web-platform-tests/tools/wpt/commands.json @@ -1,6 +1,7 @@ { "run": {"path": "run.py", "script": "run", "parser": "create_parser", "help": "Run tests in a browser", - "virtualenv": true, "install": ["requests"], "requirements": ["../wptrunner/requirements.txt"]}, + "virtualenv": true, "install": ["requests", "zstandard"], + "requirements": ["../wptrunner/requirements.txt"]}, "create": {"path": "create.py", "script": "run", "parser": "get_parser", "help": "Create a new wpt test"}, "update-expectations": {"path": "update.py", "script": "update_expectations", "parser": "create_parser_update", "help": "Update expectations files from raw logs.", diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py index 1d2286e614f0..22d9c25d12e4 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/firefox.py @@ -58,6 +58,9 @@ def get_timeout_multiplier(test_type, run_info_data, **kwargs): return 3 elif run_info_data["os"] == "android": return 4 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1538725 + elif run_info_data["os"] == "win" and run_info_data["processor"] == "aarch64": + return 4 return 1 diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py index 7ad35756d0c6..5719a859fa4b 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/conditional.py @@ -205,7 +205,7 @@ def __init__(self, node=None, **kwargs): self._data = {} def __repr__(self): - return "" % (self.node.data) + return "" % (self.node.data) def __str__(self): rv = [repr(self)] diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/static.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/static.py index b3cbedc3818e..7b4f5613c384 100644 --- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/static.py +++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/backends/static.py @@ -131,7 +131,7 @@ def __init__(self, name, **kwargs): self._data = {} def __repr__(self): - return "" % (self.name) + return "" % (self.name) def __str__(self): rv = [repr(self)] diff --git a/tests/wpt/web-platform-tests/upgrade-insecure-requests/support/testharness-helper.sub.js b/tests/wpt/web-platform-tests/upgrade-insecure-requests/support/testharness-helper.sub.js index 2c854534d56f..f578e8987a1b 100644 --- a/tests/wpt/web-platform-tests/upgrade-insecure-requests/support/testharness-helper.sub.js +++ b/tests/wpt/web-platform-tests/upgrade-insecure-requests/support/testharness-helper.sub.js @@ -1,9 +1,3 @@ -// Used by common.js. -function wrapResult(server_data) { - // Currently the returned value is not used in mixed-content tests. - return null; -} - const Host = { SAME_ORIGIN: "same-origin", CROSS_ORIGIN: "cross-origin", diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js index 1442cfccdf1b..2faa5891c7ba 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/compile.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js function assert_Module(module) { @@ -78,7 +77,7 @@ promise_test(() => { }, "Stray argument"); promise_test(() => { - const buffer = new Uint8Array(new WasmModuleBuilder().toBuffer()); + const buffer = new WasmModuleBuilder().toBuffer(); assert_equals(buffer[0], 0); const promise = WebAssembly.compile(buffer); buffer[0] = 1; diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js index 86700298dfae..1eaefdfba26c 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate-bad-imports.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/bad-imports.js diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js index 356f87d02d34..ae8f5ab688a4 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/instantiate.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/assertions.js // META: script=/wasm/jsapi/instanceTestFactory.js @@ -145,7 +144,7 @@ promise_test(t => { }, "Invalid code"); promise_test(() => { - const buffer = new Uint8Array(new WasmModuleBuilder().toBuffer()); + const buffer = new WasmModuleBuilder().toBuffer(); assert_equals(buffer[0], 0); const promise = WebAssembly.instantiate(buffer); buffer[0] = 1; diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js index c8613cbd9b3a..57fa3359770f 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/constructor/validate.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js let emptyModuleBinary; diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/global/value-get-set.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/global/value-get-set.any.js index 6de62d5f5836..7b45ddc20b27 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/global/value-get-set.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/global/value-get-set.any.js @@ -49,6 +49,22 @@ for (const type of ["i32", "f32", "f64"]) { assert_equals(global.value, 0, "post-set value"); assert_equals(global.valueOf(), 0, "post-set valueOf"); }, `Immutable ${type} (${name})`); + + test(t => { + opts.value = type; + const global = new WebAssembly.Global(opts); + assert_equals(global.value, 0, "initial value"); + assert_equals(global.valueOf(), 0, "initial valueOf"); + + const value = { + valueOf: t.unreached_func("should not call valueOf"), + toString: t.unreached_func("should not call toString"), + }; + assert_throws(new TypeError(), () => global.value = value); + + assert_equals(global.value, 0, "post-set value"); + assert_equals(global.valueOf(), 0, "post-set valueOf"); + }, `Immutable ${type} with ToNumber side-effects (${name})`); } const mutableOptions = [ @@ -80,6 +96,15 @@ test(() => { assert_throws(new TypeError(), () => global.valueOf()); }, "i64 with default"); +test(t => { + const argument = { "value": "i64", "mutable": true }; + const global = new WebAssembly.Global(argument); + const value = { + valueOf: t.unreached_func("should not call valueOf"), + toString: t.unreached_func("should not call toString"), + }; + assert_throws(new TypeError(), () => global.value = value); +}, "i64 with ToNumber side-effects"); test(() => { const argument = { "value": "i32", "mutable": true }; diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js index 24c51c10dc5d..b90ada252869 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor-bad-imports.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/bad-imports.js diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js index e6a0450202e9..1ce4de904e16 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instance/constructor.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/assertions.js // META: script=/wasm/jsapi/instanceTestFactory.js diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instance/exports.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/instance/exports.any.js index cad468660e09..2ba57c5e2fd9 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instance/exports.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instance/exports.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js let emptyModuleBinary; diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instance/toString.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/instance/toString.any.js index 08dcb14a50d0..ccd665eb2853 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instance/toString.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instance/toString.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js test(() => { diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/instanceTestFactory.js b/tests/wpt/web-platform-tests/wasm/jsapi/instanceTestFactory.js index cb720ceb7095..7ccf06c234a7 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/instanceTestFactory.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/instanceTestFactory.js @@ -140,7 +140,7 @@ const instanceTestFactory = [ .addBody([]) .exportFunc(); - builder.setTableLength(1); + builder.setTableBounds(1); builder.addExportOfKind("table", kExternalTable, 0); builder.addGlobal(kWasmI32, true) diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/module/constructor.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/module/constructor.any.js index 2127e2810cb8..03e508aa1e0f 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/module/constructor.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/module/constructor.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/assertions.js diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/module/customSections.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/module/customSections.any.js index 387d4e4a3174..8e9732e5512d 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/module/customSections.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/module/customSections.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js function assert_ArrayBuffer(buffer, expected) { @@ -97,7 +96,7 @@ test(() => { }); const builder = new WasmModuleBuilder(); - builder.addExplicitSection(binary); + builder.addExplicitSection(binary.trunc_buffer()); const buffer = builder.toBuffer() const module = new WebAssembly.Module(buffer); @@ -127,7 +126,7 @@ test(() => { }); const builder = new WasmModuleBuilder(); - builder.addExplicitSection(binary); + builder.addExplicitSection(binary.trunc_buffer()); const buffer = builder.toBuffer(); const module = new WebAssembly.Module(buffer); @@ -148,7 +147,7 @@ test(() => { }); const builder = new WasmModuleBuilder(); - builder.addExplicitSection(binary); + builder.addExplicitSection(binary.trunc_buffer()); const buffer = builder.toBuffer(); const module = new WebAssembly.Module(buffer); diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/module/exports.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/module/exports.any.js index 4437daa052fa..eadfc84f1e4e 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/module/exports.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/module/exports.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js let emptyModuleBinary; @@ -99,7 +98,7 @@ test(() => { .addBody([]) .exportFunc(); - builder.setTableLength(1); + builder.setTableBounds(1); builder.addExportOfKind("table", kExternalTable, 0); builder.addGlobal(kWasmI32, true) diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/module/imports.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/module/imports.any.js index b3bb8598b080..9d7ef2f0a9b9 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/module/imports.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/module/imports.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js function assert_ModuleImportDescriptor(import_, expected) { diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/module/toString.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/module/toString.any.js index d9231a132ca8..2db2002ffd2e 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/module/toString.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/module/toString.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js test(() => { diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/table/get-set.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/table/get-set.any.js index ce9681142012..bd053b389c90 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/table/get-set.any.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/table/get-set.any.js @@ -1,5 +1,4 @@ // META: global=jsshell -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=assertions.js diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/wasm-constants.js b/tests/wpt/web-platform-tests/wasm/jsapi/wasm-constants.js deleted file mode 100644 index e3846386b8dc..000000000000 --- a/tests/wpt/web-platform-tests/wasm/jsapi/wasm-constants.js +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -function bytes() { - var buffer = new ArrayBuffer(arguments.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < arguments.length; i++) { - var val = arguments[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[i] = val | 0; - } - return buffer; -} - -// Header declaration constants -var kWasmH0 = 0; -var kWasmH1 = 0x61; -var kWasmH2 = 0x73; -var kWasmH3 = 0x6d; - -var kWasmV0 = 0x1; -var kWasmV1 = 0; -var kWasmV2 = 0; -var kWasmV3 = 0; - -var kHeaderSize = 8; -var kPageSize = 65536; -var kSpecMaxPages = 65535; - -function bytesWithHeader() { - var buffer = new ArrayBuffer(kHeaderSize + arguments.length); - var view = new Uint8Array(buffer); - view[0] = kWasmH0; - view[1] = kWasmH1; - view[2] = kWasmH2; - view[3] = kWasmH3; - view[4] = kWasmV0; - view[5] = kWasmV1; - view[6] = kWasmV2; - view[7] = kWasmV3; - for (var i = 0; i < arguments.length; i++) { - var val = arguments[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[kHeaderSize + i] = val | 0; - } - return buffer; -} - -let kDeclNoLocals = 0; - -// Section declaration constants -let kUnknownSectionCode = 0; -let kTypeSectionCode = 1; // Function signature declarations -let kImportSectionCode = 2; // Import declarations -let kFunctionSectionCode = 3; // Function declarations -let kTableSectionCode = 4; // Indirect function table and other tables -let kMemorySectionCode = 5; // Memory attributes -let kGlobalSectionCode = 6; // Global declarations -let kExportSectionCode = 7; // Exports -let kStartSectionCode = 8; // Start function declaration -let kElementSectionCode = 9; // Elements section -let kCodeSectionCode = 10; // Function code -let kDataSectionCode = 11; // Data segments - -// Name section types -let kModuleNameCode = 0; -let kFunctionNamesCode = 1; -let kLocalNamesCode = 2; - -let kWasmFunctionTypeForm = 0x60; -let kWasmAnyFunctionTypeForm = 0x70; - -let kHasMaximumFlag = 1; -let kResizableMaximumFlag = 1; - -// Function declaration flags -let kDeclFunctionName = 0x01; -let kDeclFunctionImport = 0x02; -let kDeclFunctionLocals = 0x04; -let kDeclFunctionExport = 0x08; - -// Local types -let kWasmStmt = 0x40; -let kWasmI32 = 0x7f; -let kWasmI64 = 0x7e; -let kWasmF32 = 0x7d; -let kWasmF64 = 0x7c; -let kWasmS128 = 0x7b; - -let kExternalFunction = 0; -let kExternalTable = 1; -let kExternalMemory = 2; -let kExternalGlobal = 3; - -let kTableZero = 0; -let kMemoryZero = 0; - -// Useful signatures -let kSig_i_i = makeSig([kWasmI32], [kWasmI32]); -let kSig_l_l = makeSig([kWasmI64], [kWasmI64]); -let kSig_i_l = makeSig([kWasmI64], [kWasmI32]); -let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]); -let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -let kSig_v_iiii = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []); -let kSig_f_ff = makeSig([kWasmF32, kWasmF32], [kWasmF32]); -let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]); -let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]); -let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]); -let kSig_v_v = makeSig([], []); -let kSig_i_v = makeSig([], [kWasmI32]); -let kSig_l_v = makeSig([], [kWasmI64]); -let kSig_f_v = makeSig([], [kWasmF32]); -let kSig_d_v = makeSig([], [kWasmF64]); -let kSig_v_i = makeSig([kWasmI32], []); -let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []); -let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []); -let kSig_v_l = makeSig([kWasmI64], []); -let kSig_v_d = makeSig([kWasmF64], []); -let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []); -let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []); - -let kSig_v_f = makeSig([kWasmF32], []); -let kSig_f_f = makeSig([kWasmF32], [kWasmF32]); -let kSig_f_d = makeSig([kWasmF64], [kWasmF32]); -let kSig_d_d = makeSig([kWasmF64], [kWasmF64]); - -function makeSig(params, results) { - return {params: params, results: results}; -} - -function makeSig_v_x(x) { - return makeSig([x], []); -} - -function makeSig_v_xx(x) { - return makeSig([x, x], []); -} - -function makeSig_r_v(r) { - return makeSig([], [r]); -} - -function makeSig_r_x(r, x) { - return makeSig([x], [r]); -} - -function makeSig_r_xx(r, x) { - return makeSig([x, x], [r]); -} - -// Opcodes -let kExprUnreachable = 0x00; -let kExprNop = 0x01; -let kExprBlock = 0x02; -let kExprLoop = 0x03; -let kExprIf = 0x04; -let kExprElse = 0x05; -let kExprTry = 0x06; -let kExprCatch = 0x07; -let kExprThrow = 0x08; -let kExprEnd = 0x0b; -let kExprBr = 0x0c; -let kExprBrIf = 0x0d; -let kExprBrTable = 0x0e; -let kExprReturn = 0x0f; -let kExprCallFunction = 0x10; -let kExprCallIndirect = 0x11; -let kExprDrop = 0x1a; -let kExprSelect = 0x1b; -let kExprGetLocal = 0x20; -let kExprSetLocal = 0x21; -let kExprTeeLocal = 0x22; -let kExprGetGlobal = 0x23; -let kExprSetGlobal = 0x24; -let kExprI32Const = 0x41; -let kExprI64Const = 0x42; -let kExprF32Const = 0x43; -let kExprF64Const = 0x44; -let kExprI32LoadMem = 0x28; -let kExprI64LoadMem = 0x29; -let kExprF32LoadMem = 0x2a; -let kExprF64LoadMem = 0x2b; -let kExprI32LoadMem8S = 0x2c; -let kExprI32LoadMem8U = 0x2d; -let kExprI32LoadMem16S = 0x2e; -let kExprI32LoadMem16U = 0x2f; -let kExprI64LoadMem8S = 0x30; -let kExprI64LoadMem8U = 0x31; -let kExprI64LoadMem16S = 0x32; -let kExprI64LoadMem16U = 0x33; -let kExprI64LoadMem32S = 0x34; -let kExprI64LoadMem32U = 0x35; -let kExprI32StoreMem = 0x36; -let kExprI64StoreMem = 0x37; -let kExprF32StoreMem = 0x38; -let kExprF64StoreMem = 0x39; -let kExprI32StoreMem8 = 0x3a; -let kExprI32StoreMem16 = 0x3b; -let kExprI64StoreMem8 = 0x3c; -let kExprI64StoreMem16 = 0x3d; -let kExprI64StoreMem32 = 0x3e; -let kExprMemorySize = 0x3f; -let kExprMemoryGrow = 0x40; -let kExprI32Eqz = 0x45; -let kExprI32Eq = 0x46; -let kExprI32Ne = 0x47; -let kExprI32LtS = 0x48; -let kExprI32LtU = 0x49; -let kExprI32GtS = 0x4a; -let kExprI32GtU = 0x4b; -let kExprI32LeS = 0x4c; -let kExprI32LeU = 0x4d; -let kExprI32GeS = 0x4e; -let kExprI32GeU = 0x4f; -let kExprI64Eqz = 0x50; -let kExprI64Eq = 0x51; -let kExprI64Ne = 0x52; -let kExprI64LtS = 0x53; -let kExprI64LtU = 0x54; -let kExprI64GtS = 0x55; -let kExprI64GtU = 0x56; -let kExprI64LeS = 0x57; -let kExprI64LeU = 0x58; -let kExprI64GeS = 0x59; -let kExprI64GeU = 0x5a; -let kExprF32Eq = 0x5b; -let kExprF32Ne = 0x5c; -let kExprF32Lt = 0x5d; -let kExprF32Gt = 0x5e; -let kExprF32Le = 0x5f; -let kExprF32Ge = 0x60; -let kExprF64Eq = 0x61; -let kExprF64Ne = 0x62; -let kExprF64Lt = 0x63; -let kExprF64Gt = 0x64; -let kExprF64Le = 0x65; -let kExprF64Ge = 0x66; -let kExprI32Clz = 0x67; -let kExprI32Ctz = 0x68; -let kExprI32Popcnt = 0x69; -let kExprI32Add = 0x6a; -let kExprI32Sub = 0x6b; -let kExprI32Mul = 0x6c; -let kExprI32DivS = 0x6d; -let kExprI32DivU = 0x6e; -let kExprI32RemS = 0x6f; -let kExprI32RemU = 0x70; -let kExprI32And = 0x71; -let kExprI32Ior = 0x72; -let kExprI32Xor = 0x73; -let kExprI32Shl = 0x74; -let kExprI32ShrS = 0x75; -let kExprI32ShrU = 0x76; -let kExprI32Rol = 0x77; -let kExprI32Ror = 0x78; -let kExprI64Clz = 0x79; -let kExprI64Ctz = 0x7a; -let kExprI64Popcnt = 0x7b; -let kExprI64Add = 0x7c; -let kExprI64Sub = 0x7d; -let kExprI64Mul = 0x7e; -let kExprI64DivS = 0x7f; -let kExprI64DivU = 0x80; -let kExprI64RemS = 0x81; -let kExprI64RemU = 0x82; -let kExprI64And = 0x83; -let kExprI64Ior = 0x84; -let kExprI64Xor = 0x85; -let kExprI64Shl = 0x86; -let kExprI64ShrS = 0x87; -let kExprI64ShrU = 0x88; -let kExprI64Rol = 0x89; -let kExprI64Ror = 0x8a; -let kExprF32Abs = 0x8b; -let kExprF32Neg = 0x8c; -let kExprF32Ceil = 0x8d; -let kExprF32Floor = 0x8e; -let kExprF32Trunc = 0x8f; -let kExprF32NearestInt = 0x90; -let kExprF32Sqrt = 0x91; -let kExprF32Add = 0x92; -let kExprF32Sub = 0x93; -let kExprF32Mul = 0x94; -let kExprF32Div = 0x95; -let kExprF32Min = 0x96; -let kExprF32Max = 0x97; -let kExprF32CopySign = 0x98; -let kExprF64Abs = 0x99; -let kExprF64Neg = 0x9a; -let kExprF64Ceil = 0x9b; -let kExprF64Floor = 0x9c; -let kExprF64Trunc = 0x9d; -let kExprF64NearestInt = 0x9e; -let kExprF64Sqrt = 0x9f; -let kExprF64Add = 0xa0; -let kExprF64Sub = 0xa1; -let kExprF64Mul = 0xa2; -let kExprF64Div = 0xa3; -let kExprF64Min = 0xa4; -let kExprF64Max = 0xa5; -let kExprF64CopySign = 0xa6; -let kExprI32ConvertI64 = 0xa7; -let kExprI32SConvertF32 = 0xa8; -let kExprI32UConvertF32 = 0xa9; -let kExprI32SConvertF64 = 0xaa; -let kExprI32UConvertF64 = 0xab; -let kExprI64SConvertI32 = 0xac; -let kExprI64UConvertI32 = 0xad; -let kExprI64SConvertF32 = 0xae; -let kExprI64UConvertF32 = 0xaf; -let kExprI64SConvertF64 = 0xb0; -let kExprI64UConvertF64 = 0xb1; -let kExprF32SConvertI32 = 0xb2; -let kExprF32UConvertI32 = 0xb3; -let kExprF32SConvertI64 = 0xb4; -let kExprF32UConvertI64 = 0xb5; -let kExprF32ConvertF64 = 0xb6; -let kExprF64SConvertI32 = 0xb7; -let kExprF64UConvertI32 = 0xb8; -let kExprF64SConvertI64 = 0xb9; -let kExprF64UConvertI64 = 0xba; -let kExprF64ConvertF32 = 0xbb; -let kExprI32ReinterpretF32 = 0xbc; -let kExprI64ReinterpretF64 = 0xbd; -let kExprF32ReinterpretI32 = 0xbe; -let kExprF64ReinterpretI64 = 0xbf; - -let kTrapUnreachable = 0; -let kTrapMemOutOfBounds = 1; -let kTrapDivByZero = 2; -let kTrapDivUnrepresentable = 3; -let kTrapRemByZero = 4; -let kTrapFloatUnrepresentable = 5; -let kTrapFuncInvalid = 6; -let kTrapFuncSigMismatch = 7; -let kTrapInvalidIndex = 8; - -let kTrapMsgs = [ - "unreachable", - "memory access out of bounds", - "divide by zero", - "divide result unrepresentable", - "remainder by zero", - "integer result unrepresentable", - "invalid function", - "function signature mismatch", - "invalid index into function table" -]; - -function assertTraps(trap, code) { - try { - if (typeof code === 'function') { - code(); - } else { - eval(code); - } - } catch (e) { - assertEquals('object', typeof e); - assertEquals(kTrapMsgs[trap], e.message); - // Success. - return; - } - throw new MjsUnitAssertionError('Did not trap, expected: ' + kTrapMsgs[trap]); -} - -function wasmI32Const(val) { - let bytes = [kExprI32Const]; - for (let i = 0; i < 4; ++i) { - bytes.push(0x80 | ((val >> (7 * i)) & 0x7f)); - } - bytes.push((val >> (7 * 4)) & 0x7f); - return bytes; -} - -function wasmF32Const(f) { - return [kExprF32Const].concat(Array.from(new Uint8Array((new Float32Array([f])).buffer))); -} - -function wasmF64Const(f) { - return [kExprF64Const].concat(Array.from(new Uint8Array((new Float64Array([f])).buffer))); -} diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/wasm-module-builder.js b/tests/wpt/web-platform-tests/wasm/jsapi/wasm-module-builder.js index d7dd08b2a603..a937eed4c622 100644 --- a/tests/wpt/web-platform-tests/wasm/jsapi/wasm-module-builder.js +++ b/tests/wpt/web-platform-tests/wasm/jsapi/wasm-module-builder.js @@ -3,44 +3,401 @@ // found in the LICENSE file. // Used for encoding f32 and double constants to bits. -let __buffer = new ArrayBuffer(8); -let byte_view = new Int8Array(__buffer); -let f32_view = new Float32Array(__buffer); -let f64_view = new Float64Array(__buffer); +let f32_view = new Float32Array(1); +let f32_bytes_view = new Uint8Array(f32_view.buffer); +let f64_view = new Float64Array(1); +let f64_bytes_view = new Uint8Array(f64_view.buffer); + +// The bytes function receives one of +// - several arguments, each of which is either a number or a string of length +// 1; if it's a string, the charcode of the contained character is used. +// - a single array argument containing the actual arguments +// - a single string; the returned buffer will contain the char codes of all +// contained characters. +function bytes(...input) { + if (input.length == 1 && typeof input[0] == 'array') input = input[0]; + if (input.length == 1 && typeof input[0] == 'string') { + let len = input[0].length; + let view = new Uint8Array(len); + for (let i = 0; i < len; i++) view[i] = input[0].charCodeAt(i); + return view.buffer; + } + let view = new Uint8Array(input.length); + for (let i = 0; i < input.length; i++) { + let val = input[i]; + if (typeof val == 'string') { + assertEquals(1, val.length, 'string inputs must have length 1'); + val = val.charCodeAt(0); + } + view[i] = val | 0; + } + return view.buffer; +} + +// Header declaration constants +var kWasmH0 = 0; +var kWasmH1 = 0x61; +var kWasmH2 = 0x73; +var kWasmH3 = 0x6d; + +var kWasmV0 = 0x1; +var kWasmV1 = 0; +var kWasmV2 = 0; +var kWasmV3 = 0; + +var kHeaderSize = 8; +var kPageSize = 65536; +var kSpecMaxPages = 65535; +var kMaxVarInt32Size = 5; +var kMaxVarInt64Size = 10; + +let kDeclNoLocals = 0; + +// Section declaration constants +let kUnknownSectionCode = 0; +let kTypeSectionCode = 1; // Function signature declarations +let kImportSectionCode = 2; // Import declarations +let kFunctionSectionCode = 3; // Function declarations +let kTableSectionCode = 4; // Indirect function table and other tables +let kMemorySectionCode = 5; // Memory attributes +let kGlobalSectionCode = 6; // Global declarations +let kExportSectionCode = 7; // Exports +let kStartSectionCode = 8; // Start function declaration +let kElementSectionCode = 9; // Elements section +let kCodeSectionCode = 10; // Function code +let kDataSectionCode = 11; // Data segments + +// Name section types +let kModuleNameCode = 0; +let kFunctionNamesCode = 1; +let kLocalNamesCode = 2; + +let kWasmFunctionTypeForm = 0x60; +let kWasmAnyFunctionTypeForm = 0x70; + +let kHasMaximumFlag = 1; +let kResizableMaximumFlag = 1; + +// Function declaration flags +let kDeclFunctionName = 0x01; +let kDeclFunctionImport = 0x02; +let kDeclFunctionLocals = 0x04; +let kDeclFunctionExport = 0x08; + +// Local types +let kWasmStmt = 0x40; +let kWasmI32 = 0x7f; +let kWasmI64 = 0x7e; +let kWasmF32 = 0x7d; +let kWasmF64 = 0x7c; +let kWasmS128 = 0x7b; + +let kExternalFunction = 0; +let kExternalTable = 1; +let kExternalMemory = 2; +let kExternalGlobal = 3; + +let kTableZero = 0; +let kMemoryZero = 0; + +// Useful signatures +let kSig_i_i = makeSig([kWasmI32], [kWasmI32]); +let kSig_l_l = makeSig([kWasmI64], [kWasmI64]); +let kSig_i_l = makeSig([kWasmI64], [kWasmI32]); +let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]); +let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +let kSig_v_iiii = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []); +let kSig_f_ff = makeSig([kWasmF32, kWasmF32], [kWasmF32]); +let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]); +let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]); +let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]); +let kSig_v_v = makeSig([], []); +let kSig_i_v = makeSig([], [kWasmI32]); +let kSig_l_v = makeSig([], [kWasmI64]); +let kSig_f_v = makeSig([], [kWasmF32]); +let kSig_d_v = makeSig([], [kWasmF64]); +let kSig_v_i = makeSig([kWasmI32], []); +let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []); +let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []); +let kSig_v_l = makeSig([kWasmI64], []); +let kSig_v_d = makeSig([kWasmF64], []); +let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []); +let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []); + +let kSig_v_f = makeSig([kWasmF32], []); +let kSig_f_f = makeSig([kWasmF32], [kWasmF32]); +let kSig_f_d = makeSig([kWasmF64], [kWasmF32]); +let kSig_d_d = makeSig([kWasmF64], [kWasmF64]); + +function makeSig(params, results) { + return {params: params, results: results}; +} + +function makeSig_v_x(x) { + return makeSig([x], []); +} + +function makeSig_v_xx(x) { + return makeSig([x, x], []); +} + +function makeSig_r_v(r) { + return makeSig([], [r]); +} + +function makeSig_r_x(r, x) { + return makeSig([x], [r]); +} + +function makeSig_r_xx(r, x) { + return makeSig([x, x], [r]); +} + +// Opcodes +let kExprUnreachable = 0x00; +let kExprNop = 0x01; +let kExprBlock = 0x02; +let kExprLoop = 0x03; +let kExprIf = 0x04; +let kExprElse = 0x05; +let kExprTry = 0x06; +let kExprCatch = 0x07; +let kExprThrow = 0x08; +let kExprEnd = 0x0b; +let kExprBr = 0x0c; +let kExprBrIf = 0x0d; +let kExprBrTable = 0x0e; +let kExprReturn = 0x0f; +let kExprCallFunction = 0x10; +let kExprCallIndirect = 0x11; +let kExprDrop = 0x1a; +let kExprSelect = 0x1b; +let kExprGetLocal = 0x20; +let kExprSetLocal = 0x21; +let kExprTeeLocal = 0x22; +let kExprGetGlobal = 0x23; +let kExprSetGlobal = 0x24; +let kExprI32LoadMem = 0x28; +let kExprI64LoadMem = 0x29; +let kExprF32LoadMem = 0x2a; +let kExprF64LoadMem = 0x2b; +let kExprI32LoadMem8S = 0x2c; +let kExprI32LoadMem8U = 0x2d; +let kExprI32LoadMem16S = 0x2e; +let kExprI32LoadMem16U = 0x2f; +let kExprI64LoadMem8S = 0x30; +let kExprI64LoadMem8U = 0x31; +let kExprI64LoadMem16S = 0x32; +let kExprI64LoadMem16U = 0x33; +let kExprI64LoadMem32S = 0x34; +let kExprI64LoadMem32U = 0x35; +let kExprI32StoreMem = 0x36; +let kExprI64StoreMem = 0x37; +let kExprF32StoreMem = 0x38; +let kExprF64StoreMem = 0x39; +let kExprI32StoreMem8 = 0x3a; +let kExprI32StoreMem16 = 0x3b; +let kExprI64StoreMem8 = 0x3c; +let kExprI64StoreMem16 = 0x3d; +let kExprI64StoreMem32 = 0x3e; +let kExprMemorySize = 0x3f; +let kExprMemoryGrow = 0x40; +let kExprI32Const = 0x41; +let kExprI64Const = 0x42; +let kExprF32Const = 0x43; +let kExprF64Const = 0x44; +let kExprI32Eqz = 0x45; +let kExprI32Eq = 0x46; +let kExprI32Ne = 0x47; +let kExprI32LtS = 0x48; +let kExprI32LtU = 0x49; +let kExprI32GtS = 0x4a; +let kExprI32GtU = 0x4b; +let kExprI32LeS = 0x4c; +let kExprI32LeU = 0x4d; +let kExprI32GeS = 0x4e; +let kExprI32GeU = 0x4f; +let kExprI64Eqz = 0x50; +let kExprI64Eq = 0x51; +let kExprI64Ne = 0x52; +let kExprI64LtS = 0x53; +let kExprI64LtU = 0x54; +let kExprI64GtS = 0x55; +let kExprI64GtU = 0x56; +let kExprI64LeS = 0x57; +let kExprI64LeU = 0x58; +let kExprI64GeS = 0x59; +let kExprI64GeU = 0x5a; +let kExprF32Eq = 0x5b; +let kExprF32Ne = 0x5c; +let kExprF32Lt = 0x5d; +let kExprF32Gt = 0x5e; +let kExprF32Le = 0x5f; +let kExprF32Ge = 0x60; +let kExprF64Eq = 0x61; +let kExprF64Ne = 0x62; +let kExprF64Lt = 0x63; +let kExprF64Gt = 0x64; +let kExprF64Le = 0x65; +let kExprF64Ge = 0x66; +let kExprI32Clz = 0x67; +let kExprI32Ctz = 0x68; +let kExprI32Popcnt = 0x69; +let kExprI32Add = 0x6a; +let kExprI32Sub = 0x6b; +let kExprI32Mul = 0x6c; +let kExprI32DivS = 0x6d; +let kExprI32DivU = 0x6e; +let kExprI32RemS = 0x6f; +let kExprI32RemU = 0x70; +let kExprI32And = 0x71; +let kExprI32Ior = 0x72; +let kExprI32Xor = 0x73; +let kExprI32Shl = 0x74; +let kExprI32ShrS = 0x75; +let kExprI32ShrU = 0x76; +let kExprI32Rol = 0x77; +let kExprI32Ror = 0x78; +let kExprI64Clz = 0x79; +let kExprI64Ctz = 0x7a; +let kExprI64Popcnt = 0x7b; +let kExprI64Add = 0x7c; +let kExprI64Sub = 0x7d; +let kExprI64Mul = 0x7e; +let kExprI64DivS = 0x7f; +let kExprI64DivU = 0x80; +let kExprI64RemS = 0x81; +let kExprI64RemU = 0x82; +let kExprI64And = 0x83; +let kExprI64Ior = 0x84; +let kExprI64Xor = 0x85; +let kExprI64Shl = 0x86; +let kExprI64ShrS = 0x87; +let kExprI64ShrU = 0x88; +let kExprI64Rol = 0x89; +let kExprI64Ror = 0x8a; +let kExprF32Abs = 0x8b; +let kExprF32Neg = 0x8c; +let kExprF32Ceil = 0x8d; +let kExprF32Floor = 0x8e; +let kExprF32Trunc = 0x8f; +let kExprF32NearestInt = 0x90; +let kExprF32Sqrt = 0x91; +let kExprF32Add = 0x92; +let kExprF32Sub = 0x93; +let kExprF32Mul = 0x94; +let kExprF32Div = 0x95; +let kExprF32Min = 0x96; +let kExprF32Max = 0x97; +let kExprF32CopySign = 0x98; +let kExprF64Abs = 0x99; +let kExprF64Neg = 0x9a; +let kExprF64Ceil = 0x9b; +let kExprF64Floor = 0x9c; +let kExprF64Trunc = 0x9d; +let kExprF64NearestInt = 0x9e; +let kExprF64Sqrt = 0x9f; +let kExprF64Add = 0xa0; +let kExprF64Sub = 0xa1; +let kExprF64Mul = 0xa2; +let kExprF64Div = 0xa3; +let kExprF64Min = 0xa4; +let kExprF64Max = 0xa5; +let kExprF64CopySign = 0xa6; +let kExprI32ConvertI64 = 0xa7; +let kExprI32SConvertF32 = 0xa8; +let kExprI32UConvertF32 = 0xa9; +let kExprI32SConvertF64 = 0xaa; +let kExprI32UConvertF64 = 0xab; +let kExprI64SConvertI32 = 0xac; +let kExprI64UConvertI32 = 0xad; +let kExprI64SConvertF32 = 0xae; +let kExprI64UConvertF32 = 0xaf; +let kExprI64SConvertF64 = 0xb0; +let kExprI64UConvertF64 = 0xb1; +let kExprF32SConvertI32 = 0xb2; +let kExprF32UConvertI32 = 0xb3; +let kExprF32SConvertI64 = 0xb4; +let kExprF32UConvertI64 = 0xb5; +let kExprF32ConvertF64 = 0xb6; +let kExprF64SConvertI32 = 0xb7; +let kExprF64UConvertI32 = 0xb8; +let kExprF64SConvertI64 = 0xb9; +let kExprF64UConvertI64 = 0xba; +let kExprF64ConvertF32 = 0xbb; +let kExprI32ReinterpretF32 = 0xbc; +let kExprI64ReinterpretF64 = 0xbd; +let kExprF32ReinterpretI32 = 0xbe; +let kExprF64ReinterpretI64 = 0xbf; + +class Binary { + constructor() { + this.length = 0; + this.buffer = new Uint8Array(8192); + } + + ensure_space(needed) { + if (this.buffer.length - this.length >= needed) return; + let new_capacity = this.buffer.length * 2; + while (new_capacity - this.length < needed) new_capacity *= 2; + let new_buffer = new Uint8Array(new_capacity); + new_buffer.set(this.buffer); + this.buffer = new_buffer; + } + + trunc_buffer() { + return this.buffer = this.buffer.slice(0, this.length); + } + + reset() { + this.length = 0; + } -class Binary extends Array { emit_u8(val) { - this.push(val); + this.ensure_space(1); + this.buffer[this.length++] = val; } emit_u16(val) { - this.push(val & 0xff); - this.push((val >> 8) & 0xff); + this.ensure_space(2); + this.buffer[this.length++] = val; + this.buffer[this.length++] = val >> 8; } emit_u32(val) { - this.push(val & 0xff); - this.push((val >> 8) & 0xff); - this.push((val >> 16) & 0xff); - this.push((val >> 24) & 0xff); + this.ensure_space(4); + this.buffer[this.length++] = val; + this.buffer[this.length++] = val >> 8; + this.buffer[this.length++] = val >> 16; + this.buffer[this.length++] = val >> 24; } - emit_u32v(val) { - while (true) { + emit_leb(val, max_len) { + this.ensure_space(max_len); + for (let i = 0; i < max_len; ++i) { let v = val & 0xff; val = val >>> 7; if (val == 0) { - this.push(v); - break; + this.buffer[this.length++] = v; + return; } - this.push(v | 0x80); + this.buffer[this.length++] = v | 0x80; } + throw new Error("Leb value exceeds maximum length of " + max_len); + } + + emit_u32v(val) { + this.emit_leb(val, kMaxVarInt32Size); + } + + emit_u64v(val) { + this.emit_leb(val, kMaxVarInt64Size); } emit_bytes(data) { - for (let i = 0; i < data.length; i++) { - this.push(data[i] & 0xff); - } + this.ensure_space(data.length); + this.buffer.set(data, this.length); + this.length += data.length; } emit_string(string) { @@ -61,21 +418,22 @@ class Binary extends Array { } emit_header() { - this.push(kWasmH0, kWasmH1, kWasmH2, kWasmH3, - kWasmV0, kWasmV1, kWasmV2, kWasmV3); + this.emit_bytes([ + kWasmH0, kWasmH1, kWasmH2, kWasmH3, kWasmV0, kWasmV1, kWasmV2, kWasmV3 + ]); } emit_section(section_code, content_generator) { // Emit section name. this.emit_u8(section_code); // Emit the section to a temporary buffer: its full length isn't know yet. - let section = new Binary; + const section = new Binary; content_generator(section); // Emit section length. this.emit_u32v(section.length); // Copy the temporary buffer. // Avoid spread because {section} can be huge. - for (let b of section) this.push(b); + this.emit_bytes(section.trunc_buffer()); } } @@ -167,8 +525,9 @@ class WasmModuleBuilder { } addType(type) { - // TODO: canonicalize types? this.types.push(type); + var pl = type.params.length; // should have params + var rl = type.results.length; // should have results return this.types.length - 1; } @@ -187,28 +546,28 @@ class WasmModuleBuilder { return func; } - addImport(module = "", name, type) { + addImport(module, name, type) { let type_index = (typeof type) == "number" ? type : this.addType(type); this.imports.push({module: module, name: name, kind: kExternalFunction, type: type_index}); return this.num_imported_funcs++; } - addImportedGlobal(module = "", name, type) { + addImportedGlobal(module, name, type) { let o = {module: module, name: name, kind: kExternalGlobal, type: type, mutable: false} this.imports.push(o); return this.num_imported_globals++; } - addImportedMemory(module = "", name, initial = 0, maximum) { + addImportedMemory(module, name, initial = 0, maximum) { let o = {module: module, name: name, kind: kExternalMemory, initial: initial, maximum: maximum}; this.imports.push(o); return this; } - addImportedTable(module = "", name, initial, maximum) { + addImportedTable(module, name, initial, maximum) { let o = {module: module, name: name, kind: kExternalTable, initial: initial, maximum: maximum}; this.imports.push(o); @@ -263,17 +622,7 @@ class WasmModuleBuilder { return this; } - // TODO(ssauleau): legacy, remove this - setFunctionTableLength(length) { - return this.setTableBounds(length); - } - - // TODO(ssauleau): legacy, remove this - setTableLength(min, max = undefined) { - return this.setTableBounds(min, max); - } - - toArray(debug = false) { + toBuffer(debug = false) { let binary = new Binary; let wasm = this; @@ -394,22 +743,12 @@ class WasmModuleBuilder { case kWasmF32: section.emit_u8(kExprF32Const); f32_view[0] = global.init; - section.emit_u8(byte_view[0]); - section.emit_u8(byte_view[1]); - section.emit_u8(byte_view[2]); - section.emit_u8(byte_view[3]); + section.emit_bytes(f32_bytes_view); break; case kWasmF64: section.emit_u8(kExprF64Const); f64_view[0] = global.init; - section.emit_u8(byte_view[0]); - section.emit_u8(byte_view[1]); - section.emit_u8(byte_view[2]); - section.emit_u8(byte_view[3]); - section.emit_u8(byte_view[4]); - section.emit_u8(byte_view[5]); - section.emit_u8(byte_view[6]); - section.emit_u8(byte_view[7]); + section.emit_bytes(f64_bytes_view); break; } } else { @@ -443,7 +782,7 @@ class WasmModuleBuilder { } // Add start function section. - if (wasm.start_index != undefined) { + if (wasm.start_index !== undefined) { if (debug) print("emitting start function @ " + binary.length); binary.emit_section(kStartSectionCode, section => { section.emit_u32v(wasm.start_index); @@ -480,7 +819,9 @@ class WasmModuleBuilder { if (debug) print("emitting code @ " + binary.length); binary.emit_section(kCodeSectionCode, section => { section.emit_u32v(wasm.functions.length); + let header = new Binary; for (let func of wasm.functions) { + header.reset(); // Function body length will be patched later. let local_decls = []; let l = func.locals; @@ -500,7 +841,6 @@ class WasmModuleBuilder { } } - let header = new Binary; header.emit_u32v(local_decls.length); for (let decl of local_decls) { header.emit_u32v(decl.count); @@ -508,7 +848,7 @@ class WasmModuleBuilder { } section.emit_u32v(header.length + func.body.length); - section.emit_bytes(header); + section.emit_bytes(header.trunc_buffer()); section.emit_bytes(func.body); } }); @@ -562,24 +902,51 @@ class WasmModuleBuilder { }); } - return binary; + return binary.trunc_buffer(); } - toBuffer(debug = false) { - let bytes = this.toArray(debug); - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; i++) { - let val = bytes[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[i] = val | 0; - } - return new Uint8Array(buffer); + toArray(debug = false) { + return Array.from(this.toBuffer(debug)); } - instantiate(...args) { - let module = new WebAssembly.Module(this.toBuffer()); - let instance = new WebAssembly.Instance(module, ...args); + instantiate(ffi) { + let module = this.toModule(); + let instance = new WebAssembly.Instance(module, ffi); return instance; } + + asyncInstantiate(ffi) { + return WebAssembly.instantiate(this.toBuffer(), ffi) + .then(({module, instance}) => instance); + } + + toModule(debug = false) { + return new WebAssembly.Module(this.toBuffer(debug)); + } +} + +function wasmI32Const(val) { + let bytes = [kExprI32Const]; + for (let i = 0; i < 4; ++i) { + bytes.push(0x80 | ((val >> (7 * i)) & 0x7f)); + } + bytes.push((val >> (7 * 4)) & 0x7f); + return bytes; +} + +function wasmF32Const(f) { + f32_view[0] = f; + return [ + kExprF32Const, f32_bytes_view[0], f32_bytes_view[1], f32_bytes_view[2], + f32_bytes_view[3] + ]; +} + +function wasmF64Const(f) { + f64_view[0] = f; + return [ + kExprF64Const, f64_bytes_view[0], f64_bytes_view[1], f64_bytes_view[2], + f64_bytes_view[3], f64_bytes_view[4], f64_bytes_view[5], f64_bytes_view[6], + f64_bytes_view[7] + ]; } diff --git a/tests/wpt/web-platform-tests/wasm/webapi/body.any.js b/tests/wpt/web-platform-tests/wasm/webapi/body.any.js index 65cb78e7503c..58f75b86e578 100644 --- a/tests/wpt/web-platform-tests/wasm/webapi/body.any.js +++ b/tests/wpt/web-platform-tests/wasm/webapi/body.any.js @@ -1,5 +1,4 @@ // META: global=window,worker -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js for (const method of ["compileStreaming", "instantiateStreaming"]) { diff --git a/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.js b/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.js index b1efba31e919..9556247e75f4 100644 --- a/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.js +++ b/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming-bad-imports.any.js @@ -1,5 +1,4 @@ // META: global=window,worker -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/bad-imports.js diff --git a/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming.any.js b/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming.any.js index daec185484fb..cf3a5e7331f3 100644 --- a/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming.any.js +++ b/tests/wpt/web-platform-tests/wasm/webapi/instantiateStreaming.any.js @@ -1,5 +1,4 @@ // META: global=window,worker -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js // META: script=/wasm/jsapi/assertions.js // META: script=/wasm/jsapi/instanceTestFactory.js diff --git a/tests/wpt/web-platform-tests/wasm/webapi/invalid-code.any.js b/tests/wpt/web-platform-tests/wasm/webapi/invalid-code.any.js index e30b7cf33945..522f4233f57b 100644 --- a/tests/wpt/web-platform-tests/wasm/webapi/invalid-code.any.js +++ b/tests/wpt/web-platform-tests/wasm/webapi/invalid-code.any.js @@ -1,5 +1,4 @@ // META: global=window,worker -// META: script=/wasm/jsapi/wasm-constants.js // META: script=/wasm/jsapi/wasm-module-builder.js let emptyModuleBinary;