From cbaf7dc3a41fcfd87da5fb12329495cc3e93a7dc Mon Sep 17 00:00:00 2001 From: ldm0 Date: Fri, 20 Nov 2026 04:41:25 +0800 Subject: [PATCH] test: consolidate browser API regression fixtures Combine the fixture changes from #3271, #3272, #3274, #3275, #3276, #3277. --- ...dow_error_payload_before_later_module.html | 14 +- .../runtime/performance_measure_observer.html | 17 +- .../tests/fixtures/runtime/pipe_disturbed.js | 150 +++++++++--------- ..._browsing_context_navigation_identity.html | 32 ++-- ..._context_pending_navigation_coherence.html | 6 +- .../script_vm/tests/credential_container.js | 5 +- .../fixtures/payload-event-dictionary.js | 16 +- 7 files changed, 130 insertions(+), 110 deletions(-) diff --git a/moli-core/tests/fixtures/runtime/parser_owned_module_tla_exotic_rejection_reports_window_error_payload_before_later_module.html b/moli-core/tests/fixtures/runtime/parser_owned_module_tla_exotic_rejection_reports_window_error_payload_before_later_module.html index 11db7ca9480..6dc6bddd041 100644 --- a/moli-core/tests/fixtures/runtime/parser_owned_module_tla_exotic_rejection_reports_window_error_payload_before_later_module.html +++ b/moli-core/tests/fixtures/runtime/parser_owned_module_tla_exotic_rejection_reports_window_error_payload_before_later_module.html @@ -5,10 +5,14 @@ window.parserOwnedModuleTlaPayloadOrder = []; window.addEventListener("error", (event) => { window.parserOwnedModuleTlaPayloadOrder.push("window-error"); + window.parserOwnedModuleTlaPayloadErrorMessageMatches = Boolean( + typeof event.message === "string" && event.message.length > 0, + ); window.parserOwnedModuleTlaPayloadErrorIdentityMatches = - event.error === window.parserOwnedModuleTlaPayloadReason; - window.parserOwnedModuleTlaPayloadErrorMessageMatches = - typeof event.message === "string" && event.message.length > 0; + event.error === window.parserOwnedModuleTlaPayloadReason && + Object.getPrototypeOf(event.error) === null && + !Object.hasOwn(event.error, "message") && + !Object.hasOwn(event.error, "fileName"); window.parserOwnedModuleTlaPayloadFilenameMatches = typeof event.filename === "string" && event.filename.includes( @@ -20,8 +24,8 @@ type="module" onerror="window.parserOwnedModuleTlaPayloadOrder.push('script-error');" > - window.parserOwnedModuleTlaPayloadReason = Object.create(null); - await Promise.reject(window.parserOwnedModuleTlaPayloadReason); + const reason = window.parserOwnedModuleTlaPayloadReason = Object.create(null); + await Promise.reject(reason); diff --git a/moli-core/tests/fixtures/runtime/window_child_browsing_context_pending_navigation_coherence.html b/moli-core/tests/fixtures/runtime/window_child_browsing_context_pending_navigation_coherence.html index 532550ac0f3..7f609198196 100644 --- a/moli-core/tests/fixtures/runtime/window_child_browsing_context_pending_navigation_coherence.html +++ b/moli-core/tests/fixtures/runtime/window_child_browsing_context_pending_navigation_coherence.html @@ -1,9 +1,10 @@ - diff --git a/moli-renderer-v8/src/script_vm/tests/credential_container.js b/moli-renderer-v8/src/script_vm/tests/credential_container.js index 422b955e663..267b59d4e2a 100644 --- a/moli-renderer-v8/src/script_vm/tests/credential_container.js +++ b/moli-renderer-v8/src/script_vm/tests/credential_container.js @@ -160,8 +160,9 @@ await rejection(name, container, [{publicKey, signal: controller({}).signal}], TypeErrorCtor); }); } - if (typeof w.SharedArrayBuffer === 'function') { - for (const [index, binary] of [new w.SharedArrayBuffer(2), new Uint8Array(new w.SharedArrayBuffer(2)), new DataView(new w.SharedArrayBuffer(2))].entries()) { + { + const SharedBuffer = new w.WebAssembly.Memory({shared:true,initial:1,maximum:1}).buffer.constructor; + for (const [index, binary] of [new SharedBuffer(2), new Uint8Array(new SharedBuffer(2)), new DataView(new SharedBuffer(2))].entries()) { await run(name + '/reject shared BufferSource/' + index, async () => { const publicKey = name === 'create' ? validCreation() : validRequest(); publicKey.challenge = binary; await rejection(name, container, [{publicKey, signal: controller({}).signal}], TypeErrorCtor); diff --git a/moli-renderer-v8/tests/fixtures/payload-event-dictionary.js b/moli-renderer-v8/tests/fixtures/payload-event-dictionary.js index 765257ca9d3..af70a2b07fd 100644 --- a/moli-renderer-v8/tests/fixtures/payload-event-dictionary.js +++ b/moli-renderer-v8/tests/fixtures/payload-event-dictionary.js @@ -53,8 +53,20 @@ Object.defineProperty(promise, 'constructor', {get() {throw Error('must not get constructor');}}); assert(new PromiseRejectionEvent('audit', {promise}).promise === promise, 'native Promise ignores public constructor'); let thenRead = 0; - const resolved = new PromiseRejectionEvent('audit', {promise: {get then() {thenRead++; throw reason;}}}).promise; - assert(thenRead === 1 && await resolved.then(() => false, e => e === reason), 'thenable rejection'); + const thenable = {get then() {thenRead++; throw reason;}}; + const converted = new PromiseRejectionEvent('audit', {promise: thenable}).promise; + assert(converted instanceof Promise && thenRead === 1, 'thenable resolved once'); + let rejection;try {await converted;} catch (e) {rejection=e;} + assert(rejection === reason, 'thenable rejection identity'); + for (const value of [null, 7, 'promise', true]) { + const converted = new PromiseRejectionEvent('audit', {promise: value}).promise; + assert(converted instanceof Promise && await converted === value, 'primitive resolution'); + } + for (const bad of [undefined]) { + let caught; + try { new PromiseRejectionEvent('audit', {promise: bad}); } catch (e) { caught = e; } + assert(caught instanceof TypeError, 'promise payload requires an object'); + } assert(new TrackEvent('audit').track === null && new SubmitEvent('audit').submitter === null, 'nullable payload defaults'); const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); let caught;