From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../event-loops/fully_active_document.window.js | 29 + .../scripting/event-loops/microtask_after_raf.html | 57 ++ .../event-loops/microtask_after_script.html | 55 ++ .../scripting/event-loops/resources/common.js | 20 + .../scripting/event-loops/resources/iframe.html | 7 + .../event-loops/resources/page-with-frame.html | 1 + .../task_microtask_ordering-manual.html | 64 ++ .../event-loops/task_microtask_ordering.html | 85 ++ .../webappapis/scripting/events/body-onload.html | 20 + ...le-event-handler-lexical-scopes-form-owner.html | 48 + .../compile-event-handler-lexical-scopes.html | 167 ++++ .../compile-event-handler-settings-objects.html | 69 ++ .../compile-event-handler-symbol-unscopables.html | 71 ++ .../scripting/events/contextmenu-event-manual.htm | 21 + .../events/event-handler-all-global-events.html | 88 ++ .../event-handler-attributes-body-window.html | 18 + .../event-handler-attributes-frameset-window.html | 30 + .../event-handler-attributes-windowless-body.html | 71 ++ .../events/event-handler-handleEvent-ignored.html | 38 + .../scripting/events/event-handler-javascript.html | 20 + .../events/event-handler-onmove-01.tentative.html | 17 + .../events/event-handler-onmove-02.tentative.html | 24 + .../scripting/events/event-handler-onresize.html | 38 + .../body-element-synthetic-errorevent.html | 57 ++ .../body-element-synthetic-event.html | 29 + .../document-synthetic-errorevent.html | 60 ++ .../document-synthetic-event.html | 30 + .../frameset-element-synthetic-errorevent.html | 64 ++ .../frameset-element-synthetic-event.html | 36 + .../resources/frameset-frame.html | 4 + .../resources/no-op-worker.js | 1 + .../resources/worker-with-syntax-error.js | 1 + .../script-element.html | 67 ++ .../synthetic-errorevent-click.html | 78 ++ .../synthetic-errorevent-click.worker.js | 22 + .../window-runtime-error.html | 48 + .../window-synthetic-errorevent.html | 57 ++ .../window-synthetic-event.html | 30 + .../worker.html | 63 ++ .../workerglobalscope-runtime-error.worker.js | 40 + ...orkerglobalscope-synthetic-errorevent.worker.js | 49 ++ .../workerglobalscope-synthetic-event.worker.js | 22 + .../event-handler-processing-algorithm-manual.html | 62 ++ .../events/event-handler-processing-algorithm.html | 60 ++ .../events/event-handler-removal.window.js | 76 ++ .../scripting/events/event-handler-sourcetext.html | 40 + .../events/event-handler-spec-example.window.js | 55 ++ .../events/eventhandler-cancellation.html | 76 ++ .../events/inline-event-handler-ordering.html | 53 ++ ...-uncompiled-raw-handler-compiled-late.window.js | 16 + ...-uncompiled-raw-handler-compiled-once.window.js | 14 + ...uncompiled-raw-handler-keeps-position.window.js | 20 + .../events/messageevent-constructor.https.html | 114 +++ .../events/onerroreventhandler-frame.html | 56 ++ .../scripting/events/onerroreventhandler.html | 11 + ...led-event-handler-settings-objects-support.html | 12 + .../events/resources/event-handler-body.js | 61 ++ .../scripting/events/resources/open-window.html | 4 + ...iled_event_handler_with_scripting_disabled.html | 21 + .../processing-model-2/addEventListener.html | 32 + .../body-onerror-compile-error-data-url.html | 37 + .../body-onerror-compile-error.html | 39 + .../body-onerror-runtime-error.html | 39 + .../compile-error-cross-origin-setInterval.html | 25 + .../compile-error-cross-origin-setTimeout.html | 23 + .../compile-error-cross-origin.html | 38 + .../processing-model-2/compile-error-data-url.html | 36 + .../compile-error-in-attribute.html | 39 + .../compile-error-in-body-onerror.html | 28 + .../compile-error-in-setInterval.html | 39 + .../compile-error-in-setTimeout.html | 36 + .../compile-error-same-origin-with-hash.html | 36 + .../compile-error-same-origin.html | 36 + .../processing-model-2/compile-error.html | 38 + .../atomics-wait-async.https.any.js | 25 + .../atomics-wait-async.https.any.js.headers | 2 + .../requires-failure.https.any.js | 11 + .../requires-success.any.js | 9 + .../resources/notify-worker.js | 5 + .../resources/notify-worker.js.headers | 1 + ...promise-job-entry-different-function-realm.html | 112 +++ .../promise-job-entry.html | 101 +++ .../promise-job-incumbent.html | 164 ++++ .../resources/README.md | 5 + .../resources/current/current.html | 4 + .../current/resources/window-to-open.html | 3 + .../resources/function/function.html | 3 + .../function/resources/window-to-open.html | 3 + .../resources/promise-job-entry-incumbent.html | 15 + .../resources/promise-job-incumbent-incumbent.html | 27 + .../resources/promise-job-incumbent-resolver.html | 9 + .../resources/relevant/relevant.html | 14 + .../relevant/resources/window-to-open.html | 3 + .../resources/resources/window-to-open.html | 3 + .../resources/window-to-open.html | 3 + .../runtime-error-cross-origin-setInterval.html | 25 + .../runtime-error-cross-origin-setTimeout.html | 23 + .../runtime-error-cross-origin.html | 38 + .../processing-model-2/runtime-error-data-url.html | 36 + .../runtime-error-in-attribute.html | 39 + .../runtime-error-in-body-onerror.html | 25 + .../runtime-error-in-setInterval.html | 39 + .../runtime-error-in-setTimeout.html | 36 + .../runtime-error-in-window-onerror.html | 29 + .../runtime-error-same-origin-with-hash.html | 36 + .../runtime-error-same-origin.html | 36 + .../processing-model-2/runtime-error.html | 38 + .../support/syntax-error-in-setInterval.js | 8 + .../support/syntax-error-in-setTimeout.js | 7 + .../processing-model-2/support/syntax-error.js | 1 + .../support/undefined-variable-in-setInterval.js | 8 + .../support/undefined-variable-in-setTimeout.js | 7 + .../support/undefined-variable.js | 1 + .../allow-crossorigin.html | 30 + .../disallow-crossorigin.html | 96 ++ .../promise-rejection-event-constructor.html | 50 ++ .../promise-rejection-event-during-parse.html | 44 + ...promise-rejection-events-attached-in-event.html | 31 + .../promise-rejection-events-iframe.html | 146 ++++ .../promise-rejection-events-onerror.html | 47 + .../promise-rejection-events.dedicatedworker.html | 11 + .../promise-rejection-events.html | 8 + ...omise-rejection-events.serviceworker.https.html | 12 + .../promise-rejection-events.sharedworker.html | 11 + .../promise-resolution-order.html | 70 ++ .../support/promise-access-control.py | 18 + .../support/promise-rejection-events.js | 961 +++++++++++++++++++++ .../window-onerror-parse-error.html | 40 + .../window-onerror-runtime-error-throw.html | 43 + .../window-onerror-runtime-error.html | 43 + ...onerror-with-cross-frame-event-listeners-1.html | 33 + ...onerror-with-cross-frame-event-listeners-2.html | 33 + ...onerror-with-cross-frame-event-listeners-3.html | 33 + ...onerror-with-cross-frame-event-listeners-4.html | 33 + ...onerror-with-cross-frame-event-listeners-5.html | 25 + .../scripting/reporterror-cross-realm-method.html | 30 + .../reporterror-in-detached-window-crash.html | 11 + .../html/webappapis/scripting/reporterror.any.js | 49 ++ 138 files changed, 5950 insertions(+) create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/fully_active_document.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_raf.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_script.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/common.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/iframe.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/page-with-frame.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/body-onload.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-settings-objects.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-symbol-unscopables.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/contextmenu-event-manual.htm create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-all-global-events.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-handleEvent-ignored.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-javascript.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-01.tentative.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-02.tentative.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onresize.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-event.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-event.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-event.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/frameset-frame.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/no-op-worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/worker-with-syntax-error.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/script-element.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-runtime-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-errorevent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-event.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/worker.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-runtime-error.worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-errorevent.worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-event.worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-manual.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-removal.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-sourcetext.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/event-handler-spec-example.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/eventhandler-cancellation.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/inline-event-handler-ordering.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/messageevent-constructor.https.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler-frame.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/resources/compiled-event-handler-settings-objects-support.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/resources/event-handler-body.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/resources/open-window.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/addEventListener.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-data-url.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-runtime-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-data-url.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-body-onerror.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js.headers create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js.headers create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-data-url.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-attribute.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-body-onerror.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-window-onerror.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setInterval.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setTimeout.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setInterval.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setTimeout.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-iframe.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.dedicatedworker.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.serviceworker.https.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.sharedworker.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-rejection-events.js create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-parse-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error-throw.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/reporterror-cross-realm-method.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/reporterror-in-detached-window-crash.html create mode 100644 testing/web-platform/tests/html/webappapis/scripting/reporterror.any.js (limited to 'testing/web-platform/tests/html/webappapis/scripting') diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/fully_active_document.window.js b/testing/web-platform/tests/html/webappapis/scripting/event-loops/fully_active_document.window.js new file mode 100644 index 0000000000..950a8a29ee --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/fully_active_document.window.js @@ -0,0 +1,29 @@ +async_test(t => { + const frame = document.body.appendChild(document.createElement("iframe")); + t.add_cleanup(() => frame.remove()); + + frame.onload = t.step_func(() => { + // Right now the doc of the iframe inside "frame" is still "fully-active". + // Navigate parent away, making the child iframe's doc "active", not "fully-active". + frame.contentWindow.location = "/common/blank.html"; + + frame.onload = t.step_func(() => { + // The child iframe's doc is "active", not "fully-active", and should not receive the storage notification. + sessionStorage.setItem('myCat', 'Tom'); + t.step_timeout(() => { + // The child iframe's hasn't received the storage notification. + assert_equals(sessionStorage.getItem("Received storage event"), null); + frame.contentWindow.history.go(-1); + t.step_timeout(() => { + // Now The child iframe's doc is "fully-active" again, + // the previously not run storage task should now have been run. + assert_equals(sessionStorage.getItem("Received storage event"), "true"); + t.done(); + }, 1000); + }, 1000); + }); + }); + + frame.src = "resources/page-with-frame.html"; +}, "Tasks for documents that are not fully active are stored, and run when the documents becomes fully-active"); + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_raf.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_raf.html new file mode 100644 index 0000000000..824dbc4b92 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_raf.html @@ -0,0 +1,57 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_script.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_script.html new file mode 100644 index 0000000000..799a0de605 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/microtask_after_script.html @@ -0,0 +1,55 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/common.js b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/common.js new file mode 100644 index 0000000000..e2279f93dd --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/common.js @@ -0,0 +1,20 @@ +// Helper for tests that just want to verify the ordering of a series of events. +// Usage: +// log_test(function(t, log) { +// log('first'); +// log('second'); +// }, ['first', 'second'], 'Ordinal numbers are ordinal'); + +function log_test(func, expected, description) { + async_test(function(t) { + var actual = []; + function log(entry) { + actual.push(entry); + if (expected.length <= actual.length) { + assert_array_equals(actual, expected); + t.done(); + } + } + func(t, t.step_func(log)); + }, description); +} diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/iframe.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/iframe.html new file mode 100644 index 0000000000..32e4862360 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/iframe.html @@ -0,0 +1,7 @@ + +Childframe + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/page-with-frame.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/page-with-frame.html new file mode 100644 index 0000000000..f13170576e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/resources/page-with-frame.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html new file mode 100644 index 0000000000..ed2f70e196 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering-manual.html @@ -0,0 +1,64 @@ + +Task and Microtask Ordering + + + + + + + +

Click on the inner box:

+
+
+
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering.html b/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering.html new file mode 100644 index 0000000000..c14a043b6a --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/event-loops/task_microtask_ordering.html @@ -0,0 +1,85 @@ + +Task and Microtask Ordering + + + + + + +
+
+
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/body-onload.html b/testing/web-platform/tests/html/webappapis/scripting/events/body-onload.html new file mode 100644 index 0000000000..1e43d1ccd4 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/body-onload.html @@ -0,0 +1,20 @@ + +HTMLBodyElement.onload + + + + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html new file mode 100644 index 0000000000..e31bd2496a --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html @@ -0,0 +1,48 @@ + + +Form's lexical scope is established only for form-associated elements + + + + + +
+ + img +
div
+ x-foo +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html new file mode 100644 index 0000000000..ed6c006651 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes.html @@ -0,0 +1,167 @@ + + +Lexical scopes when compiling an inline event handler + + + + + + + + + + + + +
+ +
+ + + + + + +
+ + +
+ + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-settings-objects.html b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-settings-objects.html new file mode 100644 index 0000000000..29ac9b8ced --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-settings-objects.html @@ -0,0 +1,69 @@ + + +Entry and incumbent settings objects when compiling an inline event handler + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-symbol-unscopables.html b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-symbol-unscopables.html new file mode 100644 index 0000000000..c840059e68 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/compile-event-handler-symbol-unscopables.html @@ -0,0 +1,71 @@ + + +Inline event handler scopes exclude unscopable properties + + + + + + + + +
+ + + + +
+ + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/contextmenu-event-manual.htm b/testing/web-platform/tests/html/webappapis/scripting/events/contextmenu-event-manual.htm new file mode 100644 index 0000000000..2331fa17ee --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/contextmenu-event-manual.htm @@ -0,0 +1,21 @@ + + + + HTML contextmenu event is a MouseEvent + + + + + +
Trigger context menu in this box.
+
+ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-all-global-events.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-all-global-events.html new file mode 100644 index 0000000000..ee8c34ced3 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-all-global-events.html @@ -0,0 +1,88 @@ + +GlobalEventHandlers + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html new file mode 100644 index 0000000000..e8055d99f3 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-body-window.html @@ -0,0 +1,18 @@ + +HTMLBodyElement event handlers + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html new file mode 100644 index 0000000000..b583eca52d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html @@ -0,0 +1,30 @@ + + +event handlers + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html new file mode 100644 index 0000000000..9b81d42ff7 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html @@ -0,0 +1,71 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-handleEvent-ignored.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-handleEvent-ignored.html new file mode 100644 index 0000000000..8039bac7ad --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-handleEvent-ignored.html @@ -0,0 +1,38 @@ + + +"handleEvent" property of EventHandler should be ignored + + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-javascript.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-javascript.html new file mode 100644 index 0000000000..657a37839d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-javascript.html @@ -0,0 +1,20 @@ + +Event handler with labels + + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-01.tentative.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-01.tentative.html new file mode 100644 index 0000000000..e4454a20a1 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-01.tentative.html @@ -0,0 +1,17 @@ + +Window Object 'onmove' + + + + + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-02.tentative.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-02.tentative.html new file mode 100644 index 0000000000..a751f39d30 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onmove-02.tentative.html @@ -0,0 +1,24 @@ + +Window Object 'onmove' + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onresize.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onresize.html new file mode 100644 index 0000000000..0e44e7272f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-onresize.html @@ -0,0 +1,38 @@ + +HTMLBodyElement.onresize + + + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent.html new file mode 100644 index 0000000000..9ab0020ec3 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-errorevent.html @@ -0,0 +1,57 @@ + + +Event handlers processing algorithm: error events + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-event.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-event.html new file mode 100644 index 0000000000..9ed2638416 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/body-element-synthetic-event.html @@ -0,0 +1,29 @@ + + +Event handlers processing algorithm: error events + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html new file mode 100644 index 0000000000..4165beaf63 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html @@ -0,0 +1,60 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-event.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-event.html new file mode 100644 index 0000000000..6cf44e9d35 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-event.html @@ -0,0 +1,30 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent.html new file mode 100644 index 0000000000..20d87dbacf --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-errorevent.html @@ -0,0 +1,64 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-event.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-event.html new file mode 100644 index 0000000000..2fdca3ad86 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/frameset-element-synthetic-event.html @@ -0,0 +1,36 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/frameset-frame.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/frameset-frame.html new file mode 100644 index 0000000000..028be4919e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/frameset-frame.html @@ -0,0 +1,4 @@ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/no-op-worker.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/no-op-worker.js new file mode 100644 index 0000000000..3918c74e44 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/no-op-worker.js @@ -0,0 +1 @@ +"use strict"; diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/worker-with-syntax-error.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/worker-with-syntax-error.js new file mode 100644 index 0000000000..dc9a0dbf4a --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/resources/worker-with-syntax-error.js @@ -0,0 +1 @@ +< 3; diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/script-element.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/script-element.html new file mode 100644 index 0000000000..f3ef1165e0 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/script-element.html @@ -0,0 +1,67 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.html new file mode 100644 index 0000000000..75a1772485 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.html @@ -0,0 +1,78 @@ + + +Event handlers processing algorithm: click events using ErrorEvent + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.worker.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.worker.js new file mode 100644 index 0000000000..177a99e2ce --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/synthetic-errorevent-click.worker.js @@ -0,0 +1,22 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +setup({ allow_uncaught_exception: true }); + +promise_test(t => { + self.onerror = t.step_func((...args) => { + assert_equals(args.length, 1); + return true; + }); + + const eventWatcher = new EventWatcher(t, self, "click"); + const promise = eventWatcher.wait_for("click").then(e => { + assert_equals(e.defaultPrevented, false); + }); + + self.dispatchEvent(new ErrorEvent("click", { cancelable: true })); + + return promise; +}, "error event is normal (return true does not cancel; one arg) on WorkerGlobalScope, with a synthetic ErrorEvent"); + +done(); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-runtime-error.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-runtime-error.html new file mode 100644 index 0000000000..1b387ca81c --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-runtime-error.html @@ -0,0 +1,48 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-errorevent.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-errorevent.html new file mode 100644 index 0000000000..2d62d8a204 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-errorevent.html @@ -0,0 +1,57 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-event.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-event.html new file mode 100644 index 0000000000..0bcc7defb7 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/window-synthetic-event.html @@ -0,0 +1,30 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/worker.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/worker.html new file mode 100644 index 0000000000..a8c0d97ce2 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/worker.html @@ -0,0 +1,63 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-runtime-error.worker.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-runtime-error.worker.js new file mode 100644 index 0000000000..264fef810d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-runtime-error.worker.js @@ -0,0 +1,40 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +setup({ allow_uncaught_exception: true }); + +promise_test(t => { + self.onerror = t.step_func((...args) => { + assert_greater_than(args.length, 1); + return true; + }); + + const eventWatcher = new EventWatcher(t, self, "error"); + const promise = eventWatcher.wait_for("error").then(e => { + assert_equals(e.defaultPrevented, true); + }); + + setTimeout(() => thisFunctionDoesNotExist(), 0); + + return promise; +}, "error event is weird (return true cancels; many args) on WorkerGlobalScope, with a runtime error"); + +promise_test(t => { + self.onerror = t.step_func(function (message, filename, lineno, colno, error) { + assert_equals(arguments.length, 5, "There must be exactly 5 arguments"); + assert_equals(typeof message, "string", "message argument must be a string"); + assert_equals(typeof filename, "string", "filename argument must be a string"); + assert_equals(typeof lineno, "number", "lineno argument must be a number"); + assert_equals(typeof colno, "number", "colno argument must be a number"); + assert_equals(typeof error, "object", "error argument must be an object"); + assert_equals(error.constructor, ReferenceError, "error argument must be a ReferenceError"); + return true; + }); + + setTimeout(() => thisFunctionDoesNotExist(), 0); + + const eventWatcher = new EventWatcher(t, self, "error"); + return eventWatcher.wait_for("error"); +}, "error event has the right 5 args on WorkerGlobalScope, with a runtime error"); + +done(); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-errorevent.worker.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-errorevent.worker.js new file mode 100644 index 0000000000..a14f6e01a9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-errorevent.worker.js @@ -0,0 +1,49 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +setup({ allow_uncaught_exception: true }); + +promise_test(t => { + self.onerror = t.step_func((...args) => { + assert_greater_than(args.length, 1); + return true; + }); + + const eventWatcher = new EventWatcher(t, self, "error"); + const promise = eventWatcher.wait_for("error").then(e => { + assert_equals(e.defaultPrevented, true); + }); + + self.dispatchEvent(new ErrorEvent("error", { cancelable: true })); + + return promise; +}, "error event is weird (return true cancels; many args) on WorkerGlobalScope, with a synthetic ErrorEvent"); + +promise_test(t => { + const theError = { the: "error object" }; + + self.onerror = t.step_func(function (message, filename, lineno, colno, error) { + assert_equals(arguments.length, 5, "There must be exactly 5 arguments"); + assert_equals(message, "message"); + assert_equals(filename, "filename"); + assert_equals(lineno, 1); + assert_equals(colno, 2); + assert_equals(error, theError); + return true; + }); + + const eventWatcher = new EventWatcher(t, self, "error"); + const promise = eventWatcher.wait_for("error"); + + self.dispatchEvent(new ErrorEvent("error", { + message: "message", + filename: "filename", + lineno: 1, + colno: 2, + error: theError + })); + + return promise; +}, "error event has the right 5 args on WorkerGlobalScope, with a synthetic ErrorEvent"); + +done(); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-event.worker.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-event.worker.js new file mode 100644 index 0000000000..a3e16ded88 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-error/workerglobalscope-synthetic-event.worker.js @@ -0,0 +1,22 @@ +"use strict"; +importScripts("/resources/testharness.js"); + +setup({ allow_uncaught_exception: true }); + +promise_test(t => { + self.onerror = t.step_func((...args) => { + assert_equals(args.length, 1); + return true; + }); + + const eventWatcher = new EventWatcher(t, self, "error"); + const promise = eventWatcher.wait_for("error").then(e => { + assert_equals(e.defaultPrevented, false); + }); + + self.dispatchEvent(new Event("error", { cancelable: true })); + + return promise; +}, "error event is normal (return true does not cancel; one arg) on WorkerGlobalScope, with a synthetic Event"); + +done(); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-manual.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-manual.html new file mode 100644 index 0000000000..205e876c1d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm-manual.html @@ -0,0 +1,62 @@ + + +Event handlers processing algorithm: manual tests + + + + + + + +
+ +

Mouseover these four divs

+ +
+
+ +
+
+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html new file mode 100644 index 0000000000..f5423d7ed4 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html @@ -0,0 +1,60 @@ + +Event handlers processing algorithm + + + +
+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-removal.window.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-removal.window.js new file mode 100644 index 0000000000..a20e2ec1d2 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-removal.window.js @@ -0,0 +1,76 @@ +let firstEventHandler; + +test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.setAttribute('onclick', uncalled); // event handler is activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 2) }), false); + button.onclick = null; // but de-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 4); }); // and re-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 5) }), false); + button.click() + assert_equals(button.getAttribute("onclick"), uncalled) + assert_equals(i, 5); +}, "Event handler set through content attribute should be removed when they are set to null."); + +let happened = 0; +test(() => { + var script = "happened++;"; + var button = document.createElement('button'); + button.setAttribute('onclick', script); // event handler is activated here + button.onclick = null; // but de-activated here + assert_equals(button.getAttribute("onclick"), script) + button.setAttribute('onclick', script); // and re-activated here + button.click() + assert_equals(happened, 1); +}, "Event handler set through content attribute should be re-activated even if content is the same."); + +test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.setAttribute('onclick', uncalled); // event handler is activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 2) }), false); + button.removeAttribute('onclick'); // but de-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 4); }); // and re-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 5) }), false); + button.click() + assert_equals(i, 5); +}, "Event handler set through content attribute should be deactivated when the content attribute is removed."); +test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.onclick = t.unreached_func('First event handler.'); // event handler is activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 2) }), false); + button.onclick = null; // but de-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 4); }); // and re-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 5) }), false); + button.click() + assert_equals(i, 5); +}, "Event handler set through IDL should be deactivated when the IDL attribute is set to null."); +test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.onclick = t.unreached_func('First event handler.'); // event handler is activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.removeAttribute('onclick'); // and NOT de-activated here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 4) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 2); }); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 5) }), false); + button.click() + assert_equals(i, 5); +}, "Event handler set through IDL should NOT be deactivated when the content attribute is removed."); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-sourcetext.html b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-sourcetext.html new file mode 100644 index 0000000000..57555faa7b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-sourcetext.html @@ -0,0 +1,40 @@ + + +Test the sourceText of event handlers + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-spec-example.window.js b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-spec-example.window.js new file mode 100644 index 0000000000..abf46882aa --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/event-handler-spec-example.window.js @@ -0,0 +1,55 @@ +var objects = [{}, function() {}, new Number(42), new String()]; +var primitives = [42, null, undefined, ""]; +var firstEventHandler; +objects.forEach(function(object) { + test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.onclick = object; // event handler listener is registered here + assert_equals(button.onclick, object); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 2) }), false); + button.setAttribute('onclick', uncalled); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 1); }); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 4) }), false); + button.click() + assert_equals(button.getAttribute("onclick"), uncalled) + assert_equals(i, 4); + }, "Event handler listeners should be registered when they are first set to an object value " + + "(" + format_value(object) + ")."); +}); +primitives.forEach(function(primitive) { + test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.onclick = primitive; + assert_equals(button.onclick, null); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.setAttribute('onclick', uncalled); // event handler listener is registered here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 2); }); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 4) }), false); + button.click() + assert_equals(button.getAttribute("onclick"), uncalled) + assert_equals(i, 4); + }, "Event handler listeners should be registered when they are first set to an object value " + + "(" + format_value(primitive) + ")."); +}); +test(t => { + var i = 0; + firstEventHandler = t.unreached_func('First event handler.'); + var uncalled = "firstEventHandler();"; + var button = document.createElement('button'); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 1) }), false); + button.setAttribute('onclick', uncalled); // event handler listener is registered here + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 3) }), false); + button.onclick = t.step_func(() => { assert_equals(++i, 2); }); + button.addEventListener('click', t.step_func(() => { assert_equals(++i, 4) }), false); + button.click() + assert_equals(button.getAttribute("onclick"), uncalled) + assert_equals(i, 4); +}, "Event handler listeners should be registered when they are first set to an object value."); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/eventhandler-cancellation.html b/testing/web-platform/tests/html/webappapis/scripting/events/eventhandler-cancellation.html new file mode 100644 index 0000000000..6be581fa24 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/eventhandler-cancellation.html @@ -0,0 +1,76 @@ + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/inline-event-handler-ordering.html b/testing/web-platform/tests/html/webappapis/scripting/events/inline-event-handler-ordering.html new file mode 100644 index 0000000000..aae0f1abf8 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/inline-event-handler-ordering.html @@ -0,0 +1,53 @@ + + +Inline event handlers retain their ordering even when invalid + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js new file mode 100644 index 0000000000..2892a4c3ab --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.js @@ -0,0 +1,16 @@ +setup({ allow_uncaught_exception: true }); + +test(function() { + var events = []; + window.onerror = function() { + events.push("error"); + }; + + var div = document.createElement("div"); + div.addEventListener("click", function (e) { events.push("click 1") }); + div.setAttribute("onclick", "}"); + div.addEventListener("click", function (e) { events.push("click 2") }); + div.dispatchEvent(new Event("click")); + assert_equals(div.onclick, null); + assert_array_equals(events, ["click 1", "error", "click 2"]); +}, "Invalid uncompiled raw handlers should only be compiled when about to call them"); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js new file mode 100644 index 0000000000..b39b54b0e9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.js @@ -0,0 +1,14 @@ +setup({ allow_uncaught_exception: true }); + +var errors = 0; +window.onerror = function() { + errors++; +}; + +test(function() { + var e = document.body; + e.setAttribute("onclick", "window.open("); + assert_equals(e.onclick, null); + assert_equals(e.onclick, null); + assert_equals(errors, 1); +}, "Invalid uncompiled raw handlers should only be compiled once"); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js new file mode 100644 index 0000000000..f9443bf99a --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.js @@ -0,0 +1,20 @@ +setup({ allow_uncaught_exception: true }); + +test(function() { + var events = []; + window.onerror = function() { + events.push("error"); + }; + + var div = document.createElement("div"); + div.addEventListener("click", function (e) { events.push("click 1"); }); + div.setAttribute("onclick", "}"); + div.addEventListener("click", function (e) { events.push("click 3"); }); + assert_equals(div.onclick, null); + assert_array_equals(events, ["error"]); + + events = []; + div.onclick = function (e) { events.push("click 2"); }; + div.dispatchEvent(new Event("click")); + assert_array_equals(events, ["click 1", "click 2", "click 3"]); +}, "Compiling invalid uncompiled raw handlers should keep the position in event listener list"); diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/messageevent-constructor.https.html b/testing/web-platform/tests/html/webappapis/scripting/events/messageevent-constructor.https.html new file mode 100644 index 0000000000..2d62019dbf --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/messageevent-constructor.https.html @@ -0,0 +1,114 @@ + +MessageEvent constructor + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler-frame.html b/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler-frame.html new file mode 100644 index 0000000000..79e4af3020 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler-frame.html @@ -0,0 +1,56 @@ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler.html b/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler.html new file mode 100644 index 0000000000..60fc674d57 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/onerroreventhandler.html @@ -0,0 +1,11 @@ + + +OnErrorEventHandler + ErrorEvent is treated differently + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/resources/compiled-event-handler-settings-objects-support.html b/testing/web-platform/tests/html/webappapis/scripting/events/resources/compiled-event-handler-settings-objects-support.html new file mode 100644 index 0000000000..d40c0b9cce --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/resources/compiled-event-handler-settings-objects-support.html @@ -0,0 +1,12 @@ + + +This will be in an iframe + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/resources/event-handler-body.js b/testing/web-platform/tests/html/webappapis/scripting/events/resources/event-handler-body.js new file mode 100644 index 0000000000..d7889e230e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/resources/event-handler-body.js @@ -0,0 +1,61 @@ +const windowReflectingBodyElementEventHandlerSet = + new Set(['blur', 'error', 'focus', 'load', 'resize', 'scroll']); + +function handlersInInterface(mainIDL, name) { + return mainIDL.find(idl => idl.name === name).members.map(member => member.name.slice(2)); +} + +const handlersListPromise = fetch("/interfaces/html.idl").then(res => res.text()).then(htmlIDL => { + const parsedHTMLIDL = WebIDL2.parse(htmlIDL); + const windowEventHandlers = handlersInInterface(parsedHTMLIDL, "WindowEventHandlers"); + const globalEventHandlers = handlersInInterface(parsedHTMLIDL, "GlobalEventHandlers"); + + const shadowedHandlers = [ + ...windowReflectingBodyElementEventHandlerSet, + ...windowEventHandlers + ]; + const notShadowedHandlers = globalEventHandlers.filter(name => !windowReflectingBodyElementEventHandlerSet.has(name)); + return { + shadowedHandlers, + notShadowedHandlers + }; +}); + +function eventHandlerTest(shadowedHandlers, notShadowedHandlers, element) { + const altBody = document.createElement(element); + for (const [des, obj1, obj2, obj3, des1, des2, des3] of [ + ["document.body", document.body, altBody, window, "body", "alternative body", "window"], + [`document.createElement("${element}")`, altBody, document.body, window, "alternative body", "body", "window"], + ["window", window, document.body, altBody, "window", "body", "alternative body"] + ]) { + const f = () => 0; + + shadowedHandlers.forEach(handler => { + const eventHandler = obj1['on' + handler]; + test(() => { + obj1['on' + handler] = f; + assert_equals(obj2['on' + handler], f, `${des2} should reflect`); + assert_equals(obj3['on' + handler], f, `${des3} should reflect`); + }, `shadowed ${handler} (${des})`); + obj1['on' + handler] = eventHandler; + }); + + notShadowedHandlers.forEach(handler => { + const eventHandler = obj1['on' + handler]; + test(() => { + obj1['on' + handler] = f; + assert_equals(obj2['on' + handler], null, `${des2} should reflect`); + assert_equals(obj3['on' + handler], null, `${des3} should reflect`); + }, `not shadowed ${handler} (${des})`); + obj1['on' + handler] = eventHandler; + }); + + shadowedHandlers.forEach(handler => { + test(() => { + assert_equals(obj1['on' + handler], null, `${des1} should reflect changes to itself`); + assert_equals(obj2['on' + handler], null, `${des2} should reflect`); + assert_equals(obj3['on' + handler], null, `${des3} should reflect`); + }, `shadowed ${handler} removal (${des})`); + }); + } +} diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/resources/open-window.html b/testing/web-platform/tests/html/webappapis/scripting/events/resources/open-window.html new file mode 100644 index 0000000000..1d23263570 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/resources/open-window.html @@ -0,0 +1,4 @@ + + +This window will open during the course of the test +

Hello

diff --git a/testing/web-platform/tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html b/testing/web-platform/tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html new file mode 100644 index 0000000000..a912b32d7f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/events/uncompiled_event_handler_with_scripting_disabled.html @@ -0,0 +1,21 @@ + + +Uncompiled event handler check that scripting is enabled + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/addEventListener.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/addEventListener.html new file mode 100644 index 0000000000..dbb1cdd5a9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/addEventListener.html @@ -0,0 +1,32 @@ + + + + window.onerror - addEventListener + + + + +
+ + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-data-url.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-data-url.html new file mode 100644 index 0000000000..66e1dfed4d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error-data-url.html @@ -0,0 +1,37 @@ + + + + <body onerror> - compile error in <script src=data:...> + + + + + +
+ + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error.html new file mode 100644 index 0000000000..0f65f73999 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-compile-error.html @@ -0,0 +1,39 @@ + + + + <body onerror> - compile error in <script> + + + + + +
+ + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-runtime-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-runtime-error.html new file mode 100644 index 0000000000..faaddd9ed9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/body-onerror-runtime-error.html @@ -0,0 +1,39 @@ + + + + <body onerror> - runtime error in <script> + + + + + +
+ + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html new file mode 100644 index 0000000000..c4028e650b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setInterval.html @@ -0,0 +1,25 @@ + + + + window.onerror - compile error in cross-origin setInterval + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html new file mode 100644 index 0000000000..1eebf82fbb --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin-setTimeout.html @@ -0,0 +1,23 @@ + + + + window.onerror - compile error in cross-origin setTimeout + + + + +
+ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin.html new file mode 100644 index 0000000000..b7e989529f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-cross-origin.html @@ -0,0 +1,38 @@ + + + + window.onerror - compile error in <script src=//www1...> + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-data-url.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-data-url.html new file mode 100644 index 0000000000..08ce2f348f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-data-url.html @@ -0,0 +1,36 @@ + + + + window.onerror - compile error in <script src=data:...> + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.html new file mode 100644 index 0000000000..864d09fc1e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.html @@ -0,0 +1,39 @@ + + + + window.onerror - compile error in attribute + + + + +
+ +

+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-body-onerror.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-body-onerror.html new file mode 100644 index 0000000000..0b094e71c3 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-body-onerror.html @@ -0,0 +1,28 @@ + + + + window.onerror - compile error in <body onerror> + + + + + +
+ + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html new file mode 100644 index 0000000000..79ca7d524a --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html @@ -0,0 +1,39 @@ + + + + window.onerror - compile error in setInterval + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html new file mode 100644 index 0000000000..1bb730e134 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-in-setTimeout.html @@ -0,0 +1,36 @@ + + + + window.onerror - compile error in setTimeout + + + + +
+ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html new file mode 100644 index 0000000000..c367e6cb2f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html @@ -0,0 +1,36 @@ + + + + window.onerror - compile error in <script src=...> with hash + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin.html new file mode 100644 index 0000000000..71c28b584d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin.html @@ -0,0 +1,36 @@ + + + + window.onerror - compile error in <script src=...> + + + + +
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error.html new file mode 100644 index 0000000000..a4bdfd9c47 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/compile-error.html @@ -0,0 +1,38 @@ + + + + window.onerror - compile error in <script> + + + + +
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js new file mode 100644 index 0000000000..3a3ea40d77 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js @@ -0,0 +1,25 @@ +// META: global=window,dedicatedworker + +promise_test(async () => { + const sab = new SharedArrayBuffer(64); + const ta = new Int32Array(sab); + + const waitAsyncObj = Atomics.waitAsync(ta, 0, 0, 10); + assert_equals(waitAsyncObj.async, true); + const v = await waitAsyncObj.value; + assert_equals(v, "timed-out"); +}, `Atomics.waitAsync timeout in a ${self.constructor.name}`); + +promise_test(async () => { + const sab = new SharedArrayBuffer(64); + const ta = new Int32Array(sab); + + const waitAsyncObj = Atomics.waitAsync(ta, 0, 0); + assert_equals(waitAsyncObj.async, true); + + const worker = new Worker("resources/notify-worker.js"); + worker.postMessage(sab); + + const v = await waitAsyncObj.value; + assert_equals(v, "ok"); +}, `Atomics.waitAsync notification in a ${self.constructor.name}`); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js.headers b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js.headers new file mode 100644 index 0000000000..5f8621ef83 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/atomics-wait-async.https.any.js.headers @@ -0,0 +1,2 @@ +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Opener-Policy: same-origin diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js new file mode 100644 index 0000000000..fddf85dbed --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-failure.https.any.js @@ -0,0 +1,11 @@ +// META: global=window,serviceworker + +test(() => { + // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()` + const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer; + const ta = new Int32Array(sab); + + assert_throws_js(TypeError, () => { + Atomics.wait(ta, 0, 0, 10); + }); +}, `[[CanBlock]] in a ${self.constructor.name}`); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.js new file mode 100644 index 0000000000..0da449a7cf --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/requires-success.any.js @@ -0,0 +1,9 @@ +// META: global=dedicatedworker,sharedworker + +test(() => { + // See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()` + const sab = new WebAssembly.Memory({ shared:true, initial:1, maximum:1 }).buffer; + const ta = new Int32Array(sab); + + assert_equals(Atomics.wait(ta, 0, 0, 10), "timed-out"); +}, `[[CanBlock]] in a ${self.constructor.name}`); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js new file mode 100644 index 0000000000..2780e5bc34 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js @@ -0,0 +1,5 @@ +onmessage = (e) => { + const sab = e.data; + const ta = new Int32Array(sab); + Atomics.notify(ta, 0); +}; diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js.headers b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js.headers new file mode 100644 index 0000000000..6604450991 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/resources/notify-worker.js.headers @@ -0,0 +1 @@ +Cross-Origin-Embedder-Policy: require-corp diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html new file mode 100644 index 0000000000..71f03a4dcf --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry-different-function-realm.html @@ -0,0 +1,112 @@ + + +Entry settings object for promise jobs when the function realm is different from the test realm + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html new file mode 100644 index 0000000000..6d075d674c --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html @@ -0,0 +1,101 @@ + + +Entry settings object for promise jobs + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html new file mode 100644 index 0000000000..af00f834c1 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-incumbent.html @@ -0,0 +1,164 @@ + + +Incumbent settings object for promise jobs + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md new file mode 100644 index 0000000000..a89258a4e0 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/README.md @@ -0,0 +1,5 @@ +A couple notes about the files scattered in this `resources/` directory: + +* The nested directory structure is necessary here so that relative URL resolution can be tested; we need different sub-paths for each document. + +* The semi-duplicate `window-to-open.html`s scattered throughout are present because Firefox, at least, does not fire `Window` `load` events for 404s, so we want to ensure that no matter which global is used, `window`'s `load` event is hit and our tests can proceed. diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html new file mode 100644 index 0000000000..63d9c437fc --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/current.html @@ -0,0 +1,4 @@ + + +Current page used as a test helper + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html new file mode 100644 index 0000000000..1bc4cca9a3 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/current/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the current settings object is used this page will be opened diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html new file mode 100644 index 0000000000..15841d387d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/function.html @@ -0,0 +1,3 @@ + + +Realm for a "then" function used as a test helper diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html new file mode 100644 index 0000000000..3928c1f8aa --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/function/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the function's settings object is used this page will be opened diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html new file mode 100644 index 0000000000..3740c1467d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-entry-incumbent.html @@ -0,0 +1,15 @@ + + +Incumbent page used as a test helper + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html new file mode 100644 index 0000000000..57dd5dff10 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-incumbent.html @@ -0,0 +1,27 @@ + + +Incumbent page used as a test helper + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html new file mode 100644 index 0000000000..a730b9c3ce --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/promise-job-incumbent-resolver.html @@ -0,0 +1,9 @@ + + +Incumbent page used as a test helper + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html new file mode 100644 index 0000000000..f5965f2231 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/relevant.html @@ -0,0 +1,14 @@ + + +Relevant page used as a test helper + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html new file mode 100644 index 0000000000..4138b5a084 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/relevant/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the relevant settings object is used this page will be opened diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html new file mode 100644 index 0000000000..7743b9b578 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the incumbent settings object is used this page will be opened diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html new file mode 100644 index 0000000000..ce357937f5 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/resources/window-to-open.html @@ -0,0 +1,3 @@ + + +If the entry settings object is used this page will be opened diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html new file mode 100644 index 0000000000..8b92f7d148 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setInterval.html @@ -0,0 +1,25 @@ + + + + window.onerror - runtime error in cross-origin setInterval + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html new file mode 100644 index 0000000000..2e1a9d2315 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin-setTimeout.html @@ -0,0 +1,23 @@ + + + + window.onerror - runtime error in cross-origin setTimeout + + + + +
+ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin.html new file mode 100644 index 0000000000..d63aaa6d3b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-cross-origin.html @@ -0,0 +1,38 @@ + + + + window.onerror - runtime error in <script src=//www1...> + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-data-url.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-data-url.html new file mode 100644 index 0000000000..485ce90aa6 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-data-url.html @@ -0,0 +1,36 @@ + + + + window.onerror - runtime error in <script src=data:...> + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-attribute.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-attribute.html new file mode 100644 index 0000000000..b4f69da7a2 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-attribute.html @@ -0,0 +1,39 @@ + + + + window.onerror - runtime error in attribute + + + + +
+ +

+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-body-onerror.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-body-onerror.html new file mode 100644 index 0000000000..e0fd1dcbd5 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-body-onerror.html @@ -0,0 +1,25 @@ + + + + runtime error in <body onerror> + + + + + +
+ + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html new file mode 100644 index 0000000000..090e1dd78e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setInterval.html @@ -0,0 +1,39 @@ + + + + window.onerror - runtime error in setInterval + + + + +
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html new file mode 100644 index 0000000000..cebcd4346c --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-setTimeout.html @@ -0,0 +1,36 @@ + + + + window.onerror - runtime error in setTimeout + + + + +
+ + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-window-onerror.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-window-onerror.html new file mode 100644 index 0000000000..150a793b79 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-in-window-onerror.html @@ -0,0 +1,29 @@ + + + + runtime error in window.onerror + + + + +
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html new file mode 100644 index 0000000000..dc6ec059a5 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html @@ -0,0 +1,36 @@ + + + + window.onerror - runtime error in <script src=...> with hash + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin.html new file mode 100644 index 0000000000..8f3cfb70b2 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin.html @@ -0,0 +1,36 @@ + + + + window.onerror - runtime error in <script src=...> + + + + +
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error.html new file mode 100644 index 0000000000..7907494aa6 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/runtime-error.html @@ -0,0 +1,38 @@ + + + + window.onerror - runtime error in <script> + + + + +
+ + + + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setInterval.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setInterval.js new file mode 100644 index 0000000000..afec114458 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setInterval.js @@ -0,0 +1,8 @@ +interval = setInterval('{', 10); +step_timeout(function(){ + clearInterval(interval); + t.step(function(){ + assert_true(ran, 'ran'); + t.done(); + }); +}, 20); \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setTimeout.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setTimeout.js new file mode 100644 index 0000000000..427542b42e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error-in-setTimeout.js @@ -0,0 +1,7 @@ +setTimeout('{', 10); +setTimeout(function(){ + t.step(function(){ + assert_true(ran, 'ran'); + t.done(); + }); +}, 20); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error.js new file mode 100644 index 0000000000..0f74a6fca6 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/syntax-error.js @@ -0,0 +1 @@ +for (;) {} \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setInterval.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setInterval.js new file mode 100644 index 0000000000..c2a017a2ab --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setInterval.js @@ -0,0 +1,8 @@ +interval = setInterval('undefined_variable;', 10); +step_timeout(function(){ + clearInterval(interval); + t.step(function(){ + assert_true(ran, 'ran'); + t.done(); + }); +}, 20); \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setTimeout.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setTimeout.js new file mode 100644 index 0000000000..6fa54cda9f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable-in-setTimeout.js @@ -0,0 +1,7 @@ +setTimeout('undefined_variable;', 10); +setTimeout(function(){ + t.step(function(){ + assert_true(ran, 'ran'); + t.done(); + }); +}, 20); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable.js new file mode 100644 index 0000000000..e73a62ceda --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/support/undefined-variable.js @@ -0,0 +1 @@ +undefined_variable; \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html new file mode 100644 index 0000000000..7524604113 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html new file mode 100644 index 0000000000..d61618a53e --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html @@ -0,0 +1,96 @@ + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html new file mode 100644 index 0000000000..4319deee7b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html @@ -0,0 +1,50 @@ + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html new file mode 100644 index 0000000000..160dad9b36 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-during-parse.html @@ -0,0 +1,44 @@ + + +Promise rejection during initial parsing of document + + + + +

The script in this test is executed immediately while parsing is ongoing, and +cleaning +up after running script involves queueing a task on the DOM manipulation +task source to fire the unhandledrejection event. Parsing then +completes, immediately transitioning the document's readiness state to +"interactive," and queuing another task on the DOM manipulation task source to +transition the state to "complete." +

+ diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html new file mode 100644 index 0000000000..b151bd812f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html @@ -0,0 +1,31 @@ + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-iframe.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-iframe.html new file mode 100644 index 0000000000..c749eadef4 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-iframe.html @@ -0,0 +1,146 @@ + + + +

+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html new file mode 100644 index 0000000000..b6c02d27c9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html @@ -0,0 +1,47 @@ + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.dedicatedworker.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.dedicatedworker.html new file mode 100644 index 0000000000..b6a4a9f3e6 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.dedicatedworker.html @@ -0,0 +1,11 @@ + + +Promise rejection events tests: in a dedicated worker context + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html new file mode 100644 index 0000000000..2fdfe26025 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html @@ -0,0 +1,8 @@ + + +Promise rejection events tests: in a Window context + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.serviceworker.https.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.serviceworker.https.html new file mode 100644 index 0000000000..9d12125928 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.serviceworker.https.html @@ -0,0 +1,12 @@ + + +Promise rejection events tests: in a service worker context + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.sharedworker.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.sharedworker.html new file mode 100644 index 0000000000..d832d1822f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.sharedworker.html @@ -0,0 +1,11 @@ + + +Promise rejection events tests: in a shared worker context + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html new file mode 100644 index 0000000000..314063025f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-resolution-order.html @@ -0,0 +1,70 @@ + + +Promise rejection ordering + + + + +

A microtask checkpoint should notify about rejected promises. After +cleaning +up after running script involves running a microtask checkpoint. So the order of unhandledrejection +should occur before error2. +

+ + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py new file mode 100644 index 0000000000..cf8ed5e492 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-access-control.py @@ -0,0 +1,18 @@ +def main(request, response): + allow = request.GET.first(b"allow", b"false") + + headers = [(b"Content-Type", b"application/javascript")] + if allow != b"false": + headers.append((b"Access-Control-Allow-Origin", b"*")) + + body = b""" + function handleRejectedPromise(promise) { + promise.catch(() => {}); + } + + (function() { + new Promise(function(resolve, reject) { reject(42); }); + })(); + """ + + return headers, body diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-rejection-events.js b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-rejection-events.js new file mode 100644 index 0000000000..036e1784db --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/support/promise-rejection-events.js @@ -0,0 +1,961 @@ +'use strict'; + +if (self.importScripts) { + importScripts('/resources/testharness.js'); +} + +setup({ + allow_uncaught_exception: true +}); + +// +// Straightforward unhandledrejection tests +// +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.reject(e); +}, 'unhandledrejection: from Promise.reject'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = new Promise(function(_, reject) { + reject(e); + }); +}, 'unhandledrejection: from a synchronous rejection in new Promise'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = new Promise(function(_, reject) { + queueTask(function() { + reject(e); + }); + }); +}, 'unhandledrejection: from a task-delayed rejection'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = new Promise(function(_, reject) { + setTimeout(function() { + reject(e); + }, 1); + }); +}, 'unhandledrejection: from a setTimeout-delayed rejection'); + +async_test(function(t) { + var e = new Error(); + var e2 = new Error(); + var promise2; + + onUnhandledSucceed(t, e2, function() { return promise2; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + promise2 = Promise.reject(e).then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + throw e2; + }); +}, 'unhandledrejection: from a throw in a rejection handler chained off of Promise.reject'); + +async_test(function(t) { + var e = new Error(); + var e2 = new Error(); + var promise2; + + onUnhandledSucceed(t, e2, function() { return promise2; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + promise2 = new Promise(function(_, reject) { + setTimeout(function() { + reject(e); + }, 1); + }).then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + throw e2; + }); +}, 'unhandledrejection: from a throw in a rejection handler chained off of a setTimeout-delayed rejection'); + +async_test(function(t) { + var e = new Error(); + var e2 = new Error(); + var promise2; + + onUnhandledSucceed(t, e2, function() { return promise2; }); + + var promise = new Promise(function(_, reject) { + setTimeout(function() { + reject(e); + mutationObserverMicrotask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + promise2 = promise.then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + throw e2; + }); + }); + }, 1); + }); +}, 'unhandledrejection: from a throw in a rejection handler attached one microtask after a setTimeout-delayed rejection'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.resolve().then(function() { + return Promise.reject(e); + }); +}, 'unhandledrejection: from returning a Promise.reject-created rejection in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.resolve().then(function() { + throw e; + }); +}, 'unhandledrejection: from a throw in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.resolve().then(function() { + return new Promise(function(_, reject) { + setTimeout(function() { + reject(e); + }, 1); + }); + }); +}, 'unhandledrejection: from returning a setTimeout-delayed rejection in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.all([Promise.reject(e)]); +}, 'unhandledrejection: from Promise.reject, indirected through Promise.all'); + +async_test(function(t) { + var p; + + var unhandled = function(ev) { + if (ev.promise === p) { + t.step(function() { + assert_equals(ev.reason.name, 'InvalidStateError'); + assert_equals(ev.promise, p); + }); + t.done(); + } + }; + addEventListener('unhandledrejection', unhandled); + ensureCleanup(t, unhandled); + + p = createImageBitmap(new Blob()); +}, 'unhandledrejection: from createImageBitmap which is UA triggered'); + +// +// Negative unhandledrejection/rejectionhandled tests with immediate attachment +// + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = Promise.reject(e).then(unreached, function() {}); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = Promise.all([Promise.reject(e)]).then(unreached, function() {}); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from ' + + 'Promise.reject, indirecting through Promise.all'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = new Promise(function(_, reject) { + reject(e); + }).then(unreached, function() {}); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a synchronously-rejected ' + + 'promise created with new Promise'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = Promise.resolve().then(function() { + throw e; + }).then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + }); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from ' + + 'throwing in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = Promise.resolve().then(function() { + return Promise.reject(e); + }).then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + }); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from ' + + 'returning a Promise.reject-created promise in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = Promise.resolve().then(function() { + return new Promise(function(_, reject) { + setTimeout(function() { + reject(e); + }, 1); + }); + }).then(unreached, function(reason) { + t.step(function() { + assert_equals(reason, e); + }); + }); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from ' + + 'returning a setTimeout-delayed rejection in a fulfillment handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + queueTask(function() { + p = Promise.resolve().then(function() { + return Promise.reject(e); + }) + .catch(function() {}); + }); +}, 'no unhandledrejection/rejectionhandled: all inside a queued task, a rejection handler attached synchronously to ' + + 'a promise created from returning a Promise.reject-created promise in a fulfillment handler'); + +async_test(function(t) { + var p; + + onUnhandledFail(t, function() { return p; }); + + var unreached = t.unreached_func('promise should not be fulfilled'); + p = createImageBitmap(new Blob()).then(unreached, function() {}); +}, 'no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from ' + + 'createImageBitmap'); + +// +// Negative unhandledrejection/rejectionhandled tests with microtask-delayed attachment +// + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = Promise.reject(e); + mutationObserverMicrotask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function() {}); + }); +}, 'delayed handling: a microtask delay before attaching a handler prevents both events (Promise.reject-created ' + + 'promise)'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = new Promise(function(_, reject) { + reject(e); + }); + mutationObserverMicrotask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function() {}); + }); +}, 'delayed handling: a microtask delay before attaching a handler prevents both events (immediately-rejected new ' + + 'Promise-created promise)'); + +async_test(function(t) { + var e = new Error(); + var p1; + var p2; + + onUnhandledFail(t, function() { return p1; }); + onUnhandledFail(t, function() { return p2; }); + + p1 = new Promise(function(_, reject) { + mutationObserverMicrotask(function() { + reject(e); + }); + }); + p2 = Promise.all([p1]); + mutationObserverMicrotask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p2.then(unreached, function() {}); + }); +}, 'delayed handling: a microtask delay before attaching the handler, and before rejecting the promise, indirected ' + + 'through Promise.all'); + +// +// Negative unhandledrejection/rejectionhandled tests with nested-microtask-delayed attachment +// + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = Promise.reject(e); + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); +}, 'microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + queueTask(function() { + p = Promise.reject(e); + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); +}, 'microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, ' + + 'all inside a queueTask'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + setTimeout(function() { + p = Promise.reject(e); + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }, 0); +}, 'microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, ' + + 'all inside a setTimeout'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = Promise.reject(e); + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + p.catch(function() {}); + }); + }); + }); + }); +}, 'microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + queueTask(function() { + p = Promise.reject(e); + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); +}, 'microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, ' + + 'all inside a queueTask'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + setTimeout(function() { + p = Promise.reject(e); + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + Promise.resolve().then(function() { + mutationObserverMicrotask(function() { + p.catch(function() {}); + }); + }); + }); + }); + }, 0); +}, 'microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, ' + + 'all inside a setTimeout'); + + +// For workers, queueTask() involves posting tasks to other threads, so +// the following tests don't work there. + +if ('document' in self) { + // + // Negative unhandledrejection/rejectionhandled tests with task-delayed attachment + // + + async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + var _reject; + p = new Promise(function(_, reject) { + _reject = reject; + }); + _reject(e); + queueTask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function() {}); + }); + }, 'delayed handling: a task delay before attaching a handler prevents unhandledrejection'); + + async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = Promise.reject(e); + queueTask(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }, 'delayed handling: queueTask after promise creation/rejection, plus promise microtasks, is not too late to ' + + 'attach a rejection handler'); + + async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + queueTask(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); + p = Promise.reject(e); + }, 'delayed handling: queueTask before promise creation/rejection, plus many promise microtasks, is not too ' + + 'late to attach a rejection handler'); + + async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledFail(t, function() { return p; }); + + p = Promise.reject(e); + queueTask(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); + }, 'delayed handling: queueTask after promise creation/rejection, plus many promise microtasks, is not too ' + + 'late to attach a rejection handler'); +} + +// +// Positive unhandledrejection/rejectionhandled tests with delayed attachment +// + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + var _reject; + p = new Promise(function(_, reject) { + _reject = reject; + }); + _reject(e); + queueTask(function() { + queueTask(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function() {}); + }); + }); +}, 'delayed handling: a nested-task delay before attaching a handler causes unhandledrejection'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.reject(e); + queueTask(function() { + queueTask(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); +}, 'delayed handling: a nested-queueTask after promise creation/rejection, plus promise microtasks, is too ' + + 'late to attach a rejection handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + queueTask(function() { + queueTask(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); + }); + p = Promise.reject(e); +}, 'delayed handling: a nested-queueTask before promise creation/rejection, plus many promise microtasks, is ' + + 'too late to attach a rejection handler'); + +async_test(function(t) { + var e = new Error(); + var p; + + onUnhandledSucceed(t, e, function() { return p; }); + + p = Promise.reject(e); + queueTask(function() { + queueTask(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + Promise.resolve().then(function() { + p.catch(function() {}); + }); + }); + }); + }); + }); + }); +}, 'delayed handling: a nested-queueTask after promise creation/rejection, plus many promise microtasks, is ' + + 'too late to attach a rejection handler'); + +async_test(function(t) { + var unhandledPromises = []; + var unhandledReasons = []; + var e = new Error(); + var p; + + var unhandled = function(ev) { + if (ev.promise === p) { + t.step(function() { + unhandledPromises.push(ev.promise); + unhandledReasons.push(ev.reason); + }); + } + }; + var handled = function(ev) { + if (ev.promise === p) { + t.step(function() { + assert_array_equals(unhandledPromises, [p]); + assert_array_equals(unhandledReasons, [e]); + assert_equals(ev.promise, p); + assert_equals(ev.reason, e); + }); + } + }; + addEventListener('unhandledrejection', unhandled); + addEventListener('rejectionhandled', handled); + ensureCleanup(t, unhandled, handled); + + p = new Promise(function() { + throw e; + }); + setTimeout(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function(reason) { + assert_equals(reason, e); + setTimeout(function() { t.done(); }, 10); + }); + }, 10); +}, 'delayed handling: delaying handling by setTimeout(,10) will cause both events to fire'); + +async_test(function(t) { + var unhandledPromises = []; + var unhandledReasons = []; + var p; + + var unhandled = function(ev) { + if (ev.promise === p) { + t.step(function() { + unhandledPromises.push(ev.promise); + unhandledReasons.push(ev.reason.name); + }); + } + }; + var handled = function(ev) { + if (ev.promise === p) { + t.step(function() { + assert_array_equals(unhandledPromises, [p]); + assert_array_equals(unhandledReasons, ['InvalidStateError']); + assert_equals(ev.promise, p); + assert_equals(ev.reason.name, 'InvalidStateError'); + }); + } + }; + addEventListener('unhandledrejection', unhandled); + addEventListener('rejectionhandled', handled); + ensureCleanup(t, unhandled, handled); + + p = createImageBitmap(new Blob()); + setTimeout(function() { + var unreached = t.unreached_func('promise should not be fulfilled'); + p.then(unreached, function(reason) { + assert_equals(reason.name, 'InvalidStateError'); + setTimeout(function() { t.done(); }, 10); + }); + }, 10); +}, 'delayed handling: delaying handling rejected promise created from createImageBitmap will cause both events to fire'); + +// +// Miscellaneous tests about integration with the rest of the platform +// + +async_test(function(t) { + var e = new Error(); + var l = function(ev) { + var order = []; + mutationObserverMicrotask(function() { + order.push(1); + }); + setTimeout(function() { + order.push(2); + t.step(function() { + assert_array_equals(order, [1, 2]); + }); + t.done(); + }, 1); + }; + addEventListener('unhandledrejection', l); + ensureCleanup(t, l); + Promise.reject(e); +}, 'mutationObserverMicrotask vs. queueTask ordering is not disturbed inside unhandledrejection events'); + +// For workers, queueTask() involves posting tasks to other threads, so +// the following tests don't work there. + +if ('document' in self) { + + // For the next two see https://github.com/domenic/unhandled-rejections-browser-spec/issues/2#issuecomment-121121695 + // and the following comments. + + async_test(function(t) { + var sequenceOfEvents = []; + + addEventListener('unhandledrejection', l); + ensureCleanup(t, l); + + var p1 = Promise.reject(); + var p2; + queueTask(function() { + p2 = Promise.reject(); + queueTask(function() { + sequenceOfEvents.push('queueTask'); + checkSequence(); + }); + }); + + function l(ev) { + if (ev.promise === p1 || ev.promise === p2) { + sequenceOfEvents.push(ev.promise); + checkSequence(); + } + } + + function checkSequence() { + if (sequenceOfEvents.length === 3) { + t.step(function() { + assert_array_equals(sequenceOfEvents, [p1, 'queueTask', p2]); + }); + t.done(); + } + } + }, 'queueTask ordering vs. the task queued for unhandled rejection notification (1)'); + + async_test(function(t) { + var sequenceOfEvents = []; + + addEventListener('unhandledrejection', l); + ensureCleanup(t, l); + + var p2; + queueTask(function() { + p2 = Promise.reject(); + queueTask(function() { + sequenceOfEvents.push('queueTask'); + checkSequence(); + }); + }); + + function l(ev) { + if (ev.promise == p2) { + sequenceOfEvents.push(ev.promise); + checkSequence(); + } + } + + function checkSequence() { + if (sequenceOfEvents.length === 2) { + t.step(function() { + assert_array_equals(sequenceOfEvents, ['queueTask', p2]); + }); + t.done(); + } + } + }, 'queueTask ordering vs. the task queued for unhandled rejection notification (2)'); + + async_test(function(t) { + var sequenceOfEvents = []; + + + addEventListener('unhandledrejection', unhandled); + addEventListener('rejectionhandled', handled); + ensureCleanup(t, unhandled, handled); + + var p = Promise.reject(); + + function unhandled(ev) { + if (ev.promise === p) { + sequenceOfEvents.push('unhandled'); + checkSequence(); + setTimeout(function() { + queueTask(function() { + sequenceOfEvents.push('task before catch'); + checkSequence(); + }); + + p.catch(function() { + sequenceOfEvents.push('catch'); + checkSequence(); + }); + + queueTask(function() { + sequenceOfEvents.push('task after catch'); + checkSequence(); + }); + + sequenceOfEvents.push('after catch'); + checkSequence(); + }, 10); + } + } + + function handled(ev) { + if (ev.promise === p) { + sequenceOfEvents.push('handled'); + checkSequence(); + } + } + + function checkSequence() { + if (sequenceOfEvents.length === 6) { + t.step(function() { + assert_array_equals(sequenceOfEvents, + ['unhandled', 'after catch', 'catch', 'task before catch', 'handled', 'task after catch']); + }); + t.done(); + } + } + }, 'rejectionhandled is dispatched from a queued task, and not immediately'); +} + +// +// HELPERS +// + +// This function queues a task in "DOM manipulation task source" in window +// context, but not in workers. +function queueTask(f) { + if ('document' in self) { + var d = document.createElement("details"); + d.ontoggle = function() { + f(); + }; + d.setAttribute("open", ""); + } else { + // We need to fix this to use something that can queue tasks in + // "DOM manipulation task source" to ensure the order is correct + var channel = new MessageChannel(); + channel.port1.onmessage = function() { channel.port1.close(); f(); }; + channel.port2.postMessage('abusingpostmessageforfunandprofit'); + channel.port2.close(); + } +} + +function mutationObserverMicrotask(f) { + if ('document' in self) { + var observer = new MutationObserver(function() { f(); }); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + node.data = 'foo'; + } else { + // We don't have mutation observers on workers, so just post a promise-based + // microtask. + Promise.resolve().then(function() { f(); }); + } +} + +function onUnhandledSucceed(t, expectedReason, expectedPromiseGetter) { + var l = function(ev) { + if (ev.promise === expectedPromiseGetter()) { + t.step(function() { + assert_equals(ev.reason, expectedReason); + assert_equals(ev.promise, expectedPromiseGetter()); + }); + t.done(); + } + }; + addEventListener('unhandledrejection', l); + ensureCleanup(t, l); +} + +function onUnhandledFail(t, expectedPromiseGetter) { + var unhandled = function(evt) { + if (evt.promise === expectedPromiseGetter()) { + t.step(function() { + assert_unreached('unhandledrejection event is not supposed to be triggered'); + }); + } + }; + var handled = function(evt) { + if (evt.promise === expectedPromiseGetter()) { + t.step(function() { + assert_unreached('rejectionhandled event is not supposed to be triggered'); + }); + } + }; + addEventListener('unhandledrejection', unhandled); + addEventListener('rejectionhandled', handled); + ensureCleanup(t, unhandled, handled); + setTimeout(function() { + t.done(); + }, 10); +} + +function ensureCleanup(t, unhandled, handled) { + t.add_cleanup(function() { + if (unhandled) + removeEventListener('unhandledrejection', unhandled); + if (handled) + removeEventListener('rejectionhandled', handled); + }); +} + +done(); diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-parse-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-parse-error.html new file mode 100644 index 0000000000..3c21df49c9 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-parse-error.html @@ -0,0 +1,40 @@ + + + + window.onerror: parse errors + + + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error-throw.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error-throw.html new file mode 100644 index 0000000000..4b2bc1f22c --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error-throw.html @@ -0,0 +1,43 @@ + + + + window.onerror: runtime scripterrors + + + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error.html new file mode 100644 index 0000000000..1fdab521ae --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-runtime-error.html @@ -0,0 +1,43 @@ + + + + window.onerror: runtime scripterrors + + + + + + +
+ + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html new file mode 100644 index 0000000000..65a1a02b11 --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-1.html @@ -0,0 +1,33 @@ + + + + When a listener from window A is added to an event target in window B via the + addEventListener function from window B, errors in that listener should be + reported to window A. + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html new file mode 100644 index 0000000000..6c5476542b --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-2.html @@ -0,0 +1,33 @@ + + + + When a listener from window A is added to an event target in window B via the + addEventListener function from window A, errors in that listener should be + reported to window A. + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html new file mode 100644 index 0000000000..5e78baa8de --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-3.html @@ -0,0 +1,33 @@ + + + + When a listener from window A is added to an event target in window A via the + addEventListener function from window A, errors in that listener should be + reported to window A. + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html new file mode 100644 index 0000000000..a5f35d613f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-4.html @@ -0,0 +1,33 @@ + + + + When a listener from window A is added to an event target in window A via the + addEventListener function from window B, errors in that listener should be + reported to window A. + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html new file mode 100644 index 0000000000..da93e782ca --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/processing-model-2/window-onerror-with-cross-frame-event-listeners-5.html @@ -0,0 +1,25 @@ + + +window.onerror listener reports the exception in global object of its callback + + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/reporterror-cross-realm-method.html b/testing/web-platform/tests/html/webappapis/scripting/reporterror-cross-realm-method.html new file mode 100644 index 0000000000..6e2c2aae8f --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/reporterror-cross-realm-method.html @@ -0,0 +1,30 @@ + + +self.reportError() dispatches an "error" event for this's relevant global object + + + + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/reporterror-in-detached-window-crash.html b/testing/web-platform/tests/html/webappapis/scripting/reporterror-in-detached-window-crash.html new file mode 100644 index 0000000000..33662caa4d --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/reporterror-in-detached-window-crash.html @@ -0,0 +1,11 @@ + +window.reportError() doesn't crash when window is detached + + + diff --git a/testing/web-platform/tests/html/webappapis/scripting/reporterror.any.js b/testing/web-platform/tests/html/webappapis/scripting/reporterror.any.js new file mode 100644 index 0000000000..b9e7ba25bc --- /dev/null +++ b/testing/web-platform/tests/html/webappapis/scripting/reporterror.any.js @@ -0,0 +1,49 @@ +setup({ allow_uncaught_exception:true }); + +[ + 1, + new TypeError(), + undefined +].forEach(throwable => { + test(t => { + let happened = false; + self.addEventListener("error", t.step_func(e => { + assert_true(e.message !== ""); + assert_equals(e.filename, new URL("reporterror.any.js", location.href).href); + assert_greater_than(e.lineno, 0); + assert_greater_than(e.colno, 0); + assert_equals(e.error, throwable); + happened = true; + }), { once:true }); + self.reportError(throwable); + assert_true(happened); + }, `self.reportError(${throwable})`); +}); + +test(() => { + assert_throws_js(TypeError, () => self.reportError()); +}, `self.reportError() (without arguments) throws`); + +test(() => { + // Workaround for https://github.com/web-platform-tests/wpt/issues/32105 + let invoked = false; + self.reportError({ + get name() { + invoked = true; + assert_unreached('get name') + }, + get message() { + invoked = true; + assert_unreached('get message'); + }, + get fileName() { + invoked = true; + assert_unreached('get fileName'); + }, + get lineNumber() { + invoked = true; + assert_unreached('get lineNumber'); + } + }); + assert_false(invoked); +}, `self.reportError() doesn't invoke getters`); -- cgit v1.2.3