From a02ee55d0381b9148837a97360e50eb0d0b66a54 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 4 Oct 2019 20:45:17 +0000 Subject: [PATCH] Bug 1556663 [wpt PR 17159] - Add optional test for cloning of error stacks, a=testonly Automatic update from web-platform-tests Add optional test for cloning of error stacks Supplements https://github.com/web-platform-tests/wpt/pull/17095. Follows https://github.com/whatwg/html/pull/4665 and https://github.com/heycam/webidl/pull/732. -- wpt-commits: 1da6bed5d8c4c38200383b86928b7be68bfb87da wpt-pr: 17159 UltraBlame original commit: d0647ab7df5d71c33b5c35b8b4ce69940975639e --- .../safe-passing-of-structured-data/echo.js | 15 - .../resources/echo-iframe.html | 0 .../resources/echo-worker.js | 0 .../identity-not-preserved.html | 58 ++- .../shared-array-buffers/no-transferring.html | 3 + ...cloning-error-stack-optional.sub.window.js | 469 ++++++++++++++++++ .../structured_clone_bigint.html | 4 + .../structuredclone_0.html | 4 + 8 files changed, 528 insertions(+), 25 deletions(-) delete mode 100644 testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/echo.js rename testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/{shared-array-buffers => }/resources/echo-iframe.html (100%) rename testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/{shared-array-buffers => }/resources/echo-worker.js (100%) create mode 100644 testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/echo.js b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/echo.js deleted file mode 100644 index 626a1c0dfb3e2..0000000000000 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/echo.js +++ /dev/null @@ -1,15 +0,0 @@ -onmessage -= -function -( -ev -) -{ -postMessage -( -ev -. -data -) -; -} diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/echo-iframe.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/resources/echo-iframe.html similarity index 100% rename from testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/echo-iframe.html rename to testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/resources/echo-iframe.html diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/echo-worker.js b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/resources/echo-worker.js similarity index 100% rename from testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/resources/echo-worker.js rename to testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/resources/echo-worker.js diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html index 0fc52bbdff65c..7f739ba5cb939 100644 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/identity-not-preserved.html @@ -121,6 +121,23 @@ src = " +/ +common +/ +utils +. +js +" +> +< +/ +script +> +< +script +src += +" resources / test @@ -161,6 +178,13 @@ > { const +testId += +token +( +) +; +const sab = new @@ -196,7 +220,7 @@ ! = = -1 +testId ) { return @@ -225,10 +249,8 @@ postMessage ( { -sab testId -: -1 +sab } " * @@ -267,6 +289,13 @@ > { const +testId += +token +( +) +; +const sab = new @@ -281,6 +310,9 @@ Worker ( " +. +. +/ resources / echo @@ -318,7 +350,7 @@ ! = = -2 +testId ) { return @@ -348,8 +380,6 @@ ( { testId -: -2 sab } ) @@ -379,6 +409,13 @@ > { const +testId += +token +( +) +; +const sab = new @@ -413,7 +450,7 @@ ! = = -3 +testId ) { return @@ -470,8 +507,6 @@ ( { testId -: -3 sab } " @@ -487,6 +522,9 @@ src = " +. +. +/ resources / echo diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html index 909bedda5cea8..fabeecd8375d8 100644 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/no-transferring.html @@ -215,6 +215,9 @@ Worker ( " +. +. +/ resources / echo diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js new file mode 100644 index 0000000000000..6091901d16bc3 --- /dev/null +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js @@ -0,0 +1,469 @@ +stackTests +( +( +) += +> +{ +return +new +Error +( +' +some +message +' +) +; +} +' +page +- +created +Error +' +) +; +stackTests +( +( +) += +> +{ +return +new +DOMException +( +' +InvalidStateError +' +' +some +message +' +) +; +} +' +page +- +created +DOMException +' +) +; +stackTests +( +( +) += +> +{ +try +{ +Object +. +defineProperty +( +) +; +} +catch +( +e +) +{ +return +e +; +} +} +' +JS +- +engine +- +created +TypeError +' +) +; +stackTests +( +( +) += +> +{ +try +{ +HTMLParagraphElement +. +prototype +. +align +; +} +catch +( +e +) +{ +return +e +; +} +} +' +web +API +- +created +TypeError +' +) +; +stackTests +( +( +) += +> +{ +try +{ +document +. +createElement +( +' +' +) +; +} +catch +( +e +) +{ +return +e +; +} +} +' +web +API +- +created +DOMException +' +) +; +function +stackTests +( +errorFactory +description +) +{ +async_test +( +t += +> +{ +const +error += +errorFactory +( +) +; +const +originalStack += +error +. +stack +; +if +( +! +originalStack +) +{ +t +. +done +( +) +; +return +; +} +const +worker += +new +Worker +( +' +resources +/ +echo +- +worker +. +js +' +) +; +worker +. +onmessage += +t +. +step_func_done +( +e += +> +{ +assert_equals +( +e +. +data +. +stack +originalStack +) +; +} +) +; +worker +. +postMessage +( +error +) +; +} +description ++ +' +( +worker +) +' +) +; +async_test +( +t += +> +{ +const +thisTestId += +token +( +) +; +const +error += +errorFactory +( +) +; +const +originalStack += +error +. +stack +; +if +( +! +originalStack +) +{ +t +. +done +( +) +; +return +; +} +const +iframe += +document +. +createElement +( +' +iframe +' +) +; +window +. +addEventListener +( +' +message +' +t +. +step_func +( +e += +> +{ +if +( +e +. +data +. +testId += += += +thisTestId +) +{ +assert_equals +( +e +. +data +. +error +. +stack +originalStack +) +; +t +. +done +( +) +; +} +} +) +) +; +iframe +. +onload += +t +. +step_func +( +( +) += +> +{ +iframe +. +contentWindow +. +postMessage +( +{ +error +testId +: +thisTestId +} +" +* +" +) +; +} +) +; +const +crossSiteEchoIFrame += +new +URL +( +' +resources +/ +echo +- +iframe +. +html +' +location +. +href +) +; +crossSiteEchoIFrame +. +hostname += +' +{ +{ +hosts +[ +alt +] +[ +www1 +] +} +} +' +; +iframe +. +src += +crossSiteEchoIFrame +; +document +. +body +. +append +( +iframe +) +; +} +description ++ +' +( +cross +- +site +iframe +) +' +) +; +} diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_bigint.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_bigint.html index b4ce61fd8d3fb..bf8ae7fa2a3b7 100644 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_bigint.html +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structured_clone_bigint.html @@ -276,7 +276,11 @@ " . / +resources +/ echo +- +worker . js " diff --git a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html index ff91d498d0dfe..13078ffc2eeba 100644 --- a/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html +++ b/testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0.html @@ -218,7 +218,11 @@ " . / +resources +/ echo +- +worker . js "