Bug 1613394 [wpt PR 21600] - Replace some "promise_rejects(t, 'SomeDOMError', stuff)" calls with p…, a=testonly
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 12 Feb 2020 11:39:43 +0000
changeset 514081 b27d1c433c8df3bc9a9fd3b82499f57f75c4ec39
parent 514080 f5f4135cb924127ee4109ae8a58c1aedcb16a618
child 514082 ba34b8af48bf3dedc40985f0e918e75debacec2f
push id37125
push usershindli@mozilla.com
push dateSat, 15 Feb 2020 09:56:17 +0000
treeherdermozilla-central@02b1aa498dd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1613394, 21600
milestone75.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1613394 [wpt PR 21600] - Replace some "promise_rejects(t, 'SomeDOMError', stuff)" calls with p…, a=testonly Automatic update from web-platform-tests Replace some "promise_rejects(t, 'SomeDOMError', stuff)" calls with promise_rejects_dom. This diff was generated by running: find . -type f -print0 | xargs -0 perl -pi -e "BEGIN { \$/ = undef; } s/promise_rejects\(([ \n]*[a-zA-Z_]+[ \n]*,[ \n]*)([\"'][A-Za-z_]*[\"']) *(, *.)/promise_rejects_dom(\1\2\3/gs" in bash (doesn't work in tcsh, due to the $ inside ""). -- wpt-commits: b7f2dd315a8d84ce786f6336510ee51423011009 wpt-pr: 21600
testing/web-platform/tests/audio-output/setSinkId.https.html
testing/web-platform/tests/background-fetch/fetch.https.window.js
testing/web-platform/tests/battery-status/battery-disabled-by-feature-policy.https.sub.html
testing/web-platform/tests/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html
testing/web-platform/tests/battery-status/battery-insecure-context.html
testing/web-platform/tests/bluetooth/characteristic/writeValue/buffer-is-detached.https.window.js
testing/web-platform/tests/bluetooth/descriptor/writeValue/buffer-is-detached.https.window.js
testing/web-platform/tests/clipboard-apis/async-write-image-read-image-manual.https.html
testing/web-platform/tests/clipboard-apis/clipboard-item.https.html
testing/web-platform/tests/content-security-policy/support/testharness-helper.js
testing/web-platform/tests/credential-management/credentialscontainer-create-basics.https.html
testing/web-platform/tests/css/css-animations/CSSAnimation-finished.tentative.html
testing/web-platform/tests/css/css-animations/CSSAnimation-ready.tentative.html
testing/web-platform/tests/css/css-font-loading/font-face-reject.html
testing/web-platform/tests/css/css-fonts/format-specifiers-variations.html
testing/web-platform/tests/css/geometry/structured-serialization.html
testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html
testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html
testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html
testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
testing/web-platform/tests/fetch/api/abort/general.any.js
testing/web-platform/tests/fetch/api/abort/serviceworker-intercepted.https.html
testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html
testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html
testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https.html
testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay.html
testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_play_noautoplay.html
testing/web-platform/tests/html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-remove-from-document-networkState.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-iframe.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes-svg.tentative.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-picture.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-svg.tentative.html
testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode.html
testing/web-platform/tests/keyboard-lock/navigator-keyboard-lock-two-parallel-requests.https.html
testing/web-platform/tests/kv-storage/cause-errors-via-idb.https.html
testing/web-platform/tests/kv-storage/key-types.https.html
testing/web-platform/tests/kv-storage/keys-values-entries.https.html
testing/web-platform/tests/media-capabilities/decodingInfoEncryptedMedia.http.html
testing/web-platform/tests/mediacapture-image/ImageCapture-creation.https.html
testing/web-platform/tests/mediacapture-image/getPhotoCapabilities.html
testing/web-platform/tests/mediacapture-image/getPhotoSettings.html
testing/web-platform/tests/mediacapture-image/takePhoto.html
testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getDirectory.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getFile.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-removeEntry.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-piped.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js
testing/web-platform/tests/native-file-system/script-tests/FileSystemWriter.js
testing/web-platform/tests/payment-handler/can-make-payment-event.https.html
testing/web-platform/tests/payment-handler/change-payment-method-manual.https.html
testing/web-platform/tests/payment-method-basic-card/apply_the_modifiers.html
testing/web-platform/tests/payment-method-basic-card/steps_for_selecting_the_payment_handler.html
testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html
testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html
testing/web-platform/tests/payment-request/algorithms-manual.https.html
testing/web-platform/tests/payment-request/payment-is-showing.https.html
testing/web-platform/tests/payment-request/payment-request-abort-method.https.html
testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html
testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html
testing/web-platform/tests/payment-request/payment-request-show-method.https.html
testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html
testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html
testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html
testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html
testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html
testing/web-platform/tests/payment-request/rejects_if_not_active-manual.https.html
testing/web-platform/tests/payment-request/show-method-optional-promise-resolves-manual.https.html
testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html
testing/web-platform/tests/payment-request/user-accepts-payment-request-algo-manual.https.html
testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
testing/web-platform/tests/portals/about-blank-cannot-host.html
testing/web-platform/tests/portals/portal-activate-data.html
testing/web-platform/tests/portals/portals-activate-inside-iframe.html
testing/web-platform/tests/portals/portals-activate-no-browsing-context.html
testing/web-platform/tests/portals/portals-post-message.sub.html
testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_notfound_error-manual.https.html
testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_success-manual.https.html
testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotallowed-manual.https.html
testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotfound-manual.https.html
testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_error.https.html
testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_unsettledpromise-manual.https.html
testing/web-platform/tests/remote-playback/disable-remote-playback-prompt-throws.html
testing/web-platform/tests/remote-playback/disable-remote-playback-watch-availability-throws.html
testing/web-platform/tests/screen-orientation/lock-unlock-check.html
testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-abort.js
testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js
testing/web-platform/tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html
testing/web-platform/tests/service-workers/service-worker/navigation-preload/get-state.https.html
testing/web-platform/tests/service-workers/service-worker/update.https.html
testing/web-platform/tests/shape-detection/shapedetection-cross-origin.sub.https.html
testing/web-platform/tests/sms/interceptor.https.html
testing/web-platform/tests/streams/piping/abort.any.js
testing/web-platform/tests/wake-lock/wakelock-active-document.https.window.js
testing/web-platform/tests/wake-lock/wakelock-disabled-by-feature-policy.https.sub.html
testing/web-platform/tests/wake-lock/wakelock-document-hidden-manual.https.html
testing/web-platform/tests/wake-lock/wakelock-screen-type-on-worker.https.worker.js
testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
testing/web-platform/tests/web-locks/acquire.tentative.https.any.js
testing/web-platform/tests/web-locks/resource-names.tentative.https.any.js
testing/web-platform/tests/web-locks/signal.tentative.https.any.js
testing/web-platform/tests/web-locks/steal.tentative.https.any.js
testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html
testing/web-platform/tests/web-nfc/NDEFWriter_write.https.html
testing/web-platform/tests/web-share/share-cancel-manual.https.html
testing/web-platform/tests/web-share/share-sharePromise-internal-slot.https.html
testing/web-platform/tests/web-share/share-without-user-gesture.https.html
testing/web-platform/tests/webrtc-identity/RTCPeerConnection-getIdentityAssertion.sub.https.html
testing/web-platform/tests/webrtc-identity/RTCPeerConnection-peerIdentity.https.html
testing/web-platform/tests/webrtc-quic/RTCQuicStream.https.html
testing/web-platform/tests/webrtc-quic/RTCQuicTransport.https.html
testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
testing/web-platform/tests/webrtc/RTCPeerConnection-addIceCandidate.html
testing/web-platform/tests/webrtc/RTCPeerConnection-createAnswer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-createOffer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-generateCertificate.html
testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-answer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-offer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-answer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-pranswer.html
testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
testing/web-platform/tests/webrtc/RTCPeerConnection-track-stats.https.html
testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
testing/web-platform/tests/webrtc/RTCRtpParameters-headerExtensions.html
testing/web-platform/tests/webrtc/RTCRtpParameters-rtcp.html
testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
testing/web-platform/tests/webrtc/RTCRtpSender-replaceTrack.https.html
testing/web-platform/tests/webrtc/RTCRtpSender-setParameters.html
testing/web-platform/tests/websockets/stream-tentative/abort.any.js
testing/web-platform/tests/websockets/stream-tentative/close.any.js
testing/web-platform/tests/websockets/stream-tentative/constructor.any.js
testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html
testing/web-platform/tests/webxr/webGLCanvasContext_makecompatible_contextlost.https.html
testing/web-platform/tests/webxr/webxr_feature_policy.https.html
testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_no_gesture.https.html
testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_unsupported.https.html
testing/web-platform/tests/webxr/xrDevice_requestSession_requiredFeatures_unknown.https.html
testing/web-platform/tests/webxr/xrSession_features_deviceSupport.https.html
testing/web-platform/tests/webxr/xrSession_prevent_multiple_exclusive.https.html
testing/web-platform/tests/webxr/xrSession_requestReferenceSpace.https.html
testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
--- a/testing/web-platform/tests/audio-output/setSinkId.https.html
+++ b/testing/web-platform/tests/audio-output/setSinkId.https.html
@@ -8,17 +8,17 @@
 <script src=/resources/testharnessreport.js></script>
 <script>
 "use strict";
 
 const audio = new Audio();
 
 promise_test(t => audio.setSinkId(""), "setSinkId on default audio output should always work");
 
-promise_test(t => promise_rejects(t, "NotFoundError", audio.setSinkId("nonexistent_device_id")),
+promise_test(t => promise_rejects_dom(t, "NotFoundError", audio.setSinkId("nonexistent_device_id")),
   "setSinkId fails with NotFoundError on made up deviceid");
 
 promise_test(async t => {
   const list = await navigator.mediaDevices.enumerateDevices();
   const outputDevicesList = list.filter(({kind}) => kind == "audiooutput");
   assert_not_equals(outputDevicesList.length, 0,
     "media device list includes at least one audio output device");
 
--- a/testing/web-platform/tests/background-fetch/fetch.https.window.js
+++ b/testing/web-platform/tests/background-fetch/fetch.https.window.js
@@ -165,17 +165,17 @@ backgroundFetchTest(async (test, backgro
 
 }, 'Registration object gets updated values when a background fetch completes.');
 
 backgroundFetchTest(async (test, backgroundFetch) => {
   const registrationId = uniqueId();
 
   // Very large download total that will definitely exceed the quota.
   const options = {downloadTotal: Number.MAX_SAFE_INTEGER};
-  await promise_rejects(
+  await promise_rejects_dom(
     test, 'QUOTA_EXCEEDED_ERR',
     backgroundFetch.fetch(registrationId, 'resources/feature-name.txt', options),
     'This fetch should have thrown a quota exceeded error');
 
 }, 'Background Fetch that exceeds the quota throws a QuotaExceededError');
 
 backgroundFetchTest(async (test, backgroundFetch) => {
   const registration = await backgroundFetch.fetch(
--- a/testing/web-platform/tests/battery-status/battery-disabled-by-feature-policy.https.sub.html
+++ b/testing/web-platform/tests/battery-status/battery-disabled-by-feature-policy.https.sub.html
@@ -7,17 +7,17 @@
 'use strict';
 
 const same_origin_src = '/feature-policy/resources/feature-policy-battery.html';
 const cross_origin_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
   same_origin_src;
 const header = 'Feature-Policy header {"battery" : []}';
 
 promise_test(async t => {
-  await promise_rejects(t, 'NotAllowedError', navigator.getBattery());
+  await promise_rejects_dom(t, 'NotAllowedError', navigator.getBattery());
 }, `${header} disallows the top-level document.`);
 
 async_test(t => {
   test_feature_availability('navigator.getBattery()', t, same_origin_src,
       expect_feature_unavailable_default);
 }, `${header} disallows same-origin iframes.`);
 
 async_test(t => {
--- a/testing/web-platform/tests/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html
+++ b/testing/web-platform/tests/battery-status/battery-disallowed-in-cross-origin-iframe.https.sub.html
@@ -16,12 +16,12 @@ function load_iframe(iframe, src) {
   });
 }
 
 promise_test(async t => {
   let iframe = document.getElementById('blank');
   const path = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
   const src = 'https://{{domains[www1]}}:{{ports[https][0]}}' + path + 'support-iframe.html';
   iframe = await load_iframe(iframe, src);
-  await promise_rejects(t, 'NotAllowedError', iframe.contentWindow.navigator.getBattery());
+  await promise_rejects_dom(t, 'NotAllowedError', iframe.contentWindow.navigator.getBattery());
 }, "throw a 'NotAllowedError' when invoking navigator.getBattery() within cross-origin iframe");
 
 </script>
--- a/testing/web-platform/tests/battery-status/battery-insecure-context.html
+++ b/testing/web-platform/tests/battery-status/battery-insecure-context.html
@@ -16,12 +16,12 @@
 </style>
 <div id="note">
   Run test in an insecure context, e.g. http://example.com/.
 </div>
 
 <script>
 
 promise_test(t => {
-  return promise_rejects(t, 'SecurityError', navigator.getBattery());
+  return promise_rejects_dom(t, 'SecurityError', navigator.getBattery());
 }, "navigator.getBattery() shall throw a 'SecurityError' in an insecure context");
 
 </script>
--- a/testing/web-platform/tests/bluetooth/characteristic/writeValue/buffer-is-detached.https.window.js
+++ b/testing/web-platform/tests/bluetooth/characteristic/writeValue/buffer-is-detached.https.window.js
@@ -8,16 +8,16 @@ function detachBuffer(buffer) {
   window.postMessage('', '*', [buffer]);
 }
 
 bluetooth_test(async (t) => {
   const {characteristic} = await getMeasurementIntervalCharacteristic();
 
   const typed_array = Uint8Array.of(1, 2);
   detachBuffer(typed_array.buffer);
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', characteristic.writeValue(typed_array));
 
   const array_buffer = Uint8Array.of(3, 4).buffer;
   detachBuffer(array_buffer);
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', characteristic.writeValue(array_buffer));
 }, test_desc);
--- a/testing/web-platform/tests/bluetooth/descriptor/writeValue/buffer-is-detached.https.window.js
+++ b/testing/web-platform/tests/bluetooth/descriptor/writeValue/buffer-is-detached.https.window.js
@@ -8,16 +8,16 @@ function detachBuffer(buffer) {
   window.postMessage('', '*', [buffer]);
 }
 
 bluetooth_test(async (t) => {
   const {descriptor, fake_descriptor} = await getUserDescriptionDescriptor();
 
   const typed_array = Uint8Array.of(1, 2);
   detachBuffer(typed_array.buffer);
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', descriptor.writeValue(typed_array));
 
   const array_buffer = Uint8Array.of(3, 4).buffer;
   detachBuffer(array_buffer);
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', descriptor.writeValue(array_buffer));
 }, test_desc);
--- a/testing/web-platform/tests/clipboard-apis/async-write-image-read-image-manual.https.html
+++ b/testing/web-platform/tests/clipboard-apis/async-write-image-read-image-manual.https.html
@@ -61,17 +61,17 @@ promise_test(async t => {
 
   assert_equals(comparableOutput, comparableInput);
 }, 'Verify write and read clipboard [image/png Blob]');
 
 promise_test(async t => {
   const invalidPngBlob = new Blob(['this text is not a valid png image'],
       {type: "image/png"});
   const clipboardItemInput = new ClipboardItem({'image/png' : invalidPngBlob});
-  await promise_rejects(t, "DataError",
+  await promise_rejects_dom(t, "DataError",
       navigator.clipboard.write([clipboardItemInput]));
 }, 'Verify write error on malformed data [image/png ClipboardItem]');
 </script>
 <p>
   Note: This is a manual test because it writes/reads to the shared system
   clipboard and thus cannot be run async with other tests that might interact
   with the clipboard.
 </p>
--- a/testing/web-platform/tests/clipboard-apis/clipboard-item.https.html
+++ b/testing/web-platform/tests/clipboard-apis/clipboard-item.https.html
@@ -81,12 +81,12 @@ promise_test(async () => {
   const text = await (new Response(blobOutput)).text();
 
   assert_equals('this should work', text);
 }, "getType(DOMString invalid type) succeeds with correct output");
 
 promise_test(async t => {
   const item =
       new ClipboardItem({'text/plain': blob, 'not a/real type': blob2});
-  promise_rejects(t, "NotFoundError", item.getType('type not in item'));
-  promise_rejects(t, "NotFoundError", item.getType('text/plain:subtype'));
+  promise_rejects_dom(t, "NotFoundError", item.getType('type not in item'));
+  promise_rejects_dom(t, "NotFoundError", item.getType('text/plain:subtype'));
 }, "getType(DOMString type) rejects correctly when querying for missing type");
 </script>
--- a/testing/web-platform/tests/content-security-policy/support/testharness-helper.js
+++ b/testing/web-platform/tests/content-security-policy/support/testharness-helper.js
@@ -131,12 +131,12 @@ function assert_service_worker_is_blocke
     var reportedURL = new URL(url).protocol == "blob:" ? "blob" : url;
     return Promise.all([
       waitUntilCSPEventForURL(t, reportedURL)
         .then(t.step_func_done(e => {
           assert_equals(e.blockedURI, reportedURL);
           assert_equals(e.violatedDirective, "worker-src");
           assert_equals(e.effectiveDirective, "worker-src");
         })),
-      promise_rejects(t, "SecurityError", navigator.serviceWorker.register(url, { scope: url }))
+      promise_rejects_dom(t, "SecurityError", navigator.serviceWorker.register(url, { scope: url }))
     ]);
   }, description);
 }
--- a/testing/web-platform/tests/credential-management/credentialscontainer-create-basics.https.html
+++ b/testing/web-platform/tests/credential-management/credentialscontainer-create-basics.https.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <title>Credential Management API: create() basics.</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 promise_test(function(t) {
-    return promise_rejects(t, "NotSupportedError",
+    return promise_rejects_dom(t, "NotSupportedError",
             navigator.credentials.create());
 }, "navigator.credentials.create() with no argument.");
 
 promise_test(function(t) {
-    return promise_rejects(t, "NotSupportedError",
+    return promise_rejects_dom(t, "NotSupportedError",
             navigator.credentials.create({}));
 }, "navigator.credentials.create() with empty argument.");
 
 promise_test(function(t) {
     var credential_data = {
         id: 'id',
         password: 'pencil',
     };
@@ -83,17 +83,17 @@ promise_test(function(t) {
         password: 'pencil',
     };
 
     var federated_data = {
         id: 'id',
         provider: 'https://example.com/',
     };
 
-    return promise_rejects(t, "NotSupportedError",
+    return promise_rejects_dom(t, "NotSupportedError",
             navigator.credentials.create({
                 password: credential_data,
                 federated: federated_data,
             }));
 }, "navigator.credentials.create() with both PasswordCredentialData and FederatedCredentialData");
 
 promise_test(function(t) {
     return promise_rejects_js(t, TypeError,
@@ -124,12 +124,12 @@ promise_test(function(t) {
             navigator.credentials.create({
                 password: "bogus password data",
                 federated: "bogus federated data",
                 publicKey: "bogus publicKey data",
             }));
 }, "navigator.credentials.create() with bogus password, federated, and publicKey data");
 
 promise_test(function(t) {
-    return promise_rejects(t, "NotSupportedError",
+    return promise_rejects_dom(t, "NotSupportedError",
             navigator.credentials.create({bogus_key: "bogus data"}));
 }, "navigator.credentials.create() with bogus data");
 </script>
--- a/testing/web-platform/tests/css/css-animations/CSSAnimation-finished.tentative.html
+++ b/testing/web-platform/tests/css/css-animations/CSSAnimation-finished.tentative.html
@@ -26,17 +26,17 @@ promise_test(async t => {
   div.style.animation = ANIM_PROP_VAL;
   const animation = div.getAnimations()[0];
   const originalFinishedPromise = animation.finished;
 
   // Cancel the animation and flush styles
   div.style.animation = '';
   getComputedStyle(div).animation;
 
-  await promise_rejects(t, 'AbortError', originalFinishedPromise,
+  await promise_rejects_dom(t, 'AbortError', originalFinishedPromise,
                         'finished promise is rejected with AbortError');
 
   assert_not_equals(animation.finished, originalFinishedPromise,
                     'Finished promise should change after the original is ' +
                     'rejected');
 }, 'finished promise is rejected when an animation is canceled by resetting ' +
    'the animation property');
 
@@ -50,17 +50,17 @@ promise_test(async t => {
   div.style.animation = ANIM_PROP_VAL;
   const animation = div.getAnimations()[0];
   const originalFinishedPromise = animation.finished;
 
   // Update the animation and flush styles
   div.style.animation = 'def 100s';
   getComputedStyle(div).animation;
 
-  await promise_rejects(t, 'AbortError', originalFinishedPromise,
+  await promise_rejects_dom(t, 'AbortError', originalFinishedPromise,
                         'finished promise is rejected with AbortError');
 
   assert_not_equals(animation.finished, originalFinishedPromise,
                     'Finished promise should change after the original is ' +
                     'rejected');
 }, 'finished promise is rejected when an animation is canceled by changing ' +
    'the animation property');
 
--- a/testing/web-platform/tests/css/css-animations/CSSAnimation-ready.tentative.html
+++ b/testing/web-platform/tests/css/css-animations/CSSAnimation-ready.tentative.html
@@ -37,17 +37,17 @@ promise_test(async t => {
   const animation = div.getAnimations()[0];
   assert_true(animation.pending, 'Animation is initially pending');
   const readyPromise = animation.ready;
 
   // Cancel the animation and flush styles
   div.style.animation = '';
   getComputedStyle(div).animation;
 
-  await promise_rejects(t, 'AbortError', readyPromise,
+  await promise_rejects_dom(t, 'AbortError', readyPromise,
                         'ready promise is rejected with AbortError');
 }, 'ready promise is rejected when an animation is canceled by resetting'
    + ' the animation property');
 
 promise_test(async t => {
   const div = addDiv(t);
 
   // As before, but this time instead of removing all animations, simply update
@@ -59,17 +59,17 @@ promise_test(async t => {
   const animation = div.getAnimations()[0];
   assert_true(animation.pending, 'Animation is initially pending');
   const readyPromise = animation.ready;
 
   // Update the animation and flush styles
   div.style.animation = 'def 100s';
   getComputedStyle(div).animation;
 
-  await promise_rejects(t, 'AbortError', readyPromise,
+  await promise_rejects_dom(t, 'AbortError', readyPromise,
                         'ready promise is rejected with AbortError');
 }, 'ready promise is rejected when an animation is canceled by updating'
    + ' the animation property');
 
 promise_test(async t => {
   const div = addDiv(t, { style: 'animation: abc 100s' });
   const animation = div.getAnimations()[0];
   const originalReadyPromise = animation.ready;
--- a/testing/web-platform/tests/css/css-font-loading/font-face-reject.html
+++ b/testing/web-platform/tests/css/css-font-loading/font-face-reject.html
@@ -5,14 +5,14 @@
 <meta name="assert" content="Ensure that a UA triggered font load (through the use in the test div) leads to rejecting
                              the promise." />
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 promise_test(function(t) {
     var testFontFace = new FontFace('TestFontFace', 'local("nonexistentfont-9a1a9f78-c8d4-11e9-af16-448a5b2c326f")');
     document.fonts.add(testFontFace);
-  return promise_rejects(t, 'NetworkError', testFontFace.loaded);
+  return promise_rejects_dom(t, 'NetworkError', testFontFace.loaded);
 })
 </script>
 <body>
 <div style="font-family: TestFontFace;">a</div>
 </html>
--- a/testing/web-platform/tests/css/css-fonts/format-specifiers-variations.html
+++ b/testing/web-platform/tests/css/css-fonts/format-specifiers-variations.html
@@ -31,17 +31,17 @@ function runTestOnFormatSpecifiers(forma
     for (var i = 0; i < formats.length; ++i) {
         promise_test((testDetails) => {
             var familyName = "load_ahem_" + i;
             var ahemSrcFormat = defaultAhemSrc.replace("INSERT_FORMAT", testDetails.properties.format);
             var fontFace = new FontFace(familyName, ahemSrcFormat);
             if (!expectFail) {
                 return fontFace.load();
             } else {
-                return promise_rejects(testDetails, "NetworkError", fontFace.load());
+                return promise_rejects_dom(testDetails, "NetworkError", fontFace.load());
             }
         }, (expectFail ? "Do not load" : "Load") + " Ahem with format " + formats[i], {
             "format": formats[i]
         });
     }
 }
 
 runTestOnFormatSpecifiers(formatSpecifiers, false);
--- a/testing/web-platform/tests/css/geometry/structured-serialization.html
+++ b/testing/web-platform/tests/css/geometry/structured-serialization.html
@@ -155,11 +155,11 @@ function defineThrowingGetters(object, a
       break;
     default:
       throw new Error(`Test bug: ${constr} has no test for non-initial values`);
   }
 });
 
 promise_test((t) => {
   const object = document.getElementById('log').getClientRects();
-  return promise_rejects(t, "DataCloneError", clone(object));
+  return promise_rejects_dom(t, "DataCloneError", clone(object));
 }, 'DOMRectList clone');0
 </script>
--- a/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/encrypted-media-reporting.https.html
@@ -17,17 +17,17 @@ var check_report_format = (reports, obse
   assert_equals(typeof report.body.columnNumber, "number");
 };
 
 promise_test(async t => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
                           {types: ['feature-policy-violation']}).observe();
   });
-  await promise_rejects(t, "SecurityError",
+  await promise_rejects_dom(t, "SecurityError",
     navigator.requestMediaKeySystemAccess("org.w3.clearkey",
       [{
         initDataTypes: ["webm"],
         videoCapabilities: [{contentType: 'video/webm;codecs="vp8"'}],
       }]),
       "requestMediaKeySystemAccess() should not be allowed in this document.");
   const [reports, observer] = await report;
   check_report_format(reports, observer);
--- a/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/midi-reporting.https.html
@@ -17,16 +17,16 @@ var check_report_format = (reports, obse
   assert_equals(report.body.disposition, "enforce");
 };
 
 promise_test(async (t) => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
                           {types: ['feature-policy-violation']}).observe();
   });
-  await promise_rejects(t, 'SecurityError', navigator.requestMIDIAccess(),
+  await promise_rejects_dom(t, 'SecurityError', navigator.requestMIDIAccess(),
                         "MIDI device access should not be allowed in this document.");
   const [reports, observer] = await report;
   check_report_format(reports, observer);
 }, "MIDI Report Format");
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
+++ b/testing/web-platform/tests/feature-policy/reporting/picture-in-picture-reporting.html
@@ -31,16 +31,16 @@ const loadVideo = () => new Promise(reso
 
 promise_pip_test(async (t) => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
                           {types: ['feature-policy-violation']}).observe();
   });
   const videoElement = await loadVideo();
   await test_driver.bless('picture-in-picture');
-  await promise_rejects(t, 'SecurityError', videoElement.requestPictureInPicture(),
+  await promise_rejects_dom(t, 'SecurityError', videoElement.requestPictureInPicture(),
                         "Picture-in-Picture should not be allowed in this document.");
   const [reports, observer] = await report;
   check_report_format(reports, observer);
 }, "Picture-in-Picture Report Format");
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/vr-reporting.https.html
@@ -17,16 +17,16 @@ var check_report_format = (reports, obse
   assert_equals(report.body.disposition, "enforce");
 };
 
 promise_test(async (t) => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
                           {types: ['feature-policy-violation']}).observe();
   });
-  await promise_rejects(t, 'SecurityError', navigator.getVRDisplays(),
+  await promise_rejects_dom(t, 'SecurityError', navigator.getVRDisplays(),
                         "VR device access should not be allowed in this document.");
   const [reports, observer] = await report;
   check_report_format(reports, observer);
 }, "VR Report Format");
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
+++ b/testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html
@@ -17,17 +17,17 @@ var check_report_format = (reports, obse
   assert_equals(report.body.disposition, "enforce");
 };
 
 promise_test(async (t) => {
   const report = new Promise(resolve => {
     new ReportingObserver((reports, observer) => resolve([reports, observer]),
                           {types: ['feature-policy-violation']}).observe();
   });
-  await promise_rejects(t, 'SecurityError',
+  await promise_rejects_dom(t, 'SecurityError',
                         navigator.xr.isSessionSupported('immersive-vr'),
                         "XR spatial tracking should not be allowed in this document.");
   const [reports, observer] = await report;
   check_report_format(reports, observer);
 }, "XR Report Format");
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/fetch/api/abort/general.any.js
+++ b/testing/web-platform/tests/fetch/api/abort/general.any.js
@@ -23,33 +23,33 @@ const urlHostname = hostInfo.REMOTE_HOST
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const fetchPromise = fetch('../resources/data.json', { signal });
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Aborting rejects with AbortError");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const url = new URL('../resources/data.json', location);
   url.hostname = urlHostname;
 
   const fetchPromise = fetch(url, {
     signal,
     mode: 'no-cors'
   });
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Aborting rejects with AbortError - no-cors");
 
 // Test that errors thrown from the request constructor take priority over abort errors.
 // badRequestArgTests is from response-error.js
 for (const { args, testName } of badRequestArgTests) {
   promise_test(async t => {
     try {
       // If this doesn't throw, we'll effectively skip the test.
@@ -83,68 +83,68 @@ promise_test(async t => {
 
   assert_true(Boolean(request.signal), "Signal member is present & truthy");
   assert_equals(request.signal.constructor, AbortSignal);
   assert_not_equals(request.signal, signal, 'Request has a new signal, not a reference');
   assert_true(request.signal.aborted, `Request's signal has aborted`);
 
   const fetchPromise = fetch(request);
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Signal on request object");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const request = new Request('../resources/data.json', { signal });
   const requestFromRequest = new Request(request);
 
   const fetchPromise = fetch(requestFromRequest);
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Signal on request object created from request object");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const request = new Request('../resources/data.json');
   const requestFromRequest = new Request(request, { signal });
 
   const fetchPromise = fetch(requestFromRequest);
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Signal on request object created from request object, with signal on second request");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const request = new Request('../resources/data.json', { signal: new AbortController().signal });
   const requestFromRequest = new Request(request, { signal });
 
   const fetchPromise = fetch(requestFromRequest);
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Signal on request object created from request object, with signal on second request overriding another");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const request = new Request('../resources/data.json', { signal });
 
   const fetchPromise = fetch(request, {method: 'POST'});
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 }, "Signal retained after unrelated properties are overridden by fetch");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
   const request = new Request('../resources/data.json', { signal });
@@ -200,17 +200,17 @@ for (const bodyMethod of BODY_METHODS) {
 
     const bodyPromise = response[bodyMethod]();
 
     await Promise.all([
       bodyPromise.catch(() => log.push(`${bodyMethod}-reject`)),
       Promise.resolve().then(() => log.push('next-microtask'))
     ]);
 
-    await promise_rejects(t, "AbortError", bodyPromise);
+    await promise_rejects_dom(t, "AbortError", bodyPromise);
 
     assert_array_equals(log, [`${bodyMethod}-reject`, 'next-microtask']);
   }, `response.${bodyMethod}() rejects if already aborted`);
 }
 
 promise_test(async t => {
   await abortRequests();
 
@@ -247,17 +247,17 @@ promise_test(async t => {
     requestAbortKeys.push(abortKey);
 
     fetches.push(
       fetch(`../resources/infinite-slow-response.py?${i}&abortKey=${abortKey}`, { signal })
     );
   }
 
   for (const fetchPromise of fetches) {
-    await promise_rejects(t, "AbortError", fetchPromise);
+    await promise_rejects_dom(t, "AbortError", fetchPromise);
   }
 }, "Already aborted signal can be used for many fetches");
 
 promise_test(async t => {
   await abortRequests();
 
   const controller = new AbortController();
   const signal = controller.signal;
@@ -273,17 +273,17 @@ promise_test(async t => {
     requestAbortKeys.push(abortKey);
 
     fetches.push(
       fetch(`../resources/infinite-slow-response.py?${i}&abortKey=${abortKey}`, { signal })
     );
   }
 
   for (const fetchPromise of fetches) {
-    await promise_rejects(t, "AbortError", fetchPromise);
+    await promise_rejects_dom(t, "AbortError", fetchPromise);
   }
 }, "Signal can be used to abort other fetches, even if another fetch succeeded before aborting");
 
 promise_test(async t => {
   await abortRequests();
 
   const controller = new AbortController();
   const signal = controller.signal;
@@ -361,17 +361,17 @@ for (const bodyMethod of BODY_METHODS) {
 
     const beforeAbortResult = await fetch(`../resources/stash-take.py?key=${stateKey}`).then(r => r.json());
     assert_equals(beforeAbortResult, "open", "Connection is open");
 
     const bodyPromise = response[bodyMethod]();
 
     controller.abort();
 
-    await promise_rejects(t, "AbortError", bodyPromise);
+    await promise_rejects_dom(t, "AbortError", bodyPromise);
 
     const start = Date.now();
 
     while (true) {
       // Stop spinning if 10 seconds have passed
       if (Date.now() - start > 10000) throw Error('Timed out');
 
       const afterAbortResult = await fetch(`../resources/stash-take.py?key=${stateKey}`).then(r => r.json());
@@ -389,18 +389,18 @@ promise_test(async t => {
   const abortKey = token();
   requestAbortKeys.push(abortKey);
 
   const response = await fetch(`../resources/infinite-slow-response.py?stateKey=${stateKey}&abortKey=${abortKey}`, { signal });
   const reader = response.body.getReader();
 
   controller.abort();
 
-  await promise_rejects(t, "AbortError", reader.read());
-  await promise_rejects(t, "AbortError", reader.closed);
+  await promise_rejects_dom(t, "AbortError", reader.read());
+  await promise_rejects_dom(t, "AbortError", reader.closed);
 
   // The connection won't close immediately, but it should close at some point:
   const start = Date.now();
 
   while (true) {
     // Stop spinning if 10 seconds have passed
     if (Date.now() - start > 10000) throw Error('Timed out');
 
@@ -420,18 +420,18 @@ promise_test(async t => {
 
   const response = await fetch(`../resources/infinite-slow-response.py?stateKey=${stateKey}&abortKey=${abortKey}`, { signal });
   const reader = response.body.getReader();
 
   await reader.read();
 
   controller.abort();
 
-  await promise_rejects(t, "AbortError", reader.read());
-  await promise_rejects(t, "AbortError", reader.closed);
+  await promise_rejects_dom(t, "AbortError", reader.read());
+  await promise_rejects_dom(t, "AbortError", reader.closed);
 
   // The connection won't close immediately, but it should close at some point:
   const start = Date.now();
 
   while (true) {
     // Stop spinning if 10 seconds have passed
     if (Date.now() - start > 10000) throw Error('Timed out');
 
@@ -483,17 +483,17 @@ promise_test(async t => {
       'Content-Type': 'text/plain'
     }
   });
 
   assert_true(!!cancelReason, 'Cancel called sync');
   assert_equals(cancelReason.constructor, DOMException);
   assert_equals(cancelReason.name, 'AbortError');
 
-  await promise_rejects(t, "AbortError", fetchPromise);
+  await promise_rejects_dom(t, "AbortError", fetchPromise);
 
   const fetchErr = await fetchPromise.catch(e => e);
 
   assert_equals(cancelReason, fetchErr, "Fetch rejects with same error instance");
 }, "Readable stream synchronously cancels with AbortError if aborted before reading");
 
 test(() => {
   const controller = new AbortController();
--- a/testing/web-platform/tests/fetch/api/abort/serviceworker-intercepted.https.html
+++ b/testing/web-platform/tests/fetch/api/abort/serviceworker-intercepted.https.html
@@ -41,17 +41,17 @@
           w.navigator.serviceWorker.removeEventListener('message', once);
           resolve(event.data);
         }
       })
     });
 
     const fetchPromise = w.fetch('data.json', { signal });
 
-    await promise_rejects(t, "AbortError", fetchPromise);
+    await promise_rejects_dom(t, "AbortError", fetchPromise);
 
     await w.fetch('data.json?no-abort');
 
     assert_true((await nextData).endsWith('?no-abort'), "Aborted request does not go through service worker");
   }, "Already aborted request does not land in service worker");
 
   for (const bodyMethod of BODY_METHODS) {
     promise_test(async t => {
@@ -71,17 +71,17 @@
 
       const bodyPromise = response[bodyMethod]();
 
       await Promise.all([
         bodyPromise.catch(() => log.push(`${bodyMethod}-reject`)),
         Promise.resolve().then(() => log.push('next-microtask'))
       ]);
 
-      await promise_rejects(t, "AbortError", bodyPromise);
+      await promise_rejects_dom(t, "AbortError", bodyPromise);
 
       assert_array_equals(log, [`${bodyMethod}-reject`, 'next-microtask']);
     }, `response.${bodyMethod}() rejects if already aborted`);
   }
 
   promise_test(async t => {
     const scope = SCOPE + "?q=aborted-stream-errors";
     await setupRegistration(t, scope);
@@ -92,14 +92,14 @@
     const controller = new w.AbortController();
     const signal = controller.signal;
 
     const response = await w.fetch('data.json', { signal });
     const reader = response.body.getReader();
 
     controller.abort();
 
-    await promise_rejects(t, "AbortError", reader.read());
-    await promise_rejects(t, "AbortError", reader.closed);
+    await promise_rejects_dom(t, "AbortError", reader.read());
+    await promise_rejects_dom(t, "AbortError", reader.closed);
   }, "Stream errors once aborted.");
 </script>
 </body>
 </html>
--- a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html
+++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html
@@ -6,20 +6,20 @@
 <script src="/feature-policy/resources/featurepolicy.js"></script>
 <script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
 <script>
 "use strict";
 
 run_fp_tests_disabled('GeolocationSensor');
 
 promise_test(async t => {
-  await promise_rejects(t, 'SecurityError', GeolocationSensor.read());
+  await promise_rejects_dom(t, 'SecurityError', GeolocationSensor.read());
 }, "GeolocationSensor.read(): 'SecurityError' is thrown when disabled by Feature Policy");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
-  await promise_rejects(t, 'AbortError', GeolocationSensor.read({ signal }));
+  await promise_rejects_dom(t, 'AbortError', GeolocationSensor.read({ signal }));
 }, "GeolocationSensor.read(): 'AbortError' takes priority");
 </script>
 </body>
--- a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html
+++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html
@@ -29,11 +29,11 @@ promise_test(async t => {
   properties.forEach(property => assert_own_property(geo, property));
 }, "Test that read() method resolves with valid reading");
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
   controller.abort();
 
-  await promise_rejects(t, 'AbortError', GeolocationSensor.read({ signal }));
+  await promise_rejects_dom(t, 'AbortError', GeolocationSensor.read({ signal }));
 }, "Test that read() method rejects 'AbortError' if signal's aborted flag is set");
 </script>
--- a/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
+++ b/testing/web-platform/tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
@@ -269,17 +269,17 @@ addPromiseTest(async function(win, test_
       for (let obj = localObj; !desc; obj = Object.getPrototypeOf(obj)) {
         desc = Object.getOwnPropertyDescriptor(obj, prop);
 
       }
 
       if ("value" in desc) {
         if (typeof desc.value === "function" && String(desc.value).includes("[native code]")) {
           if (allowedlists.promiseMethods.includes(prop)) {
-            await promise_rejects(test_obj, "SecurityError", desc.value.call(otherObj),
+            await promise_rejects_dom(test_obj, "SecurityError", desc.value.call(otherObj),
                                   `Should throw when calling ${objName}.${prop} with cross-origin this object`);
           } else if (!allowedlists.methods.includes(prop)) {
             for (let args of methodArgs.get(prop) || [[]]) {
               assert_throws_dom("SecurityError", desc.value.bind(otherObj, ...args),
                                 `Should throw when calling ${objName}.${prop} with cross-origin this object`);
             }
 
           } else {
--- a/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https.html
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-load-from-cache-storage.https.html
@@ -104,17 +104,17 @@ function test(
     if (response_stored === "not-stored") {
       return;
     }
 
     // 2. Retrieve it from the CacheStorage.
     const cache = await caches.open('v1');
 
     if (response_type === 'error') {
-      await promise_rejects(t, 'InvalidAccessError', cache.match(url));
+      await promise_rejects_dom(t, 'InvalidAccessError', cache.match(url));
       return;
     }
 
     const response = await cache.match(url);
 
     assert_equals(response.type, response_type);
 
     if (request_source === "service-worker") {
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_pause_noautoplay.html
@@ -18,25 +18,25 @@ promise_test(function(t) {
   var async_t = async_test("calling play() then pause() on non-autoplay audio should trigger pause event");
   var a = document.getElementById("a");
   a.addEventListener("pause", function() {
     async_t.done();
   }, false);
   a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
   var play_promise = a.play();
   a.pause();
-  return promise_rejects(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
+  return promise_rejects_dom(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
 }, "audio events - pause");
 
 promise_test(function(t) {
   var async_t = async_test("calling play() then pause() on non-autoplay video should trigger pause event");
   var v = document.getElementById("v");
   v.addEventListener("pause", function() {
     async_t.done();
   }, false);
   v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
   var play_promise = v.play()
   v.pause();
-  return promise_rejects(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
+  return promise_rejects_dom(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
 }, "video events - pause");
   </script>
  </body>
 </html>
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_play_noautoplay.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/event_play_noautoplay.html
@@ -17,24 +17,24 @@
 promise_test(function(t) {
   var async_t = async_test("calling play() on audio should trigger play event");
   var a = document.getElementById("a");
   a.addEventListener("play", async_t.step_func(function() {
     a.pause();
     async_t.done();
   }), false);
   a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
-  return promise_rejects(t, "AbortError", a.play(), "pause() should reject all pending play Promises");
+  return promise_rejects_dom(t, "AbortError", a.play(), "pause() should reject all pending play Promises");
 }, "audio events - play");
 
 promise_test(function(t) {
   var async_t = async_test("calling play() on video should trigger play event");
   var v = document.getElementById("v");
   v.addEventListener("play", async_t.step_func(function() {
     v.pause();
     async_t.done();
   }), false);
   v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
-  return promise_rejects(t, "AbortError", v.play(), "pause() should reject all pending play Promises");
+  return promise_rejects_dom(t, "AbortError", v.play(), "pause() should reject all pending play Promises");
 }, "video events - play");
   </script>
  </body>
 </html>
--- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-remove-from-document-networkState.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-remove-from-document-networkState.html
@@ -16,12 +16,12 @@ promise_test(async function(t) {
   assert_equals(v.networkState, v.NETWORK_EMPTY,
                 'networkState after stable state');
   assert_false(v.paused, 'paused after stable state');
   v.parentNode.removeChild(v);
   assert_false(v.paused, 'paused after removing');
 
   await watcher.wait_for('pause');
 
-  await promise_rejects(t, 'AbortError', p, 'We expect promise being rejected');
+  await promise_rejects_dom(t, 'AbortError', p, 'We expect promise being rejected');
   assert_true(v.paused, 'paused after removing and stable state');
 });
 </script>
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-iframe.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-iframe.html
@@ -32,23 +32,23 @@ promise_test(function() {
 }, document.title + " Decode from removed iframe fails (loaded img)");
 
 promise_test(function(t) {
   var frame = document.getElementById("frame_notloaded");
   var img = frame.contentDocument.createElement("img");
   img.src = "/images/green.png";
   frame.parentNode.removeChild(frame);
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Decode from removed iframe fails (img not loaded)");
 
 promise_test(function(t) {
   var frame = document.getElementById("frame_notloaded2");
   var img = frame.contentDocument.createElement("img");
   img.src = "/images/green.png";
   // First request a promise, then remove the iframe.
   var promise = img.decode();
   frame.parentNode.removeChild(frame);
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Decode from iframe, later removed, fails (img not loaded)");
 
 </script>
 
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes-svg.tentative.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes-svg.tentative.html
@@ -11,72 +11,72 @@
 
 // src tests
 // -------------------
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
   var promise = img.decode();
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg");
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " xlink:href changes fail decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttribute('href', "/images/green.png");
   var promise = img.decode();
   img.setAttribute('href', "/images/green.svg");
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " href changes fail decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
   var first_promise = img.decode();
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg");
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", first_promise),
     second_promise
   ]);
 }, document.title + " xlink:href changes fail decode; following good decode succeeds.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttribute('href', "/images/green.png");
   var first_promise = img.decode();
   img.setAttribute('href', "/images/green.svg");
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", first_promise),
     second_promise
   ]);
 }, document.title + " href changes fail decode; following good decode succeeds.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
   var first_promise = img.decode();
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/non/existent/path.png");
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
-    promise_rejects(t, "EncodingError", second_promise)
+    promise_rejects_dom(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", second_promise)
   ]);
 }, document.title + " xlink:href changes fail decode; following bad decode fails.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttribute('href', "/images/green.png");
   var first_promise = img.decode();
   img.setAttribute('href', "/non/existent/path.png");
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
-    promise_rejects(t, "EncodingError", second_promise)
+    promise_rejects_dom(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", second_promise)
   ]);
 }, document.title + " href changes fail decode; following bad decode fails.");
 
 </script>
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes.html
@@ -12,55 +12,55 @@
 
 // src tests
 // -------------------
 promise_test(function(t) {
   var img = new Image();
   img.src = "/images/green.png";
   var promise = img.decode();
   img.src = "/images/green.svg";
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " src changes fail decode.");
 
 promise_test(function(t) {
   var img = new Image();
   img.src = "/images/green.png";
   var first_promise = img.decode();
   img.src = "/images/blue.png";
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", first_promise),
     second_promise
   ]);
 }, document.title + " src changes fail decode; following good png decode succeeds.");
 
 promise_test(function(t) {
   var img = new Image();
   img.src = "/images/green.png";
   var first_promise = img.decode();
   img.src = "/images/green.svg";
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", first_promise),
     second_promise
   ]);
 }, document.title + " src changes fail decode; following good svg decode succeeds.");
 
 promise_test(function(t) {
   var img = new Image();
   img.src = "/images/green.png";
   var first_promise = img.decode();
   img.src = "/non/existent/path.png";
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
-    promise_rejects(t, "EncodingError", second_promise)
+    promise_rejects_dom(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", second_promise)
   ]);
 }, document.title + " src changes fail decode; following bad decode fails.");
 
 promise_test(function(t) {
   return new Promise(function(resolve, reject) {
     var img = new Image();
     // We wait for an onload, since the "Updating the image data" spec states
     // that if a new microtask is scheduled, the old one is canceled so
@@ -84,38 +84,38 @@ promise_test(function(t) {
 
 // srcset tests
 // -------------------
 promise_test(function(t) {
   var img = new Image();
   img.srcset = "/images/green.png 100w";
   var promise = img.decode();
   img.srcset = "/images/green.svg 100w";
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " srcset changes fail decode.");
 
 promise_test(function(t) {
   var img = new Image();
   img.srcset = "/images/green.png 100w";
   var first_promise = img.decode();
   img.srcset = "/images/green.svg 100w";
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", first_promise),
     second_promise
   ]);
 }, document.title + " srcset changes fail decode; following good decode succeeds.");
 
 promise_test(function(t) {
   var img = new Image();
   img.srcset = "/images/green.png 100w";
   var first_promise = img.decode();
   img.srcset = "/non/existent/path.png 100w";
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
   return Promise.all([
-    promise_rejects(t, "EncodingError", first_promise),
-    promise_rejects(t, "EncodingError", second_promise)
+    promise_rejects_dom(t, "EncodingError", first_promise),
+    promise_rejects_dom(t, "EncodingError", second_promise)
   ]);
 }, document.title + " srcset changes fail decode; following bad decode fails.");
 
 </script>
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-picture.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-picture.html
@@ -77,43 +77,43 @@ promise_test(function(t) {
   var img = document.createElement("img");
 
   picture.appendChild(source);
   picture.appendChild(img);
 
   source.srcset = "/non/existent/path.png";
 
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Non-existent source fails decode.");
 
 promise_test(function(t) {
   var picture = document.createElement("picture");
   var source = document.createElement("source");
   var img = document.createElement("img");
 
   picture.appendChild(source);
   picture.appendChild(img);
 
   source.srcset = "data:image/png;base64,iVBO00PDR0BADBEEF00KGg";
 
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Corrupt image in src fails decode.");
 
 promise_test(function(t) {
   var picture = document.createElement("picture");
   var source = document.createElement("source");
   var img = document.createElement("img");
 
   picture.appendChild(source);
   picture.appendChild(img);
 
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Image without srcset fails decode.");
 
 promise_test(function() {
   var picture = document.createElement("picture");
   var source = document.createElement("source");
   var img = document.createElement("img");
 
   picture.appendChild(source);
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-svg.tentative.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-svg.tentative.html
@@ -66,44 +66,44 @@ promise_test(function() {
     assert_equals(arg, undefined);
   });
 }, document.title + " Image with SVG href decodes with undefined.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/non/existent/path.png");
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Non-existent xlink:href fails decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttribute('href', "/non/existent/path.png");
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Non-existent href fails decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "data:image/png;base64,iVBO00PDR0BADBEEF00KGg");
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Corrupt image in xlink:href fails decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttribute('href', "data:image/png;base64,iVBO00PDR0BADBEEF00KGg");
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Corrupt image in href fails decode.");
 
 promise_test(function(t) {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Image without xlink:href or href fails decode.");
 
 promise_test(function() {
   var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
   img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png");
   var first_promise = img.decode();
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
--- a/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode.html
+++ b/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode.html
@@ -38,57 +38,57 @@ promise_test(function() {
     assert_equals(arg, undefined);
   });
 }, document.title + " Image with SVG src decodes with undefined.");
 
 promise_test(function(t) {
   var img = new Image();
   img.src = "/non/existent/path.png";
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Non-existent src fails decode.");
 
 promise_test(function(t) {
   var inactive_doc = document.implementation.createHTMLDocument();
   var img = inactive_doc.createElement("img");
   img.src = "/images/green.png";
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Inactive document fails decode.");
 
 promise_test(function(t) {
   var inactive_doc = document.implementation.createHTMLDocument();
   var img = document.createElement("img");
   img.src = "/images/green.png";
   var promise = img.decode();
   inactive_doc.body.appendChild(img);
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Adopted active image into inactive document fails decode.");
 
 promise_test(function() {
   var inactive_doc = document.implementation.createHTMLDocument();
   var img = inactive_doc.createElement("img");
   img.src = "/images/green.png";
   document.body.appendChild(img);
   return img.decode().then(function(arg) {
     assert_equals(arg, undefined);
   });
 }, document.title + " Adopted inactive image into active document succeeds.");
 
 promise_test(function(t) {
   var img = new Image();
   img.src = "data:image/png;base64,iVBO00PDR0BADBEEF00KGg";
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Corrupt image in src fails decode.");
 
 promise_test(function(t) {
   var img = new Image();
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Image without src/srcset fails decode.");
 
 promise_test(function() {
   var img = new Image();
   img.src = "/images/green.png";
   var first_promise = img.decode();
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
@@ -115,17 +115,17 @@ promise_test(function() {
     assert_equals(arg, undefined);
   });
 }, document.title + " Image with SVG srcset decodes with undefined.");
 
 promise_test(function(t) {
   var img = new Image();
   img.srcset = "/non/existent/path.png 100w";
   var promise = img.decode();
-  return promise_rejects(t, "EncodingError", promise);
+  return promise_rejects_dom(t, "EncodingError", promise);
 }, document.title + " Non-existent srcset fails decode.");
 
 promise_test(function() {
   var img = new Image();
   img.srcset = "/images/green.png 100w";
   var first_promise = img.decode();
   var second_promise = img.decode();
   assert_not_equals(first_promise, second_promise);
--- a/testing/web-platform/tests/keyboard-lock/navigator-keyboard-lock-two-parallel-requests.https.html
+++ b/testing/web-platform/tests/keyboard-lock/navigator-keyboard-lock-two-parallel-requests.https.html
@@ -2,12 +2,12 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 'use strict';
 
 promise_test((t) => {
   const p1 = navigator.keyboard.lock(["KeyA", "KeyB"]);
   const p2 = navigator.keyboard.lock(["KeyC", "KeyD"]);
-  return Promise.all([promise_rejects(t, "AbortError", p1), p2]);
+  return Promise.all([promise_rejects_dom(t, "AbortError", p1), p2]);
 }, '[Keyboard Lock] keyboard.lock twice in parallel');
 
 </script>
--- a/testing/web-platform/tests/kv-storage/cause-errors-via-idb.https.html
+++ b/testing/web-platform/tests/kv-storage/cause-errors-via-idb.https.html
@@ -30,87 +30,87 @@ const mustFail = {
 
 for (const [method, testFn] of Object.entries(mustFail)) {
   testWithArea(async (area, t) => {
     const { database, version } = area.backingStore;
     const db = await migrateNamedDatabase(t, database, version + 1, () => {});
 
     const result = testFn(area);
 
-    await promise_rejects(t, "VersionError", result);
+    await promise_rejects_dom(t, "VersionError", result);
   }, `${method}: upgrading the database must cause a "VersionError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database } = area.backingStore;
 
     // Set up a new database with that name, but with no object stores!
     // NB: this depends on the fact that createNameDatabase sets the initial version to 1, which is
     // the same as the database version used/expected by KV Storage.
     const db = await createNamedDatabase(t, database, () => {});
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database with no object store must cause an "InvalidStateError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database } = area.backingStore;
 
     const db = await createNamedDatabase(t, database, db => {
       db.createObjectStore("wrongName");
     });
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database with a single object store with the wrong name must cause an "InvalidStateError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database, store } = area.backingStore;
 
     const db = await createNamedDatabase(t, database, db => {
       db.createObjectStore(store);
       db.createObjectStore("wrongName");
     });
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database with more than one object store must cause an "InvalidStateError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database, store } = area.backingStore;
 
     const db = await createNamedDatabase(t, database, db => {
       db.createObjectStore(store, { autoIncrement: true });
     });
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database the right object store but a bad schema (autoIncrement = true) must cause an "InvalidStateError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database, store } = area.backingStore;
 
     const db = await createNamedDatabase(t, database, db => {
       db.createObjectStore(store, { keyPath: "somekey" });
     });
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database the right object store but a bad schema (keyPath != null) must cause an "InvalidStateError" DOMException`);
 
   testWithAreaNoCleanup(async (area, t) => {
     const { database, store } = area.backingStore;
 
     const db = await createNamedDatabase(t, database, db => {
       const s = db.createObjectStore(store);
       s.createIndex("index", "indexKey");
     });
 
     const result = testFn(area);
 
-    await promise_rejects(t, "InvalidStateError", result);
+    await promise_rejects_dom(t, "InvalidStateError", result);
   }, `${method}: creating a same-named database the right object store but a bad schema (has indices) must cause an "InvalidStateError" DOMException`);
 }
 </script>
--- a/testing/web-platform/tests/kv-storage/key-types.https.html
+++ b/testing/web-platform/tests/kv-storage/key-types.https.html
@@ -33,23 +33,23 @@ const validKeys = {
   "an ArrayBuffer": [new Uint8Array([5, 6]).buffer, assertEqualArrayBuffers]
 };
 
 const methods = ["delete", "get", "set"];
 
 for (const method of methods) {
   testWithArea(async (area, t) => {
     for (const [description, key] of Object.entries(invalidKeys)) {
-      await promise_rejects(t, "DataError", area[method](key), description);
+      await promise_rejects_dom(t, "DataError", area[method](key), description);
     }
   }, `${method}: invalid keys`);
 
   testWithArea(async (area, t) => {
     for (const [description, key] of Object.entries(invalidKeys)) {
-      await promise_rejects(t, "DataError", area[method]([key]), description);
+      await promise_rejects_dom(t, "DataError", area[method]([key]), description);
     }
   }, `${method}: invalid keys, nested in arrays`);
 
   testWithArea(async (area, t) => {
     for (const [key] of Object.values(validKeys)) {
       await area[method](key);
     }
   }, `${method}: valid keys`);
--- a/testing/web-platform/tests/kv-storage/keys-values-entries.https.html
+++ b/testing/web-platform/tests/kv-storage/keys-values-entries.https.html
@@ -48,29 +48,29 @@ for (const method of ["keys", "values", 
     const iter = area[method]();
 
     const { database, store, version } = area.backingStore;
     await migrateNamedDatabase(t, database, version + 1, () => {});
 
     const iterResultPromise1 = iter.next();
     const iterResultPromise2 = iter.next();
 
-    await promise_rejects(t, "VersionError", iterResultPromise1, "first next()");
-    await promise_rejects(t, "VersionError", iterResultPromise2, "second next()");
+    await promise_rejects_dom(t, "VersionError", iterResultPromise1, "first next()");
+    await promise_rejects_dom(t, "VersionError", iterResultPromise2, "second next()");
 
     const iterResultPromise3 = iter.next();
 
     assert_not_equals(iterResultPromise1, iterResultPromise2,
       "Two promises retrieved from synchronous next() calls must be different (1 vs 2)");
     assert_not_equals(iterResultPromise1, iterResultPromise3,
       "Two promises, one retrieved after waiting for the other, must be different (1 vs 3)");
     assert_not_equals(iterResultPromise2, iterResultPromise3,
       "Two promises, one retrieved after waiting for the other, must be different (2 vs 3)");
 
-    await promise_rejects(t, "VersionError", iterResultPromise2, "third next()");
+    await promise_rejects_dom(t, "VersionError", iterResultPromise2, "third next()");
 
     const reason1 = await iterResultPromise1.catch(r => r);
     const reason2 = await iterResultPromise2.catch(r => r);
     const reason3 = await iterResultPromise3.catch(r => r);
 
     assert_equals(reason1, reason2, "reasons must be the same (1 vs 2)");
     assert_equals(reason2, reason3, "reasons must be the same (2 vs 3)");
   }, `${method}(): error path: returns new rejected promises, each with the same reason`);
--- a/testing/web-platform/tests/media-capabilities/decodingInfoEncryptedMedia.http.html
+++ b/testing/web-platform/tests/media-capabilities/decodingInfoEncryptedMedia.http.html
@@ -16,16 +16,16 @@ var minimalVideoConfiguration = {
 
 // Minimal MediaCapabilitiesKeySystemConfiguration that will be allowed per
 // spec. All optional properties are missing.
 var minimalKeySystemConfiguration = {
   keySystem: 'org.w3.clearkey'
 };
 
 promise_test(t => {
-  return promise_rejects(t, 'SecurityError', navigator.mediaCapabilities.decodingInfo({
+  return promise_rejects_dom(t, 'SecurityError', navigator.mediaCapabilities.decodingInfo({
     type: 'file',
     video: minimalVideoConfiguration,
     keySystemConfiguration: minimalKeySystemConfiguration,
   }));
 }, "Test that decodingInfo() with a keySystemConfiguration fails on a non-secure context.");
 
 </script>
--- a/testing/web-platform/tests/mediacapture-image/ImageCapture-creation.https.html
+++ b/testing/web-platform/tests/mediacapture-image/ImageCapture-creation.https.html
@@ -18,17 +18,17 @@ function makeAsyncTest(modifyTrack, mess
       assert_true(videoTrack.enabled);
       assert_false(videoTrack.muted);
 
       var capturer = new ImageCapture(videoTrack);
       assert_equals(capturer.track, videoTrack);
 
       modifyTrack(videoTrack);
 
-      promise_rejects(test,
+      promise_rejects_dom(test,
                       'InvalidStateError',
                       capturer.grabFrame(),
                       'Should throw InvalidStateError.')
         .then(() => test.done());
     });
 
     const onError = test.unreached_func('Error creating MediaStream.');
     navigator.mediaDevices.getUserMedia({video: true})
--- a/testing/web-platform/tests/mediacapture-image/getPhotoCapabilities.html
+++ b/testing/web-platform/tests/mediacapture-image/getPhotoCapabilities.html
@@ -49,17 +49,17 @@ promise_test(t => {
   context.fillRect(0, 0, 10, 10);
   let stream = canvas.captureStream();
   let videoTrack = stream.getVideoTracks()[0];
   videoTrack.stop();
 
   let capturer = new ImageCapture(videoTrack);
   assert_equals(videoTrack.readyState, 'ended');
 
-  return promise_rejects(t, 'InvalidStateError', capturer.getPhotoCapabilities())
+  return promise_rejects_dom(t, 'InvalidStateError', capturer.getPhotoCapabilities())
 
 }, 'getPhotoCapabilities() of an ended Track should throw "InvalidStateError"');
 
 async_test(t => {
   let canvas = document.getElementById('canvas');
   let context = canvas.getContext('2d');
   context.fillStyle = 'red';
   context.fillRect(0, 0, 10, 10);
--- a/testing/web-platform/tests/mediacapture-image/getPhotoSettings.html
+++ b/testing/web-platform/tests/mediacapture-image/getPhotoSettings.html
@@ -34,17 +34,17 @@ promise_test(t => {
   context.fillRect(0, 0, 10, 10);
   let stream = canvas.captureStream();
   let videoTrack = stream.getVideoTracks()[0];
   videoTrack.stop();
 
   let capturer = new ImageCapture(videoTrack);
   assert_equals(videoTrack.readyState, 'ended');
 
-  return promise_rejects(t, 'InvalidStateError', capturer.getPhotoSettings())
+  return promise_rejects_dom(t, 'InvalidStateError', capturer.getPhotoSettings())
 
 }, 'getPhotoSettings() of an ended Track should throw "InvalidStateError"');
 
 async_test(t => {
   let canvas = document.getElementById('canvas');
   let context = canvas.getContext('2d');
   context.fillStyle = 'red';
   context.fillRect(0, 0, 10, 10);
--- a/testing/web-platform/tests/mediacapture-image/takePhoto.html
+++ b/testing/web-platform/tests/mediacapture-image/takePhoto.html
@@ -49,13 +49,13 @@ promise_test(t => {
   context.fillRect(0, 0, 10, 10);
   let stream = canvas.captureStream();
   let videoTrack = stream.getVideoTracks()[0];
   videoTrack.stop();
 
   let capturer = new ImageCapture(videoTrack);
   assert_equals(videoTrack.readyState, 'ended');
 
-  return promise_rejects(t, 'InvalidStateError', capturer.takePhoto())
+  return promise_rejects_dom(t, 'InvalidStateError', capturer.takePhoto())
 
 }, 'takePhoto() of an ended Track should throw "InvalidStateError"');
 
 </script>
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getDirectory.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getDirectory.js
@@ -1,10 +1,10 @@
 directory_test(async (t, root) => {
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'NotFoundError', root.getDirectory('non-existing-dir'));
 }, 'getDirectory(create=false) rejects for non-existing directories');
 
 directory_test(async (t, root) => {
   const handle = await root.getDirectory('non-existing-dir', {create: true});
   t.add_cleanup(() => root.removeEntry('non-existing-dir', {recursive: true}));
 
   assert_false(handle.isFile);
@@ -42,20 +42,20 @@ directory_test(async (t, root) => {
   assert_true(handle.isDirectory);
   assert_equals(handle.name, 'dir-with-contents');
   assert_array_equals(await getSortedDirectoryEntries(handle), ['test-file']);
 }, 'getDirectory(create=true) returns existing directories without erasing');
 
 directory_test(async (t, root) => {
   await createEmptyFile(t, 'file-name', root);
 
-  await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name'));
-  await promise_rejects(
+  await promise_rejects_dom(t, 'TypeMismatchError', root.getDirectory('file-name'));
+  await promise_rejects_dom(
       t, 'TypeMismatchError', root.getDirectory('file-name', {create: false}));
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'TypeMismatchError', root.getDirectory('file-name', {create: true}));
 }, 'getDirectory() when a file already exists with the same name');
 
 directory_test(async (t, dir) => {
   await promise_rejects_js(
       t, TypeError, dir.getDirectory('', {create: true}));
   await promise_rejects_js(
       t, TypeError, dir.getDirectory('', {create: false}));
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getFile.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-getFile.js
@@ -1,10 +1,10 @@
 directory_test(async (t, dir) => {
-  await promise_rejects(t, 'NotFoundError', dir.getFile('non-existing-file'));
+  await promise_rejects_dom(t, 'NotFoundError', dir.getFile('non-existing-file'));
 }, 'getFile(create=false) rejects for non-existing files');
 
 directory_test(async (t, dir) => {
   const handle = await dir.getFile('non-existing-file', {create: true});
   t.add_cleanup(() => dir.removeEntry('non-existing-file'));
 
   assert_true(handle.isFile);
   assert_false(handle.isDirectory);
@@ -36,24 +36,24 @@ directory_test(async (t, dir) => {
   assert_equals(await getFileSize(handle), 10);
   assert_equals(await getFileContents(handle), '1234567890');
 }, 'getFile(create=true) returns existing files without erasing');
 
 directory_test(async (t, dir) => {
   const dir_handle = await dir.getDirectory('dir-name', {create: true});
   t.add_cleanup(() => dir.removeEntry('dir-name', {recursive: true}));
 
-  await promise_rejects(t, 'TypeMismatchError', dir.getFile('dir-name'));
+  await promise_rejects_dom(t, 'TypeMismatchError', dir.getFile('dir-name'));
 }, 'getFile(create=false) when a directory already exists with the same name');
 
 directory_test(async (t, dir) => {
   const dir_handle = await dir.getDirectory('dir-name', {create: true});
   t.add_cleanup(() => dir.removeEntry('dir-name', {recursive: true}));
 
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'TypeMismatchError', dir.getFile('dir-name', {create: true}));
 }, 'getFile(create=true) when a directory already exists with the same name');
 
 directory_test(async (t, dir) => {
   await promise_rejects_js(t, TypeError, dir.getFile('', {create: true}));
   await promise_rejects_js(t, TypeError, dir.getFile('', {create: false}));
 }, 'getFile() with empty name');
 
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-removeEntry.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemDirectoryHandle-removeEntry.js
@@ -1,42 +1,42 @@
 
 directory_test(async (t, root) => {
   const handle =
       await createFileWithContents(t, 'file-to-remove', '12345', root);
   await createFileWithContents(t, 'file-to-keep', 'abc', root);
   await root.removeEntry('file-to-remove');
 
   assert_array_equals(await getSortedDirectoryEntries(root), ['file-to-keep']);
-  await promise_rejects(t, 'NotFoundError', getFileContents(handle));
+  await promise_rejects_dom(t, 'NotFoundError', getFileContents(handle));
 }, 'removeEntry() to remove a file');
 
 directory_test(async (t, root) => {
   const handle =
       await createFileWithContents(t, 'file-to-remove', '12345', root);
   await root.removeEntry('file-to-remove');
 
-  await promise_rejects(t, 'NotFoundError', root.removeEntry('file-to-remove'));
+  await promise_rejects_dom(t, 'NotFoundError', root.removeEntry('file-to-remove'));
 }, 'removeEntry() on an already removed file should fail');
 
 directory_test(async (t, root) => {
   const dir = await root.getDirectory('dir-to-remove', {create: true});
   await createFileWithContents(t, 'file-to-keep', 'abc', root);
   await root.removeEntry('dir-to-remove');
 
   assert_array_equals(await getSortedDirectoryEntries(root), ['file-to-keep']);
-  await promise_rejects(t, 'NotFoundError', getSortedDirectoryEntries(dir));
+  await promise_rejects_dom(t, 'NotFoundError', getSortedDirectoryEntries(dir));
 }, 'removeEntry() to remove an empty directory');
 
 directory_test(async (t, root) => {
   const dir = await root.getDirectory('dir-to-remove', {create: true});
   t.add_cleanup(() => root.removeEntry('dir-to-remove', {recursive: true}));
   await createEmptyFile(t, 'file-in-dir', dir);
 
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidModificationError', root.removeEntry('dir-to-remove'));
   assert_array_equals(
       await getSortedDirectoryEntries(root), ['dir-to-remove/']);
   assert_array_equals(await getSortedDirectoryEntries(dir), ['file-in-dir']);
 }, 'removeEntry() on a non-empty directory should fail');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'dir', root);
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-piped.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-piped.js
@@ -122,14 +122,14 @@ directory_test(async (t, root) => {
   const body = await response.body;
 
   const abortController = new AbortController();
   const signal = abortController.signal;
 
   const promise = body.pipeTo(wfs, { signal });
   await abortController.abort();
 
-  await promise_rejects(t, 'AbortError', promise, 'stream is aborted');
+  await promise_rejects_dom(t, 'AbortError', promise, 'stream is aborted');
   await promise_rejects_js(t, TypeError, wfs.close(), 'stream cannot be closed to flush writes');
 
   assert_equals(await getFileContents(handle), '');
   assert_equals(await getFileSize(handle), 0);
 }, 'abort() aborts write');
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream-write.js
@@ -112,17 +112,17 @@ await stream.close();
 assert_equals(await getFileContents(handle), '1234abc890');
 assert_equals(await getFileSize(handle), 10);
 }, 'write() called with a blob and a valid offset');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'bad_offset', root);
   const stream = await handle.createWritable();
 
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', stream.write({type: 'write', position: 4, data: new Blob(['abc'])}));
   await promise_rejects_js(
       t, TypeError, stream.close(), 'stream is already closed');
 
   assert_equals(await getFileContents(handle), '');
   assert_equals(await getFileSize(handle), 0);
 }, 'write() called with an invalid offset');
 
@@ -197,17 +197,17 @@ directory_test(async (t, root) => {
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'close_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const stream = await handle.createWritable();
   await stream.write('foo');
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', stream.close());
+  await promise_rejects_dom(t, 'NotFoundError', stream.close());
 }, 'atomic writes: close() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'atomic_writes.txt', root);
   const stream = await handle.createWritable();
   await stream.write('foox');
 
   const stream2 = await handle.createWritable();
@@ -280,17 +280,17 @@ directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'atomic_writable_file_stream_persists_removed.txt';
   const handle = await createFileWithContents(t, file_name, 'foo', dir);
 
   const stream = await handle.createWritable();
   await stream.write('bar');
 
   await dir.removeEntry(file_name);
-  await promise_rejects(t, 'NotFoundError', getFileContents(handle));
+  await promise_rejects_dom(t, 'NotFoundError', getFileContents(handle));
 
   await stream.close();
   assert_equals(await getFileContents(handle), 'bar');
   assert_equals(await getFileSize(handle), 3);
 }, 'atomic writes: writable file stream persists file on close, even if file is removed');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'writer_written', root);
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWritableFileStream.js
@@ -23,37 +23,37 @@ directory_test(async (t, root) => {
 }, 'truncate() to grow a file');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'create_writable_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', handle.createWritable());
+  await promise_rejects_dom(t, 'NotFoundError', handle.createWritable());
 }, 'createWritable() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'write_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const stream = await handle.createWritable();
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', stream.write('foo'));
+  await promise_rejects_dom(t, 'NotFoundError', stream.write('foo'));
 }, 'write() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'truncate_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const stream = await handle.createWritable();
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', stream.truncate(0));
+  await promise_rejects_dom(t, 'NotFoundError', stream.truncate(0));
 }, 'truncate() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const handle = await createFileWithContents(
       t, 'atomic_file_is_copied.txt', 'fooks', root);
   const stream = await handle.createWritable({keepExistingData: true});
 
   await stream.write('bar');
--- a/testing/web-platform/tests/native-file-system/script-tests/FileSystemWriter.js
+++ b/testing/web-platform/tests/native-file-system/script-tests/FileSystemWriter.js
@@ -31,17 +31,17 @@ directory_test(async (t, root) => {
   assert_equals(await getFileContents(handle), '1234abc890');
   assert_equals(await getFileSize(handle), 10);
 }, 'write() called with a blob and a valid offset');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'bad_offset', root);
   const writer = await handle.createWriter();
 
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', writer.write(4, new Blob(['abc'])));
   await writer.close();
 
   assert_equals(await getFileContents(handle), '');
   assert_equals(await getFileSize(handle), 0);
 }, 'write() called with an invalid offset');
 
 directory_test(async (t, root) => {
@@ -137,48 +137,48 @@ directory_test(async (t, root) => {
 }, 'truncate() to grow a file');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'create_writer_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', handle.createWriter());
+  await promise_rejects_dom(t, 'NotFoundError', handle.createWriter());
 }, 'createWriter() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'write_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const writer = await handle.createWriter();
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', writer.write(0, new Blob(['foo'])));
+  await promise_rejects_dom(t, 'NotFoundError', writer.write(0, new Blob(['foo'])));
 }, 'write() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'truncate_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const writer = await handle.createWriter();
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', writer.truncate(0));
+  await promise_rejects_dom(t, 'NotFoundError', writer.truncate(0));
 }, 'truncate() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'close_fails_when_dir_removed.txt';
   const handle = await createEmptyFile(t, file_name, dir);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foo']));
 
   await root.removeEntry('parent_dir', {recursive: true});
-  await promise_rejects(t, 'NotFoundError', writer.close());
+  await promise_rejects_dom(t, 'NotFoundError', writer.close());
 }, 'atomic writes: close() fails when parent directory is removed');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'atomic_writes.txt', root);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foox']));
 
   const writer2 = await handle.createWriter();
@@ -199,43 +199,43 @@ directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'atomic_write_after_close.txt', root);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foo']));
 
   await writer.close();
   assert_equals(await getFileContents(handle), 'foo');
   assert_equals(await getFileSize(handle), 3);
 
-  await promise_rejects(
+  await promise_rejects_dom(
       t, 'InvalidStateError', writer.write(0, new Blob(['abc'])));
 }, 'atomic writes: write() after close() fails');
 
 directory_test(async (t, root) => {
   const handle =
       await createEmptyFile(t, 'atomic_truncate_after_close.txt', root);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foo']));
 
   await writer.close();
   assert_equals(await getFileContents(handle), 'foo');
   assert_equals(await getFileSize(handle), 3);
 
-  await promise_rejects(t, 'InvalidStateError', writer.truncate(0));
+  await promise_rejects_dom(t, 'InvalidStateError', writer.truncate(0));
 }, 'atomic writes: truncate() after close() fails');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'atomic_close_after_close.txt', root);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foo']));
 
   await writer.close();
   assert_equals(await getFileContents(handle), 'foo');
   assert_equals(await getFileSize(handle), 3);
 
-  await promise_rejects(t, 'InvalidStateError', writer.close());
+  await promise_rejects_dom(t, 'InvalidStateError', writer.close());
 }, 'atomic writes: close() after close() fails');
 
 directory_test(async (t, root) => {
   const handle = await createEmptyFile(t, 'there_can_be_only_one.txt', root);
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['foo']));
 
   // This test might be flaky if there is a race condition allowing
@@ -274,14 +274,14 @@ directory_test(async (t, root) => {
   const dir = await createDirectory(t, 'parent_dir', root);
   const file_name = 'atomic_writer_persists_removed.txt';
   const handle = await createFileWithContents(t, file_name, 'foo', dir);
 
   const writer = await handle.createWriter();
   await writer.write(0, new Blob(['bar']));
 
   await dir.removeEntry(file_name);
-  await promise_rejects(t, 'NotFoundError', getFileContents(handle));
+  await promise_rejects_dom(t, 'NotFoundError', getFileContents(handle));
 
   await writer.close();
   assert_equals(await getFileContents(handle), 'bar');
   assert_equals(await getFileSize(handle), 3);
 }, 'atomic writes: writer persists file on close, even if file is removed');
--- a/testing/web-platform/tests/payment-handler/can-make-payment-event.https.html
+++ b/testing/web-platform/tests/payment-handler/can-make-payment-event.https.html
@@ -118,17 +118,17 @@ promise_test(async t => {
       'NotAllowedError',
       'If it throws, then it must be NotAllowedError',
     );
   }
   assert_false(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return false.',
   );
-  await promise_rejects(t, 'NotSupportedError', request.show());
+  await promise_rejects_dom(t, 'NotSupportedError', request.show());
 }, 'If a payment handler is not installed, then the payment method is not supported.');
 
 promise_test(async t => {
   const methodName = window.location.origin + '/canMakePayment-false';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
@@ -140,17 +140,17 @@ promise_test(async t => {
       'NotAllowedError',
       'If it throws, then it must be NotAllowedError',
     );
   }
   assert_false(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return false.',
   );
-  await promise_rejects(t, 'NotSupportedError', request.show());
+  await promise_rejects_dom(t, 'NotSupportedError', request.show());
 }, 'If CanMakePaymentEvent.respondWith(false) is called, then the payment method is not supported.');
 
 promise_test(async t => {
   const methodName = window.location.origin + '/canMakePayment-promise-false';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
@@ -162,17 +162,17 @@ promise_test(async t => {
       'NotAllowedError',
       'If it throws, then it must be NotAllowedError',
     );
   }
   assert_false(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return false.',
   );
-  await promise_rejects(t, 'NotSupportedError', request.show());
+  await promise_rejects_dom(t, 'NotSupportedError', request.show());
 }, 'If CanMakePaymentEvent.respondWith(Promise.resolve(false)) is called, then the payment method is not supported.');
 
 promise_test(async t => {
   const methodName = window.location.origin + '/canMakePayment-true';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
@@ -186,17 +186,17 @@ promise_test(async t => {
     );
   }
   assert_true(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return true.',
   );
   const acceptPromise = request.show();
   await request.abort();
-  await promise_rejects(t, 'AbortError', acceptPromise);
+  await promise_rejects_dom(t, 'AbortError', acceptPromise);
 }, 'If CanMakePaymentEvent.respondWith(true) is called, then the payment method is supported.');
 
 promise_test(async t => {
   const methodName = window.location.origin + '/canMakePayment-promise-true';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
@@ -210,17 +210,17 @@ promise_test(async t => {
     );
   }
   assert_true(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return true.',
   );
   const acceptPromise = request.show();
   await request.abort();
-  await promise_rejects(t, 'AbortError', acceptPromise);
+  await promise_rejects_dom(t, 'AbortError', acceptPromise);
 }, 'If CanMakePaymentEvent.respondWith(Promise.resolve(true)) is called, then the payment method is supported.');
 
 promise_test(async t => {
   const methodName = window.location.origin + '/canMakePayment-custom-error';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
@@ -232,17 +232,17 @@ promise_test(async t => {
       'NotAllowedError',
       'If it throws, then it must be NotAllowedError',
     );
   }
   assert_false(
     paymentRequestCanMakePaymentResult,
     'canMakePayment() must return false.',
   );
-  await promise_rejects(t, 'NotSupportedError', request.show());
+  await promise_rejects_dom(t, 'NotSupportedError', request.show());
 }, 'If CanMakePaymentEvent.respondWith(Promise.reject(error)) is called, then the payment method is not supported.');
 
 promise_test(async t => {
   const methodName = 'basic-card';
   await registerApp(methodName);
   const request = buildPaymentRequest(methodName);
   assert_not_equals(request, undefined);
   let paymentRequestCanMakePaymentResult;
--- a/testing/web-platform/tests/payment-handler/change-payment-method-manual.https.html
+++ b/testing/web-platform/tests/payment-handler/change-payment-method-manual.https.html
@@ -45,17 +45,17 @@
         assert_equals(event.methodDetails.country, 'US');
         event.updateWith(Promise.reject('Error'));
       });
       const response_promise = test_driver.bless(
         'showing a payment sheet',
         () => request.show()
       );
 
-      return promise_rejects(t, 'AbortError', response_promise);
+      return promise_rejects_dom(t, 'AbortError', response_promise);
     }, 'If updateWith(details) is rejected, abort the PaymentRequest.show().');
 
     promise_test(async (t) => {
       const request = new PaymentRequest([{supportedMethods: methodName}], {
         total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}},
       });
       request.addEventListener('paymentmethodchange', (event) => {
         assert_equals(event.methodName, methodName);
@@ -66,17 +66,17 @@
           })
         );
       });
       const response_promise = test_driver.bless(
         'showing a payment sheet',
         () => request.show()
       );
 
-      return promise_rejects(t, 'AbortError', response_promise);
+      return promise_rejects_dom(t, 'AbortError', response_promise);
     }, 'If updateWith(details) throws inside of the promise, abort the PaymentRequest.show().');
 
     promise_test(async (t) => {
       const request = new PaymentRequest([{supportedMethods: methodName}], {
         total: {label: 'Total', amount: {currency: 'USD', value: '0.01'}},
       });
       request.addEventListener('paymentmethodchange', (event) => {
         assert_equals(event.methodName, methodName);
--- a/testing/web-platform/tests/payment-method-basic-card/apply_the_modifiers.html
+++ b/testing/web-platform/tests/payment-method-basic-card/apply_the_modifiers.html
@@ -63,56 +63,56 @@
       const visaModifier = Object.assign({}, modifier, {
         data: { supportedNetworks: ["visa"] },
       });
       visaModifier.total.label = "PASS - VISA MODIFIED";
       const details = Object.assign({}, defaultDetails, {
         modifiers: [visaModifier],
       });
       const showPromise = new PaymentRequest(basicCard, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function modifierWithNoDataAppliesToAll(testableAssertion) {
     promise_test(async t => {
       const details = Object.assign({}, defaultDetails, {
         modifiers: [modifier],
       });
       const showPromise = new PaymentRequest(basicCard, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function modifierWithObjectAppliesToAll(testableAssertion) {
     promise_test(async t => {
       const modifiers = [Object.assign({}, modifier, { data: {} })];
       const details = Object.assign({}, defaultDetails, { modifiers });
       const showPromise = new PaymentRequest(basicCard, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function modifierWithEmptySupportedNetworksAppliesToAll(testableAssertion) {
     promise_test(async t => {
       const modifiers = [
         Object.assign({}, modifier, { data: { supportedNetworks: [] } }),
       ];
       const details = Object.assign({}, defaultDetails, { modifiers });
       const showPromise = new PaymentRequest(basicCard, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function modifierLastOneWins(testableAssertion) {
     promise_test(async t => {
       const modifiers = [failModifier, modifier, notBasicCardModifier];
       const details = Object.assign({}, defaultDetails, { modifiers });
       const showPromise = new PaymentRequest(basicCard, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 </script>
 <h1>Manual tests</h1>
 <p>
   <strong>Note:</strong> this test requires that there is at at least one
   registered "visa" card. If the payment-sheet total's
   label displays "PASS", and the value US$12345, then a test has passed.
--- a/testing/web-platform/tests/payment-method-basic-card/steps_for_selecting_the_payment_handler.html
+++ b/testing/web-platform/tests/payment-method-basic-card/steps_for_selecting_the_payment_handler.html
@@ -24,17 +24,17 @@
   function emptyDataIsAllNetworks(testableAssertion) {
     promise_test(async t => {
       const methodData = [
         {
           supportedMethods: "basic-card",
         },
       ];
       const showPromise = new PaymentRequest(methodData, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function mixedPMILastOneWins(testableAssertion) {
     promise_test(async t => {
       const methodData = [
         {
           supportedMethods: "basic-card",
@@ -48,17 +48,17 @@
             supportedNetworks: ["visa"],
           },
         },
         {
           supportedMethods: "https://example.com/bobpay",
         },
       ];
       const showPromise = new PaymentRequest(methodData, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 
   function lastOneWinsEvenIfDataIsMissing(testableAssertion) {
     promise_test(async t => {
       const methodData = [
         {
           supportedMethods: "basic-card",
@@ -67,17 +67,17 @@
           },
         },
         // Same as data: { supportedNetworks: [] }
         {
           supportedMethods: "basic-card",
         },
       ];
       const showPromise = new PaymentRequest(methodData, defaultDetails).show();
-      await promise_rejects(t, "AbortError", showPromise);
+      await promise_rejects_dom(t, "AbortError", showPromise);
     }, testableAssertion.trim());
   }
 </script>
 <h1>Manual tests</h1>
 <ol>
   <li>
     <p>
       To pass, this test must show the payment sheet and allow paying with any
--- a/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html
+++ b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-call-immediate-manual.https.html
@@ -66,17 +66,17 @@ function testImmediateUpdate({ textConte
               reject(err); // this is good.
             }
           });
         },
         { once: true }
       );
     });
     const acceptPromise = request.show();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       eventPromise,
       "The event loop already spun, so [[waitForUpdate]] is now true"
     );
     const response = await acceptPromise;
     await response.complete();
   }, testName.trim());
@@ -98,17 +98,17 @@ function testSubsequentUpdateWithCalls({
           ev.updateWith(validDetails);
           resolve(); // this is bad, we should never get to here.
         } catch (err) {
           reject(err); // this is good!
         }
       });
     });
     const responsePromise = request.show();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       eventPromise,
       "Expected eventPromise to have rejected, because updateWith() was a called twice"
     );
     const response = await responsePromise;
     await response.complete();
   }, testName.trim());
--- a/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html
+++ b/testing/web-platform/tests/payment-request/PaymentRequestUpdateEvent/updateWith-method-abort-update-manual.https.html
@@ -161,17 +161,17 @@ function testBadUpdate(button, badDetail
     const acceptPromise = request.show();
     await promise_rejects(
       t,
       expectedError,
       acceptPromise,
       "badDetails must cause acceptPromise to reject with expectedError"
     );
     // The request [[state]] is now "closed", so let's check for InvalidStateError
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       request.show(),
       "show() must reject with InvalidStateError"
     );
   }, button.innerText.trim());
 }
 </script>
--- a/testing/web-platform/tests/payment-request/algorithms-manual.https.html
+++ b/testing/web-platform/tests/payment-request/algorithms-manual.https.html
@@ -105,19 +105,19 @@ function testFireEvent(button, details, 
 }
 
 async function runAbortTest(button) {
   button.disabled = true;
   const { textContent: testName } = button;
   promise_test(async t => {
     const request = new PaymentRequest(methods, detailsNoShippingOptions);
     // Await the user to abort
-    await promise_rejects(t, "AbortError", request.show());
+    await promise_rejects_dom(t, "AbortError", request.show());
     // [[state]] is now closed
-    await promise_rejects(t, "InvalidStateError", request.show());
+    await promise_rejects_dom(t, "InvalidStateError", request.show());
   }, testName.trim());
 }
 </script>
 <h2>
   Tests for "algorithms" section
 </h2>
 <p>
   Click on each button in sequence from top to bottom without refreshing the page.
--- a/testing/web-platform/tests/payment-request/payment-is-showing.https.html
+++ b/testing/web-platform/tests/payment-request/payment-is-showing.https.html
@@ -73,36 +73,36 @@
       // showing boolean" to true and then try to show a second payment sheet in
       // the same window. The second show() should reject.
       const [showPromise1, showPromise2] = await test_driver.bless(
         "testing one payment sheet per window",
         () => {
           return [request1.show(), request2.show()];
         },
       );
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         showPromise2,
         "Attempting to show a second payment request must reject.",
       );
 
       await request1.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         showPromise1,
         "request1 was aborted via .abort()",
       );
 
       // Finally, request2 should have been "closed", so trying to show
       // it will again result in promise rejected with an InvalidStateError.
       // See: https://github.com/w3c/payment-request/pull/821
       const rejectedPromise = request2.show();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "InvalidStateError",
         rejectedPromise,
         "Attempting to show a second payment request must reject.",
       );
       // Finally, we confirm that request2's returned promises are unique.
       assert_not_equals(
         showPromise2,
@@ -125,17 +125,17 @@
         () => {
           // iframe sets "is showing boolean", ignore the returned promise.
           iframeRequest.show();
           // The top level window now tries to show() the payment request.
           return [windowRequest.show()];
         },
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         showPromise,
         "iframe is already showing a payment request.",
       );
 
       // Cleanup
       await iframeRequest.abort();
@@ -155,26 +155,26 @@
       // show a payment request in the iframe, which should reject.
       const [windowShowPromise, iframeShowPromise] = await test_driver.bless(
         "testing iframe show() blocked by payment sheet in top window",
         () => {
           return [windowRequest.show(), iframeRequest.show()];
         },
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         iframeShowPromise,
         "The top window is already showing a payment request.",
       );
 
       // Cleanup
       await windowRequest.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         windowShowPromise,
         "The window payment request should be aborted by test.",
         );
       iframe.remove();
     }, "An iframe cannot show a payment request if the top-level window is already showing one.");
 
@@ -201,25 +201,25 @@
             popupWindow,
             popupRequest,
             popupShowPromise,
             windowShowPromise,
           ];
         },
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         windowShowPromise,
         "Expected window's showPromise to reject, request is already showing",
       );
 
       await popupRequest.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         popupShowPromise,
         "Expected popupShowPromise to be aborted by test.",
       );
       popupWindow.close();
     }, "Using a popup window prevents the top-browsing context from showing a payment request");
 
@@ -255,32 +255,32 @@
           return [
             windowRequest.show(),
             popupRequest.show(),
             iframeRequest.show(),
           ];
         },
       );
       // popupRequest and iframeRequest will both reject
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         popupShowPromise,
         "Expected popupShowPromise to reject, request is already showing.",
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         iframeShowPromise,
         "Expected iframeShowPromise to reject, request is already showing.",
       );
 
       await windowRequest.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         windowShowPromise,
         "Expect window promise to be aborted by test."
       );
       popupWindow.close();
       iframe.remove();
     }, "Given multiple nested browsing contexts, and window calls show() first, other nested browsing contexts can't show a request.");
@@ -311,32 +311,32 @@
           return [popupWindow,
                   popupRequest,
                   popupShowPromise,
                   windowShowPromise,
                   iframeShowPromise];
       });
 
       // windowShowPromise and iframeRequest will both reject
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         windowShowPromise,
         "Expected windowShowPromise to reject, the popup is showing a payment request.",
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         iframeShowPromise,
         "Expected iframeShowPromise to reject, the popup is showing a payment request.",
       );
 
       await popupRequest.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         popupShowPromise,
         "Expected popupShowPromise to be aborted by test.",
       );
       popupWindow.close();
       iframe.remove();
     }, "Given multiple nested browsing contexts, and popup calls show() first, other nested browsing contexts can't show a request.");
@@ -372,32 +372,32 @@
             iframeRequest.show(),
             popupRequest.show(),
             windowRequest.show(),
           ];
         },
       );
 
       // windowShowPromise and iframeRequest will both reject
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         windowShowPromise,
         "Expected windowShowPromise to reject, the popup is showing a payment request.",
       );
 
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         popupShowPromise,
         "Expected popupShowPromise to reject, the popup is showing a payment request.",
       );
 
       await iframeRequest.abort();
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         iframeShowPromise,
         "Expected iframeShowPromise to be aborted by test."
       );
       popupWindow.close();
       iframe.remove();
     }, "Given multiple nested browsing contexts, and an iframe calls show() first, other nested browsing contexts can't show a request.");
@@ -410,17 +410,17 @@
         "test navigating iframe after show()",
         () => iframeRequest.show(),
       );
 
       // We navigate away, causing the payment sheet to close
       // and the request is showing boolean to become false.
       iframe.src = "blank.html?abc=123";
       await new Promise(resolve => (iframe.onload = resolve));
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "AbortError",
         iframeShowPromise,
         "Navigating iframe away must cause the iframeShowPromise to reject.",
       );
       iframe.remove();
 
       // Now we should be ok to spin up a new payment request
--- a/testing/web-platform/tests/payment-request/payment-request-abort-method.https.html
+++ b/testing/web-platform/tests/payment-request/payment-request-abort-method.https.html
@@ -34,17 +34,17 @@ const defaultDetails = Object.freeze({
       value: "1.00",
     },
   },
 });
 
 promise_test(async t => {
   // request is in "created" state
   const request = new PaymentRequest(defaultMethods, defaultDetails);
-  await promise_rejects(t, "InvalidStateError", request.abort());
+  await promise_rejects_dom(t, "InvalidStateError", request.abort());
 }, `Throws if the promise [[state]] is not "interactive"`);
 
 promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const promises = new Set([request.abort(), request.abort(), request.abort()]);
   assert_equals(promises.size, 3, "Must have three unique objects");
 }, "Calling abort() multiple times is always a new object.");
 
@@ -55,40 +55,40 @@ promise_test(async t => {
     () => {
       const acceptPromise = request.show()
       acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
       const abortPromise = request.abort();
       return [abortPromise, acceptPromise];
     });
 
   await abortPromise;
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
   // As request is now "closed", trying to show it will fail
-  await promise_rejects(t, "InvalidStateError", request.show());
+  await promise_rejects_dom(t, "InvalidStateError", request.show());
 }, "The same request cannot be shown multiple times.");
 
 promise_test(async t => {
   // request is in "created" state.
   const request = new PaymentRequest(defaultMethods, defaultDetails);
-  await promise_rejects(t, "InvalidStateError", request.abort());
+  await promise_rejects_dom(t, "InvalidStateError", request.abort());
   // Call it again, for good measure.
-  await promise_rejects(t, "InvalidStateError", request.abort());
+  await promise_rejects_dom(t, "InvalidStateError", request.abort());
   // The request's state is "created", so let's show it
   // which changes the state to "interactive.".
   const [abortPromise, acceptPromise] = await test_driver.bless(
     "show payment request",
     () => {
       const acceptPromise = request.show()
       // Let's set request the state to "closed" by calling .abort()
       const abortPromise = request.abort();
       return [abortPromise, acceptPromise];
     });
 
   await abortPromise;
   // The request is now "closed", so...
-  await promise_rejects(t, "InvalidStateError", request.abort());
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "InvalidStateError", request.abort());
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
 }, "Aborting a request before it is shown doesn't prevent it from being shown later.");
 </script>
 <small>
   If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
   and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
 </small>
--- a/testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html
+++ b/testing/web-platform/tests/payment-request/payment-request-canmakepayment-method.https.html
@@ -84,37 +84,37 @@ promise_test(async t => {
   const [acceptPromise, canMakePaymentPromise] = await test_driver.bless(
     "show payment request",
     () => {
       const acceptPromise = request.show(); // Sets state to "interactive"
       const canMakePaymentPromise = request.canMakePayment();
       return [acceptPromise, canMakePaymentPromise];
     });
 
-  await promise_rejects(t, "InvalidStateError", canMakePaymentPromise);
+  await promise_rejects_dom(t, "InvalidStateError", canMakePaymentPromise);
   request.abort();
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
 
   // The state should be "closed"
-  await promise_rejects(t, "InvalidStateError", request.canMakePayment());
+  await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment());
 }, 'If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.');
 
 promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const [abortPromise, acceptPromise] = await test_driver.bless(
     "show payment request",
     () => {
       const acceptPromise = request.show(); // Sets state to "interactive"
       acceptPromise.catch(() => {}); // no-op, just to silence unhandled rejection in devtools.
       const abortPromise = request.abort();  // Sets state to "closed"
       return [abortPromise, acceptPromise];
     });
 
   await abortPromise;
-  await promise_rejects(t, "AbortError", acceptPromise);
-  await promise_rejects(t, "InvalidStateError", request.canMakePayment());
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "InvalidStateError", request.canMakePayment());
 }, 'If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.');
 </script>
 
 <small>
   If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
   and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
 </small>
--- a/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html
+++ b/testing/web-platform/tests/payment-request/payment-request-hasenrolledinstrument-method.tentative.https.html
@@ -42,34 +42,34 @@ promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const [acceptPromise, hasEnrolledInstrumentPromise] = await test_driver.bless(
       "show payment request",
       () => {
         const acceptPromise = request.show();  // Sets state to "interactive"
         const hasEnrolledInstrumentPromise = request.hasEnrolledInstrument();
         return [acceptPromise, hasEnrolledInstrumentPromise];
       });
-  await promise_rejects(t, "InvalidStateError", hasEnrolledInstrumentPromise);
+  await promise_rejects_dom(t, "InvalidStateError", hasEnrolledInstrumentPromise);
 
   await request.abort();
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
 }, `If request.[[state]] is "interactive", then return a promise rejected with an "InvalidStateError" DOMException.`);
 
 promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const [abortPromise, acceptPromise] = await test_driver.bless( "show payment request", () => {
     const acceptPromise = request.show();  // Sets state to "interactive"
     acceptPromise.catch(() => {});  // no-op, just to handle unhandled rejection in devtools.
     const abortPromise =request.abort();  // Sets state to "closed"
     return [abortPromise, acceptPromise];
   });
   await abortPromise;
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
 
   const hasEnrolledInstrumentPromise = request.hasEnrolledInstrument();
-  await promise_rejects(t, "InvalidStateError", hasEnrolledInstrumentPromise);
+  await promise_rejects_dom(t, "InvalidStateError", hasEnrolledInstrumentPromise);
 }, `If request.[[state]] is "closed", then return a promise rejected with an "InvalidStateError" DOMException.`);
 </script>
 
 <small>
   If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
   and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
 </small>
--- a/testing/web-platform/tests/payment-request/payment-request-show-method.https.html
+++ b/testing/web-platform/tests/payment-request/payment-request-show-method.https.html
@@ -38,79 +38,79 @@ promise_test(async t => {
   // Abort the request after 2 seconds if it has not rejected. This allows the
   // other tests in this file to run even if a non-compliant browser shows the
   // payment sheet without user activation.
   t.step_timeout(() => {
     t.force_timeout();
     request.abort();
   }, 2000);
 
-  await promise_rejects(t, "SecurityError", acceptPromise);
+  await promise_rejects_dom(t, "SecurityError", acceptPromise);
 }, `Calling show() without being triggered by user interaction throws`);
 
 promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const [acceptPromise] = await test_driver.bless(
     "test: throws if the promise [[state]] is not 'created'",
     () => {
       const acceptPromise = request.show(); // Sets state to "interactive"
       return [acceptPromise];
     });
-  await promise_rejects(t, "InvalidStateError", request.show());
+  await promise_rejects_dom(t, "InvalidStateError", request.show());
   await request.abort();
-  await promise_rejects(t, "AbortError", acceptPromise);
+  await promise_rejects_dom(t, "AbortError", acceptPromise);
 }, "Throws if the promise [[state]] is not 'created'.");
 
 promise_test(async t => {
   const request1 = new PaymentRequest(defaultMethods, defaultDetails);
   const request2 = new PaymentRequest(defaultMethods, defaultDetails);
   const [acceptPromise1] = await test_driver.bless(
     `test: reject promise with "AbortedError" if payment request is already showing`,
     async () => {
       const acceptPromise1 = request1.show();
       const acceptPromise2 = request2.show();
-      await promise_rejects(t, "AbortError", acceptPromise2);
+      await promise_rejects_dom(t, "AbortError", acceptPromise2);
       return [acceptPromise1];
     });
 
   await request1.abort();
-  await promise_rejects(t, "AbortError", acceptPromise1);
+  await promise_rejects_dom(t, "AbortError", acceptPromise1);
 }, `If the user agent's "payment request is showing" boolean is true, then return a promise rejected with an "AbortError" DOMException.`);
 
 promise_test(async t => {
   const request = new PaymentRequest(
     [{ supportedMethods: "this-is-not-supported" }],
     defaultDetails
   );
   const [acceptPromise] = await test_driver.bless(
     `test: reject promise with "NotSupportedError"`,
     () => {
       const acceptPromise = request.show();
       return [acceptPromise];
     });
-  await promise_rejects(t, "NotSupportedError", acceptPromise);
+  await promise_rejects_dom(t, "NotSupportedError", acceptPromise);
 }, `If payment method consultation produces no supported method of payment, then return a promise rejected with a "NotSupportedError" DOMException.`);
 
 promise_test(async t => {
   const request = new PaymentRequest(defaultMethods, defaultDetails);
   const [p1, p2, p3] = await test_driver.bless(
     `test: calling show() multiple times always returns a new promise`,
     () => {
       const p1 = request.show();
       const p2 = request.show();
       const p3 = request.show();
       return [p1, p2, p3];
     });
   const promises = new Set([p1, p2, p3]);
   assert_equals(promises.size, 3, "Must have three unique objects");
 
-  await promise_rejects(t, "InvalidStateError", p2);
-  await promise_rejects(t, "InvalidStateError", p3);
+  await promise_rejects_dom(t, "InvalidStateError", p2);
+  await promise_rejects_dom(t, "InvalidStateError", p3);
 
   await request.abort();
-  await promise_rejects(t, "AbortError", p1);
+  await promise_rejects_dom(t, "AbortError", p1);
 }, "Calling show() multiple times always returns a new promise.");
 
 </script>
 <small>
   If you find a buggy test, please <a href="https://github.com/web-platform-tests/wpt/issues">file a bug</a>
   and tag one of the <a href="https://github.com/web-platform-tests/wpt/blob/master/payment-request/META.yml">suggested reviewers</a>.
 </small>
--- a/testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html
+++ b/testing/web-platform/tests/payment-request/payment-response/complete-method-manual.https.html
@@ -16,28 +16,28 @@ async function runManualTest({ completeW
     let invalidComplete;
     let afterComplete;
     try {
       // We .complete() as normal, using the passed test value
       completePromise = response.complete(result);
       assert_true(completePromise instanceof Promise, "returns a promise");
       // Immediately calling complete() again yields a rejected promise.
       invalidComplete = response.complete(result);
-      await promise_rejects(t, "InvalidStateError", invalidComplete);
+      await promise_rejects_dom(t, "InvalidStateError", invalidComplete);
       // but the original promise is unaffected
       const returnedValue = await completePromise;
       assert_equals(
         returnedValue,
         undefined,
         "Returned value must always be undefined"
       );
       // We now call .complete() again, to force an exception
       // because [[complete]] is true.
       afterComplete = response.complete(result);
-      await promise_rejects(t, "InvalidStateError", afterComplete);
+      await promise_rejects_dom(t, "InvalidStateError", afterComplete);
       button.innerHTML = `✅  ${button.textContent}`;
     } catch (err) {
       button.innerHTML = `❌  ${button.textContent}`;
       assert_unreached("Unexpected exception: " + err.message);
     }
     const allPromises = new Set([
       completePromise,
       invalidComplete,
--- a/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html
+++ b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-immediate-manual.https.html
@@ -25,17 +25,17 @@ function testImmediateUpdate({ textConte
         },
         { once: true }
       );
     });
 
     const retryPromise = response.retry({
       payer: { name: "Change me!" },
     });
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       eventPromise,
       "The event loop already spun, so [[waitForUpdate]] is now true"
     );
     await retryPromise;
     await response.complete("success");
   }, testName.trim());
--- a/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html
+++ b/testing/web-platform/tests/payment-request/payment-response/payerdetailschange-updateWith-manual.https.html
@@ -19,17 +19,17 @@ function runTest(button) {
         } catch (err) {
           reject(err);
         }
       });
     });
     await response.retry({
       payer: { name: "Change me!" },
     });
-    await promise_rejects(t, "InvalidStateError", eventPromise);
+    await promise_rejects_dom(t, "InvalidStateError", eventPromise);
     await response.complete("success");
   }, button.textContent.trim());
 }
 </script>
 <h2>Handling PaymentResponse.prototype.onpayerdetailchange events</h2>
 <p>
   The test brings up the Payment Request UI window.
   When shown the payment sheet, use any details and hit pay.
--- a/testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html
+++ b/testing/web-platform/tests/payment-request/payment-response/rejects_if_not_active-manual.https.html
@@ -67,17 +67,17 @@ function methodNotFullyActive(button, me
     // We navigate the iframe again, putting response's document into an inactive state.
     await new Promise(resolve => {
       iframe.addEventListener("load", resolve);
       iframe.src = "/payment-request/resources/page2.html";
     });
     // Now, response's relevant global object's document is no longer active.
     // So, promise needs to reject appropriately.
     const promise = response[methodName](...args);
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       promise,
       "Inactive document, so must throw AbortError"
     );
     // We are done, so clean up.
     iframe.remove();
   }, text);
@@ -102,17 +102,17 @@ function methodBecomesNotFullyActive(but
     // We navigate the iframe again, putting response's document into an inactive state.
     await new Promise(resolve => {
       iframe.addEventListener("load", resolve);
       iframe.src = "/payment-request/resources/page2.html";
     });
 
     // Now, response's relevant global object's document is no longer active.
     // So, promise needs to reject appropriately.
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       promise,
       "Inactive document, so must throw AbortError"
     );
     // We are done, so clean up.
     iframe.remove();
   }, text);
--- a/testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html
+++ b/testing/web-platform/tests/payment-request/payment-response/retry-method-manual.https.html
@@ -20,31 +20,31 @@ test(() => {
 }, "PaymentResponse.prototype must have a retry() function (smoke test).");
 
 function checkCompletedCantRetry(button) {
   button.disabled = true;
   promise_test(async t => {
     const { response } = await getPaymentRequestResponse();
     // sets response.[[complete]] to true.
     await response.complete("success");
-    return promise_rejects(
+    return promise_rejects_dom(
       t,
       "InvalidStateError",
       response.retry(),
       "response.[[complete]] is true, so rejects with InvalidStateError."
     );
   }, button.textContent.trim());
 }
 
 function repeatedCallsToRetry(button) {
   button.disabled = true;
   promise_test(async t => {
     const { response } = await getPaymentRequestResponse();
     const retryPromise = response.retry();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       response.retry(),
       "Calling retry() again rejects with an InvalidStateError"
     );
     await retryPromise;
     await response.complete("success");
   }, button.textContent.trim());
@@ -57,23 +57,23 @@ function callCompleteWhileRetrying(butto
     const retryPromise = response.retry();
     const completePromise1 = response.complete("success");
     const completePromise2 = response.complete("fail");
     assert_not_equals(
       completePromise1,
       completePromise2,
       "complete() must return unique promises"
     );
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       completePromise1,
       "Calling complete() while retrying rejects with an InvalidStateError"
     );
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       completePromise2,
       "Calling complete() while retrying rejects with an InvalidStateError"
     );
     assert_not_equals(
       completePromise1,
       completePromise2,
@@ -84,17 +84,17 @@ function callCompleteWhileRetrying(butto
   }, button.textContent.trim());
 }
 
 function callingRequestAbortMustNotAbort(button) {
   button.disabled = true;
   promise_test(async t => {
     const { response, request } = await getPaymentRequestResponse();
     const retryPromise = response.retry();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       request.abort(),
       "Calling request.abort() while retrying rejects with an InvalidStateError"
     );
     await retryPromise;
     await response.complete("success");
   }, button.textContent.trim());
@@ -110,42 +110,42 @@ function canRetryMultipleTimes(button) {
       "Expected undefined as the resolve value"
     );
     assert_equals(
       await response.retry(),
       undefined,
       "Expected undefined as the resolve value"
     );
     await response.complete("success");
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       response.retry(),
       "Calling retry() after complete() rejects with a InvalidStateError"
     );
   }, button.textContent.trim());
 }
 
 function userCanAbortARetry(button) {
   button.disabled = true;
   promise_test(async t => {
     const { response } = await getPaymentRequestResponse();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       response.retry(),
       "The user aborting a retry rejects with a AbortError"
     );
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       response.retry(),
       "After the user aborts, response [[complete]] is true so retry() must reject with InvalidStateError"
     );
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       response.complete("success"),
       "After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError"
     );
   }, button.textContent.trim());
 }
 
@@ -177,17 +177,17 @@ function abortTheUpdate(button) {
     const retryPromise = response.retry();
     await shipOptionChangePromise;
     await promise_rejects_js(
       t,
       TypeError,
       retryPromise,
       "retry() aborts with a TypeError, because totals' value is invalid"
     );
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       response.complete("success"),
       "After the user aborts, response [[complete]] is true, so complete() rejects with a InvalidStateError"
     );
   }, button.textContent.trim());
 }
 
--- a/testing/web-platform/tests/payment-request/rejects_if_not_active-manual.https.html
+++ b/testing/web-platform/tests/payment-request/rejects_if_not_active-manual.https.html
@@ -63,26 +63,26 @@ function testAbortShowIfDocumentIsNotAct
     );
     // We navigate the iframe again, putting request1's document into an inactive state.
     const request2 = await getLoadedPaymentRequest(
       iframe,
       "/payment-request/resources/page2.html"
     );
     // Now, request1's relevant global object's document is no longer active.
     // So, call .show(), and make sure it rejects appropriately.
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       request1.show(),
       "Inactive document, so must throw AbortError"
     );
     // request2 has an active document tho, so confirm it's working as expected:
     request2.show();
     await request2.abort();
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       request2.show(),
       "Abort already called, so InvalidStateError"
     );
     // We are done, so clean up.
     iframe.remove();
   }, "PaymentRequest.show() aborts if the document is not active.");
@@ -120,17 +120,17 @@ function testAbortShowIfDocumentIsNotFul
       outerIframe.src = "/payment-request/resources/page2.html";
     });
 
     const showPromise = request.show();
     // Now, request's relevant global object's document is still active
     // (it is the active document of the inner iframe), but is not fully active
     // (since the parent of the inner iframe is itself no longer active).
     // So, call request.show() and make sure it rejects appropriately.
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       showPromise,
       "Active, but not fully active, so must throw AbortError"
     );
     // We are done, so clean up.
 
     outerIframe.remove();
--- a/testing/web-platform/tests/payment-request/show-method-optional-promise-resolves-manual.https.html
+++ b/testing/web-platform/tests/payment-request/show-method-optional-promise-resolves-manual.https.html
@@ -185,17 +185,17 @@ function runUpdateDetailsAlgorithm(
 ) {
   const testAssertion = buttonElement.textContent.trim();
   buttonElement.disabled = true;
   promise_test(async t => {
     const request = new PaymentRequest(validMethods, initialDetails, options);
     const detailsPromise = Promise.resolve(details);
     const acceptPromise = request.show(detailsPromise);
     assert_equals(request.id, "this cannot be changed", "id must never change.");
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "AbortError",
       acceptPromise,
       "expected AbortError"
     );
   }, testAssertion);
 }
 </script>
--- a/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html
+++ b/testing/web-platform/tests/payment-request/user-abort-algorithm-manual.https.html
@@ -45,19 +45,19 @@ test(() => {
 }, "Can construct a payment request (smoke test).");
 
 async function runAbortTest(button) {
   button.disabled = true;
   const { textContent: testName } = button;
   promise_test(async t => {
     const request = new PaymentRequest(validMethods, validDetails);
     // Await the user to abort
-    await promise_rejects(t, "AbortError", request.show());
+    await promise_rejects_dom(t, "AbortError", request.show());
     // [[state]] is now closed
-    await promise_rejects(t, "InvalidStateError", request.show());
+    await promise_rejects_dom(t, "InvalidStateError", request.show());
   }, testName.trim());
 }
 </script>
 <h2>
    User aborts the payment request algorithm.
 </h2>
 <p>
   Click on each button in sequence from top to bottom without refreshing the page.
--- a/testing/web-platform/tests/payment-request/user-accepts-payment-request-algo-manual.https.html
+++ b/testing/web-platform/tests/payment-request/user-accepts-payment-request-algo-manual.https.html
@@ -92,17 +92,17 @@ function testAcceptRequestAlgorithm(
     assert_true(
       response instanceof PaymentResponse,
       "Expected an instance of PaymentResponse."
     );
     // Response [[calledComplete]] is false, so this shouldn't throw
     await response.complete("success");
     // For good measure, test that subsequent complete()
     for (const state of [undefined, "success", "fail", "unknown"]) {
-      await promise_rejects(
+      await promise_rejects_dom(
         t,
         "InvalidStateError",
         response.complete(state),
         "Response [[calledComplete]] is true, so InvalidStateError"
       );
     }
     assert_equals(
       request.id,
@@ -138,17 +138,17 @@ function testAcceptRequestAlgorithm(
     };
     for (const [attr, expectedValue] of Object.entries(expected)) {
       assert_equals(
         response[attr],
         expectedValue,
         `response.${attr} must be ${expectedValue}`
       );
     }
-    await promise_rejects(
+    await promise_rejects_dom(
       t,
       "InvalidStateError",
       request.show(),
       "Request [[state]] is closed, so InvalidStateError"
     );
   }, button.textContent.trim());
 }
 
--- a/testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/disable-picture-in-picture.html
@@ -23,26 +23,26 @@ test(t => {
 
   video.disablePictureInPicture = false;
   assert_equals(video.getAttribute('disablepictureinpicture'), null);
 }, 'Test disablePictureInPicture IDL attribute');
 
 promise_test(async t => {
   const video = await loadVideo();
   video.disablePictureInPicture = true;
-  return promise_rejects(t, 'InvalidStateError',
+  return promise_rejects_dom(t, 'InvalidStateError',
       requestPictureInPictureWithTrustedClick(video));
 }, 'Request Picture-in-Picture rejects if disablePictureInPicture is true');
 
 promise_test(async t => {
   const video = await loadVideo();
   await test_driver.bless('request Picture-in-Picture');
   const promise = video.requestPictureInPicture();
   video.disablePictureInPicture = true;
-  await promise_rejects(t, 'InvalidStateError', promise);
+  await promise_rejects_dom(t, 'InvalidStateError', promise);
   assert_equals(document.pictureInPictureElement, null);
 }, 'Request Picture-in-Picture rejects if disablePictureInPicture becomes ' +
    'true before promise resolves.');
 
 promise_test(async t => {
   const video = await loadVideo();
   return requestPictureInPictureWithTrustedClick(video)
   .then(() => {
--- a/testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/exit-picture-in-picture.html
@@ -10,12 +10,12 @@
 <script>
 promise_test(async t => {
   const video = await loadVideo();
   return requestPictureInPictureWithTrustedClick(video)
   .then(() => document.exitPictureInPicture());
 }, 'Exit Picture-in-Picture resolves when there is a Picture-in-Picture video');
 
 promise_test(t => {
-  return promise_rejects(t, 'InvalidStateError',
+  return promise_rejects_dom(t, 'InvalidStateError',
       document.exitPictureInPicture());
 }, 'Exit Picture-in-Picture rejects when there is no Picture-in-Picture video');
 </script>
--- a/testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
+++ b/testing/web-platform/tests/picture-in-picture/request-picture-in-picture-twice.html
@@ -9,17 +9,17 @@
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
   const video1 = await loadVideo();
   const video2 = await loadVideo();
   await test_driver.bless('request Picture-in-Picture');
   const promise = video1.requestPictureInPicture();
-  await promise_rejects(t, 'NotAllowedError', video2.requestPictureInPicture());
+  await promise_rejects_dom(t, 'NotAllowedError', video2.requestPictureInPicture());
   return promise;
 }, 'request Picture-in-Picture consumes user gesture');
 
 promise_test(async t => {
   const video1 = await loadVideo();
   const video2 = await loadVideo();
   await test_driver.bless('request Picture-in-Picture');
   await video1.requestPictureInPicture();
--- a/testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
+++ b/testing/web-platform/tests/picture-in-picture/request-picture-in-picture.html
@@ -5,32 +5,32 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
 <script src="/resources/testdriver-vendor.js"></script>
 <script src="resources/picture-in-picture-helpers.js"></script>
 <body></body>
 <script>
 promise_test(async t => {
   const video = await loadVideo();
-  return promise_rejects(t, 'NotAllowedError', video.requestPictureInPicture());
+  return promise_rejects_dom(t, 'NotAllowedError', video.requestPictureInPicture());
 }, 'request Picture-in-Picture requires a user gesture');
 
 promise_test(t => {
   const video = document.createElement('video');
-  return promise_rejects(t, 'InvalidStateError',
+  return promise_rejects_dom(t, 'InvalidStateError',
       requestPictureInPictureWithTrustedClick(video));
 }, 'request Picture-in-Picture requires loaded metadata for the video element');
 
 promise_test(async t => {
   const video = document.createElement('video');
   await new Promise(resolve => {
     video.src = getAudioURI('/media/sound_5');
     video.onloadeddata = resolve;
   }).then(() => {
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       requestPictureInPictureWithTrustedClick(video));
   })
 }, 'request Picture-in-Picture requires video track for the video element');
 
 promise_test(async t => {
   const video = await loadVideo();
   return requestPictureInPictureWithTrustedClick(video);
 }, 'request Picture-in-Picture resolves on user click');
--- a/testing/web-platform/tests/portals/about-blank-cannot-host.html
+++ b/testing/web-platform/tests/portals/about-blank-cannot-host.html
@@ -6,12 +6,12 @@
 promise_test(async (t) => {
   let hostWindow = window.open();
   assert_equals(hostWindow.location.href, "about:blank");
 
   let portal = hostWindow.document.createElement("portal");
   portal.src = "resources/simple-portal.html";
   hostWindow.document.body.appendChild(portal);
 
-  await promise_rejects(t, "InvalidStateError", portal.activate());
+  await promise_rejects_dom(t, "InvalidStateError", portal.activate());
 }, "about:blank cannot host a portal");
 
 </script>
--- a/testing/web-platform/tests/portals/portal-activate-data.html
+++ b/testing/web-platform/tests/portals/portal-activate-data.html
@@ -65,17 +65,17 @@ promise_test(async () => {
   let ok = await openPortalAndActivate(
       'let port2 = event.data; port2.postMessage(42); return true;',
       {data: port2, transfer: [port2]});
   assert_true(ok);
   assert_equals((await replyViaPort).data, 42);
 }, "A message port can be passed through activate data.");
 
 promise_test(async t => {
-await promise_rejects(
+await promise_rejects_dom(
     t, 'DataCloneError',
     openPortalAndActivate('', {data: new SharedArrayBuffer}));
 }, "A SharedArrayBuffer cannot be passed through activate data.");
 
 promise_test(async t => {
   await promise_rejects(
       t, new Error,
       openPortalAndActivate('', {data: {get a() { throw new Error; }}}));
--- a/testing/web-platform/tests/portals/portals-activate-inside-iframe.html
+++ b/testing/web-platform/tests/portals/portals-activate-inside-iframe.html
@@ -7,12 +7,12 @@
       var iframe = document.createElement("iframe");
       iframe.src = "resources/portal-inside-iframe.html"
       var waitForLoad = new Promise((resolve, reject) => {
         iframe.onload = resolve;
       });
       document.body.appendChild(iframe);
       await waitForLoad;
       const portal = iframe.contentDocument.getElementById("portal");
-      return promise_rejects(t, "InvalidStateError", portal.activate());
+      return promise_rejects_dom(t, "InvalidStateError", portal.activate());
     }, "activating portal inside iframe should fail");
   </script>
 </body>
--- a/testing/web-platform/tests/portals/portals-activate-no-browsing-context.html
+++ b/testing/web-platform/tests/portals/portals-activate-no-browsing-context.html
@@ -1,9 +1,9 @@
 <!DOCTYPE html>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
 promise_test(async t => {
   let activatePromise = document.createElement('portal').activate();
-  await promise_rejects(t, 'InvalidStateError', activatePromise);
+  await promise_rejects_dom(t, 'InvalidStateError', activatePromise);
 }, "A portal with nothing in it cannot be activated");
 </script>
--- a/testing/web-platform/tests/portals/portals-post-message.sub.html
+++ b/testing/web-platform/tests/portals/portals-post-message.sub.html
@@ -152,23 +152,23 @@
 
       var {userActivation} = await postMessage(portal, "test", {includeUserActivation: true});
       assert_true(userActivation.isActive, "should have sent gesture");
       assert_true(userActivation.hasBeenActive);
     }, "postMessage with includeUserActivation");
 
     promise_test(async t => {
       var portal = document.createElement("portal");
-      return promise_rejects(t, "InvalidStateError",
+      return promise_rejects_dom(t, "InvalidStateError",
                              postMessage(portal, "test message"));
     }, "cannot call postMessage on portal without portal browsing context");
 
     promise_test(async t => {
       var portal = await createAndInsertPortal(sameOriginUrl);
-      return promise_rejects(t, "DataCloneError",
+      return promise_rejects_dom(t, "DataCloneError",
                              postMessage(portal, document.body));
     }, "postMessage should fail if message serialization fails");
 
     promise_test(async t => {
       var portal = await createAndInsertPortal(sameOriginUrl);
       return promise_rejects_js(t, TypeError,
                              postMessage(portal, "test", "*", [null]));
     }, "postMessage should fail with invalid ports");
--- a/testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_notfound_error-manual.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_notfound_error-manual.https.html
@@ -26,17 +26,17 @@
         connection1.onconnect = () => { connection1.terminate(); }
         if (connection1.state === 'closed')
           request1.reconnect(connection1.id);
         else
           connection1.terminate();
       }
     });
 
-    await promise_rejects(t, 'NotFoundError', request1.reconnect(wrongPresentationId),
+    await promise_rejects_dom(t, 'NotFoundError', request1.reconnect(wrongPresentationId),
       'Reconnecting with an unknown presentation ID fails with a NotFoundError exception.');
 
     setup({explicit_timeout: true});
     const clickWatcher = new EventWatcher(t, startBtn, 'click');
     await clickWatcher.wait_for('click');
     connection1 = await request1.start();
 
     t.step_timeout(() => {
@@ -45,17 +45,17 @@
     }, 5000);
 
     startBtn.disabled = true;
     eventWatcher1 = new EventWatcher(t, connection1, ['connect', 'close', 'terminate']);
     await eventWatcher1.wait_for('connect');
     connection1.close();
     await eventWatcher1.wait_for('close');
 
-    await promise_rejects(t, 'NotFoundError', request2.reconnect(connection1.id),
+    await promise_rejects_dom(t, 'NotFoundError', request2.reconnect(connection1.id),
       'Reconnecting with a presentation ID on a presentation request with a different URL fails with a NotFoundError exception.');
 
     await request1.reconnect(connection1.id);
     await eventWatcher1.wait_for('connect');
     connection1.terminate();
     await eventWatcher1.wait_for('terminate');
   });
 </script>
--- a/testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_success-manual.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/reconnectToPresentation_success-manual.https.html
@@ -173,13 +173,13 @@
             childFrame.contentWindow.postMessage('reconnect?id=' + presentationId, '*');
             return waitForMessage().then(parseResult);
         }).then(() => {
             // Wait until state of each presentation connection is set to "terminated"
             connection.terminate();
             return Promise.all([ eventWatcher.wait_for('terminate'), waitForMessage().then(parseResult) ]);
         }).then(() => {
             // Try to reconnect to the presentation, while all presentation connection have already been terminated
-            return promise_rejects(t, 'NotFoundError', request.reconnect(presentationId),
+            return promise_rejects_dom(t, 'NotFoundError', request.reconnect(presentationId),
                 'Reconnecting to a terminated presentation rejects a promise with a "NotFoundError" exception.');
         });
     });
 </script>
--- a/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotallowed-manual.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotallowed-manual.https.html
@@ -31,15 +31,15 @@
 
             // terminate the presentation connection when the presentation is started by accident
             var connection;
             t.add_cleanup(function() {
                 if(connection)
                     connection.terminate();
             });
 
-            return promise_rejects(t, 'NotAllowedError', request.start().then(function(c) { connection = c; }));
+            return promise_rejects_dom(t, 'NotAllowedError', request.start().then(function(c) { connection = c; }));
         });
     };
     // -----------------------------------------
     // Start New Presentation Test (error) - end
     // -----------------------------------------
 </script>
--- a/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotfound-manual.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_displaynotfound-manual.https.html
@@ -31,15 +31,15 @@
 
             // terminate the presentation connection when the presentation is started by accident
             var connection;
             t.add_cleanup(function() {
                 if(connection)
                     connection.terminate();
             });
 
-            return promise_rejects(t, 'NotFoundError', request.start().then(function(c) { connection = c; }));
+            return promise_rejects_dom(t, 'NotFoundError', request.start().then(function(c) { connection = c; }));
         });
     };
     // -----------------------------------------
     // Start New Presentation Test (error) - end
     // -----------------------------------------
 </script>
\ No newline at end of file
--- a/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_error.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_error.https.html
@@ -6,15 +6,15 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script>
     // -----------------------------------
     // Start New Presentation Test - begin
     // -----------------------------------
     promise_test(function (t) {
       var request = new PresentationRequest('presentation.html');
-      return promise_rejects(t, 'InvalidAccessError', request.start());
+      return promise_rejects_dom(t, 'InvalidAccessError', request.start());
     }, "The presentation could not start, because a user gesture is required.");
     // ----------------------------------
     // Launch New Presentation Test - end
     // ----------------------------------
 </script>
 
--- a/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_unsettledpromise-manual.https.html
+++ b/testing/web-platform/tests/presentation-api/controlling-ua/startNewPresentation_unsettledpromise-manual.https.html
@@ -30,15 +30,15 @@
     // Start New Presentation Test (error) - begin
     // -------------------------------------------
     presentBtn.onclick = function () {
         presentBtn.disabled = true;
         promise_test(function (t) {
             var request1 = new PresentationRequest(presentationUrls),
                 request2 = new PresentationRequest(presentationUrls);
             request1.start().then(terminate, function(){});
-            return promise_rejects(t, 'OperationError', request2.start().then(terminate));
+            return promise_rejects_dom(t, 'OperationError', request2.start().then(terminate));
         });
     };
     // -----------------------------------------
     // Start New Presentation Test (error) - end
     // -----------------------------------------
 </script>
\ No newline at end of file
--- a/testing/web-platform/tests/remote-playback/disable-remote-playback-prompt-throws.html
+++ b/testing/web-platform/tests/remote-playback/disable-remote-playback-prompt-throws.html
@@ -5,12 +5,12 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="/common/media.js"></script>
 <script>
 promise_test(t => {
   var v = document.createElement('video');
   v.src = getVideoURI('/media/movie_5');
   v.disableRemotePlayback = true;
 
-  return promise_rejects(t, 'InvalidStateError', v.remote.prompt());
+  return promise_rejects_dom(t, 'InvalidStateError', v.remote.prompt());
 }, 'Test that calling prompt() when disableRemotePlayback attribute is set throws an exception.');
 </script>
 </html>
--- a/testing/web-platform/tests/remote-playback/disable-remote-playback-watch-availability-throws.html
+++ b/testing/web-platform/tests/remote-playback/disable-remote-playback-watch-availability-throws.html
@@ -5,13 +5,13 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="/common/media.js"></script>
 <script>
 promise_test(t => {
   var v = document.createElement('video');
   v.src = getVideoURI('/media/movie_5');
   v.disableRemotePlayback = true;
 
-  return promise_rejects(t, 'InvalidStateError',
+  return promise_rejects_dom(t, 'InvalidStateError',
                          v.remote.watchAvailability(function() {}));
 }, 'Test that calling watchAvailability() when disableRemotePlayback attribute is set throws an exception.');
 </script>
 </html>
--- a/testing/web-platform/tests/screen-orientation/lock-unlock-check.html
+++ b/testing/web-platform/tests/screen-orientation/lock-unlock-check.html
@@ -19,12 +19,12 @@
     // This will reject, because the event will call lock() again.
     const pMustReject = screen.orientation.lock(newOrientation);
     // This one resolves, because we are re-locking.
     const pMustResolve = new Promise(r => {
       screen.orientation.onchange = () => {
         r(screen.orientation.lock("any"));
       };
     });
-    await promise_rejects(t, "AbortError", pMustReject);
+    await promise_rejects_dom(t, "AbortError", pMustReject);
     await pMustResolve;
   }, "Re-locking orientation during event dispatch must reject existing orientationPendingPromise");
 </script>
--- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-abort.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-abort.js
@@ -18,27 +18,27 @@ const methodsToTest = {
 for (const method in methodsToTest) {
   const perform = methodsToTest[method];
 
   cache_test(async (cache, test) => {
     const controller = new AbortController();
     const signal = controller.signal;
     controller.abort();
     const request = new Request('../resources/simple.txt', { signal });
-    return promise_rejects(test, 'AbortError', perform(cache, request),
+    return promise_rejects_dom(test, 'AbortError', perform(cache, request),
                           `${method} should reject`);
   }, `${method}() on an already-aborted request should reject with AbortError`);
 
   cache_test(async (cache, test) => {
     const controller = new AbortController();
     const signal = controller.signal;
     const request = new Request('../resources/simple.txt', { signal });
     const promise = perform(cache, request);
     controller.abort();
-    return promise_rejects(test, 'AbortError', promise,
+    return promise_rejects_dom(test, 'AbortError', promise,
                           `${method} should reject`);
   }, `${method}() synchronously followed by abort should reject with ` +
      `AbortError`);
 
   cache_test(async (cache, test) => {
     const controller = new AbortController();
     const signal = controller.signal;
     const stateKey = token();
@@ -64,17 +64,17 @@ for (const method in methodsToTest) {
 
     // Sadly the above loop cannot guarantee that the browser has started
     // processing the response body. This delay is needed to make the test
     // failures non-flaky in Chrome version 66. My deepest apologies.
     await new Promise(resolve => setTimeout(resolve, 250));
 
     controller.abort();
 
-    await promise_rejects(test, 'AbortError', promise,
+    await promise_rejects_dom(test, 'AbortError', promise,
                           `${method} should reject`);
 
     // infinite-slow-response.py doesn't know when to stop.
     return fetch(`../../../fetch/api/resources/stash-put.py?key=${abortKey}`);
   }, `${method}() followed by abort after headers received should reject ` +
      `with AbortError`);
 }
 
--- a/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js
+++ b/testing/web-platform/tests/service-workers/cache-storage/script-tests/cache-add.js
@@ -254,17 +254,17 @@ cache_test(function(cache, test) {
             matches,
             [undefined, undefined, undefined],
             'If any response fails, no response should be added to cache');
       });
   }, 'Cache.addAll with a mix of succeeding and failing requests');
 
 cache_test(function(cache, test) {
     var request = new Request('../resources/simple.txt');
-    return promise_rejects(
+    return promise_rejects_dom(
       test,
       'InvalidStateError',
       cache.addAll([request, request]),
       'Cache.addAll should throw InvalidStateError if the same request is added ' +
       'twice.');
   }, 'Cache.addAll called with the same Request object specified twice');
 
 cache_test(async function(cache, test) {
@@ -278,17 +278,17 @@ cache_test(async function(cache, test) {
   }, 'Cache.addAll should succeed when entries differ by vary header');
 
 cache_test(async function(cache, test) {
     const url = '../resources/vary.py?vary=x-shape';
     let requests = [
       new Request(url, { headers: { 'x-shape': 'circle' }}),
       new Request(url, { headers: { 'x-shape': 'circle' }}),
     ];
-    await promise_rejects(
+    await promise_rejects_dom(
       test,
       'InvalidStateError',
       cache.addAll(requests),
       'Cache.addAll() should reject when entries are duplicate by vary header');
   }, 'Cache.addAll should reject when entries are duplicate by vary header');
 
 // VARY header matching is asymmetric.  Determining if two entries are duplicate
 // depends on which entry's response is used in the comparison.  The target
@@ -324,25 +324,25 @@ cache_test(async function(cache, test) {
 
       // This request will result in a Response with a "Vary: x-size"
       // header.  This *will* result in a duplicate match with the other
       // entry.
       new Request(url, { headers: { 'x-shape': 'square',
                                     'x-size': 'big' },
                          credentials: 'omit' }),
     ];
-    await promise_rejects(
+    await promise_rejects_dom(
       test,
       'InvalidStateError',
       cache.addAll(requests),
       'Cache.addAll() should reject when one entry has a vary header ' +
       'matching an earlier entry.');
 
     // Test the reverse order now.
-    await promise_rejects(
+    await promise_rejects_dom(
       test,
       'InvalidStateError',
       cache.addAll(requests.reverse()),
       'Cache.addAll() should reject when one entry has a vary header ' +
       'matching a later entry.');
 
   }, 'Cache.addAll should reject when one entry has a vary header ' +
      'matching another entry');
--- a/testing/web-platform/tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/Service-Worker-Allowed-header.https.html
@@ -34,17 +34,17 @@ function register_test(script, scope, de
 // register_fail_test is like register_test but expects a SecurityError.
 function register_fail_test(script, scope, description) {
   promise_test(async t => {
     t.add_cleanup(() => {
       return service_worker_unregister(t, scope);
     });
 
     await service_worker_unregister(t, scope);
-    await promise_rejects(t,
+    await promise_rejects_dom(t,
                           'SecurityError',
                           navigator.serviceWorker.register(script, {scope}));
   }, description);
 }
 
 register_test(
     build_script_url('/allowed-path'),
     '/allowed-path',
--- a/testing/web-platform/tests/service-workers/service-worker/navigation-preload/get-state.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/navigation-preload/get-state.https.html
@@ -190,23 +190,23 @@ promise_test(t => {
   var registration;
   var np;
   return service_worker_unregister_and_register(t, script, scope)
     .then(r => {
         registration = r;
         np = registration.navigationPreload;
         add_completion_callback(() => registration.unregister());
         return Promise.all([
-            promise_rejects(
+            promise_rejects_dom(
                 t, 'InvalidStateError', np.enable(),
                 'enable should reject if there is no active worker'),
-            promise_rejects(
+            promise_rejects_dom(
                 t, 'InvalidStateError', np.disable(),
                 'disable should reject if there is no active worker'),
-            promise_rejects(
+            promise_rejects_dom(
                 t, 'InvalidStateError', np.setHeaderValue('umm'),
                 'setHeaderValue should reject if there is no active worker')]);
       })
     .then(() => np.getState())
     .then(state => {
         expect_navigation_preload_state(state, false, 'true',
                                         'state before activation');
         return post_and_wait_for_reply(registration.installing, 'ping');
--- a/testing/web-platform/tests/service-workers/service-worker/update.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/update.https.html
@@ -92,17 +92,17 @@ promise_test(async t => {
   assert_active_only(registration, expected_url);
 }, 'update() should succeed when new script is available.');
 
 promise_test(async t => {
   const [registration, expected_url] =
       await prepare_ready_registration_with_mode(t, 'bad_mime_type');
   t.add_cleanup(() => registration.unregister());
 
-  await promise_rejects(t, 'SecurityError', registration.update());
+  await promise_rejects_dom(t, 'SecurityError', registration.update());
   assert_active_only(registration, expected_url);
 }, 'update() should fail when mime type is invalid.');
 
 promise_test(async t => {
   const [registration, expected_url] =
       await prepare_ready_registration_with_mode(t, 'redirect');
   t.add_cleanup(() => registration.unregister());
 
--- a/testing/web-platform/tests/shape-detection/shapedetection-cross-origin.sub.https.html
+++ b/testing/web-platform/tests/shape-detection/shapedetection-cross-origin.sub.https.html
@@ -25,38 +25,38 @@ for (let crossOriginTest of crossOriginT
 
   // Verifies that Detector rejects a cross-origin HTMLImageElement.
   promise_test(async t => {
     const img = new Image();
     const imgWatcher = new EventWatcher(t, img, ["load", "error"]);
     img.src = IMAGE_URL;
     await imgWatcher.wait_for("load");
     const detector = crossOriginTest.createDetector();
-    promise_rejects(t, "SecurityError", detector.detect(img));
+    promise_rejects_dom(t, "SecurityError", detector.detect(img));
   }, crossOriginTest.detectorType
   + " should reject cross-origin HTMLImageElements with a SecurityError.");
 
   // Verifies that Detector rejects a cross-origin ImageBitmap.
   promise_test(async t => {
     const img = new Image();
     const imgWatcher = new EventWatcher(t, img, ["load", "error"]);
     img.src = IMAGE_URL;
     await imgWatcher.wait_for("load");
     const imgBitmap = await createImageBitmap(img);
     const detector = crossOriginTest.createDetector();
-    promise_rejects(t, "SecurityError", detector.detect(imgBitmap));
+    promise_rejects_dom(t, "SecurityError", detector.detect(imgBitmap));
   }, crossOriginTest.detectorType
   + " should reject cross-origin ImageBitmaps with a SecurityError.");
 
   // Verifies that Detector rejects a cross-origin HTMLVideoElement.
   promise_test(async t => {
     const video = document.createElement('video');
     const videoWatcher = new EventWatcher(t, video, ["loadeddata", "error"]);
     video.src = VIDEO_URL;
     await videoWatcher.wait_for("loadeddata");
     const detector = crossOriginTest.createDetector();
-    promise_rejects(t, "SecurityError", detector.detect(video));
+    promise_rejects_dom(t, "SecurityError", detector.detect(video));
   }, crossOriginTest.detectorType
   + " should reject cross-origin HTMLVideoElements with a SecurityError.");
 
 }
 
 </script>
\ No newline at end of file
--- a/testing/web-platform/tests/sms/interceptor.https.html
+++ b/testing/web-platform/tests/sms/interceptor.https.html
@@ -114,21 +114,21 @@ promise_test(async t => {
   }
 }, 'Deal with cancelled requests');
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
 
   controller.abort();
-  await promise_rejects(t, 'AbortError', navigator.sms.receive({signal}));
+  await promise_rejects_dom(t, 'AbortError', navigator.sms.receive({signal}));
 }, 'Should abort request');
 
 promise_test(async t => {
   const controller = new AbortController();
   const signal = controller.signal;
 
   let error = navigator.sms.receive({signal});
   controller.abort();
-  await promise_rejects(t, 'AbortError', error);
+  await promise_rejects_dom(t, 'AbortError', error);
 }, 'Should abort request even while request is in progress.');
 
 </script>
--- a/testing/web-platform/tests/streams/piping/abort.any.js
+++ b/testing/web-platform/tests/streams/piping/abort.any.js
@@ -34,20 +34,20 @@ for (const invalidSignal of [null, 'Abor
 }
 
 promise_test(t => {
   const rs = recordingReadableStream(errorOnPull, hwm0);
   const ws = new WritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject')
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject')
       .then(() => Promise.all([
         rs.getReader().closed,
-        promise_rejects(t, 'AbortError', ws.getWriter().closed, 'writer.closed should reject')
+        promise_rejects_dom(t, 'AbortError', ws.getWriter().closed, 'writer.closed should reject')
       ]))
       .then(() => {
         assert_equals(rs.events.length, 2, 'cancel should have been called');
         assert_equals(rs.events[0], 'cancel', 'first event should be cancel');
         assert_equals(rs.events[1].name, 'AbortError', 'the argument to cancel should be an AbortError');
         assert_equals(rs.events[1].constructor.name, 'DOMException',
                       'the argument to cancel should be a DOMException');
       });
@@ -78,40 +78,40 @@ promise_test(() => {
 }, 'all the AbortError objects should be the same object');
 
 promise_test(t => {
   const rs = recordingReadableStream(errorOnPull, hwm0);
   const ws = new WritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true }), 'pipeTo should reject')
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true }), 'pipeTo should reject')
       .then(() => assert_equals(rs.events.length, 0, 'cancel should not be called'));
 }, 'preventCancel should prevent canceling the readable');
 
 promise_test(t => {
   const rs = new ReadableStream(errorOnPull, hwm0);
   const ws = recordingWritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal, preventAbort: true }), 'pipeTo should reject')
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal, preventAbort: true }), 'pipeTo should reject')
       .then(() => {
         assert_equals(ws.events.length, 0, 'writable should not have been aborted');
         return ws.getWriter().ready;
       });
 }, 'preventAbort should prevent aborting the readable');
 
 promise_test(t => {
   const rs = recordingReadableStream(errorOnPull, hwm0);
   const ws = recordingWritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true, preventAbort: true }),
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true, preventAbort: true }),
                          'pipeTo should reject')
     .then(() => {
       assert_equals(rs.events.length, 0, 'cancel should not be called');
       assert_equals(ws.events.length, 0, 'writable should not have been aborted');
       return ws.getWriter().ready;
     });
 }, 'preventCancel and preventAbort should prevent canceling the readable and aborting the readable');
 
@@ -125,17 +125,17 @@ promise_test(t => {
   });
   const abortController = new AbortController();
   const signal = abortController.signal;
   const ws = recordingWritableStream({
     write() {
       abortController.abort();
     }
   });
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject')
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject')
       .then(() => {
         assert_equals(ws.events.length, 4, 'only chunk "a" should have been written');
         assert_array_equals(ws.events.slice(0, 3), ['write', 'a', 'abort'], 'events should match');
         assert_equals(ws.events[3].name, 'AbortError', 'abort reason should be an AbortError');
       });
 }, 'abort should prevent further reads');
 
 promise_test(t => {
@@ -158,17 +158,17 @@ promise_test(t => {
       return writePromise;
     }
   }, new CountQueuingStrategy({ highWaterMark: Infinity }));
   const pipeToPromise = rs.pipeTo(ws, { signal });
   return delay(0).then(() => {
     abortController.abort();
     readController.close(); // Make sure the test terminates when signal is not implemented.
     resolveWrite();
-    return promise_rejects(t, 'AbortError', pipeToPromise, 'pipeTo should reject');
+    return promise_rejects_dom(t, 'AbortError', pipeToPromise, 'pipeTo should reject');
   }).then(() => {
     assert_equals(ws.events.length, 6, 'chunks "a" and "b" should have been written');
     assert_array_equals(ws.events.slice(0, 5), ['write', 'a', 'write', 'b', 'abort'], 'events should match');
     assert_equals(ws.events[5].name, 'AbortError', 'abort reason should be an AbortError');
   });
 }, 'all pending writes should complete on abort');
 
 promise_test(t => {
@@ -229,46 +229,46 @@ promise_test(t => {
     start(controller) {
       controller.close();
     }
   });
   const ws = new WritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
 }, 'abort signal takes priority over closed readable');
 
 promise_test(t => {
   const rs = new ReadableStream({
     start(controller) {
       controller.error(error1);
     }
   });
   const ws = new WritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
 }, 'abort signal takes priority over errored readable');
 
 promise_test(t => {
   const rs = new ReadableStream({
     pull(controller) {
       controller.error('failed to abort');
     }
   }, hwm0);
   const ws = new WritableStream();
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
   const writer = ws.getWriter();
   return writer.close().then(() => {
     writer.releaseLock();
-    return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
+    return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
   });
 }, 'abort signal takes priority over closed writable');
 
 promise_test(t => {
   const rs = new ReadableStream({
     pull(controller) {
       controller.error('failed to abort');
     }
@@ -276,17 +276,17 @@ promise_test(t => {
   const ws = new WritableStream({
     start(controller) {
       controller.error(error1);
     }
   });
   const abortController = new AbortController();
   const signal = abortController.signal;
   abortController.abort();
-  return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
+  return promise_rejects_dom(t, 'AbortError', rs.pipeTo(ws, { signal }), 'pipeTo should reject');
 }, 'abort signal takes priority over errored writable');
 
 promise_test(() => {
   let readController;
   const rs = new ReadableStream({
     start(c) {
       readController = c;
     }
--- a/testing/web-platform/tests/wake-lock/wakelock-active-document.https.window.js
+++ b/testing/web-platform/tests/wake-lock/wakelock-active-document.https.window.js
@@ -22,17 +22,17 @@ promise_test(async t => {
   );
   // We navigate the iframe again, putting wakeLock1's document into an inactive state.
   const wakeLock2 = await getWakeLockObject(
     iframe,
     "/wake-lock/resources/page2.html"
   );
   // Now, wakeLock1's relevant global object's document is no longer active.
   // So, call .request(), and make sure it rejects appropriately.
-  await promise_rejects(
+  await promise_rejects_dom(
     t,
     "NotAllowedError",
     wakeLock1.request('screen'),
     "Inactive document, so must throw NotAllowedError"
   );
   // We are done, so clean up.
   iframe.remove();
 }, "navigator.wakeLock.request() aborts if the document is not active.");
@@ -65,17 +65,17 @@ promise_test(async t => {
     outerIframe.addEventListener("load", resolve);
     outerIframe.src = "/wake-lock/resources/page2.html";
   });
 
   // Now, request's relevant global object's document is still active
   // (it is the active document of the inner iframe), but is not fully active
   // (since the parent of the inner iframe is itself no longer active).
   // So, call request.show() and make sure it rejects appropriately.
-  await promise_rejects(
+  await promise_rejects_dom(
     t,
     "NotAllowedError",
     wakeLock.request('screen'),
     "Active, but not fully active, so must throw NotAllowedError"
   );
   // We are done, so clean up.
   outerIframe.remove();
 }, "navigator.wakeLock.request() aborts if the document is active, but not fully active.");
--- a/testing/web-platform/tests/wake-lock/wakelock-disabled-by-feature-policy.https.sub.html
+++ b/testing/web-platform/tests/wake-lock/wakelock-disabled-by-feature-policy.https.sub.html
@@ -7,17 +7,17 @@
   "use strict";
 
   const same_origin_src =
     "/feature-policy/resources/feature-policy-wakelock.html";
   const cross_origin_src =
     "https://{{domains[www]}}:{{ports[https][0]}}" + same_origin_src;
 
   promise_test(t => {
-    return promise_rejects(t, "NotAllowedError", navigator.wakeLock.request("screen"));
+    return promise_rejects_dom(t, "NotAllowedError", navigator.wakeLock.request("screen"));
   }, 'Feature-Policy header {"wake-lock" : []} disallows the top-level document.');
 
   async_test(t => {
     test_feature_availability(
       'navigator.wakeLock.request("screen")',
       t,
       same_origin_src,
       expect_feature_unavailable_default
--- a/testing/web-platform/tests/wake-lock/wakelock-document-hidden-manual.https.html
+++ b/testing/web-platform/tests/wake-lock/wakelock-document-hidden-manual.https.html
@@ -11,17 +11,17 @@ promise_test(async t => {
   const screenWakeLock = await navigator.wakeLock.request('screen');
   const screenWakeLockReleased =
       new EventWatcher(t, screenWakeLock, "release").wait_for("release");
 
   const eventWatcher = new EventWatcher(t, document, "visibilitychange");
   await eventWatcher.wait_for("visibilitychange");
   assert_true(document.hidden, "document is hidden after the visibilitychange event");
   await screenWakeLockReleased;
-  await promise_rejects(t, "NotAllowedError", navigator.wakeLock.request('screen'),
+  await promise_rejects_dom(t, "NotAllowedError", navigator.wakeLock.request('screen'),
       "new screen locks are not allowed when the page is not visible");
 
   await eventWatcher.wait_for("visibilitychange");
   assert_false(document.hidden, "document is no longer hidden after the visibilitychange event");
 }, "Test screen locks respect page visibility changes");
 
 </script>
 
--- a/testing/web-platform/tests/wake-lock/wakelock-screen-type-on-worker.https.worker.js
+++ b/testing/web-platform/tests/wake-lock/wakelock-screen-type-on-worker.https.worker.js
@@ -1,8 +1,8 @@
 //META: title=Screen wake lock should not be allowed in dedicated worker
 importScripts("/resources/testharness.js");
 
 promise_test(t => {
-  return promise_rejects(t, "NotAllowedError", navigator.wakeLock.request('screen'));
+  return promise_rejects_dom(t, "NotAllowedError", navigator.wakeLock.request('screen'));
 }, "Screen wake lock should not be allowed in dedicated worker");
 
 done();
--- a/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
@@ -44,34 +44,34 @@ promise_test(async t => {
   // Make it pause-pending
   animation.pause();
 
   // We need to store the original ready promise since cancel() will
   // replace it
   const originalPromise = animation.ready;
   animation.cancel();
 
-  await promise_rejects(t, 'AbortError', originalPromise,
+  await promise_rejects_dom(t, 'AbortError', originalPromise,
                         'Cancel should abort ready promise');
 }, 'A pause-pending ready promise should be rejected when the animation is'
    + ' canceled');
 
 promise_test(async t => {
   const animation = createDiv(t).animate(null);
   animation.cancel();
   const promiseResult = await animation.ready;
   assert_equals(promiseResult, animation);
 }, 'When an animation is canceled, it should create a resolved Promise');
 
 test(t => {
   const animation = createDiv(t).animate(null);
   const promise = animation.ready;
   animation.cancel();
   assert_not_equals(animation.ready, promise);
-  promise_rejects(t, 'AbortError', promise, 'Cancel should abort ready promise');
+  promise_rejects_dom(t, 'AbortError', promise, 'Cancel should abort ready promise');
 }, 'The ready promise should be replaced when the animation is canceled');
 
 promise_test(t => {
   const animation = new Animation(
     new KeyframeEffect(null, null, { duration: 1000 }),
     null
   );
   assert_equals(animation.playState, 'idle',
--- a/testing/web-platform/tests/web-locks/acquire.tentative.https.any.js
+++ b/testing/web-platform/tests/web-locks/acquire.tentative.https.any.js
@@ -23,46 +23,46 @@ promise_test(async t => {
                 'mode is exclusive');
   assert_equals(await navigator.locks.request(
     res, {mode: 'shared'}, lock => lock.mode), 'shared',
                 'mode is shared');
 }, 'mode must be "shared" or "exclusive"');
 
 promise_test(async t => {
   const res = uniqueName(t);
-  await promise_rejects(
+  await promise_rejects_dom(
     t, 'NotSupportedError',
     navigator.locks.request(
       res, {steal: true, ifAvailable: true}, lock => {}),
     "A NotSupportedError should be thrown if both " +
     "'steal' and 'ifAvailable' are specified.");
 }, "The 'steal' and 'ifAvailable' options are mutually exclusive");
 
 promise_test(async t => {
   const res = uniqueName(t);
-  await promise_rejects(
+  await promise_rejects_dom(
     t, 'NotSupportedError',
     navigator.locks.request(res, {mode: 'shared', steal: true}, lock => {}),
     'Request with mode=shared and steal=true should fail');
 }, "The 'steal' option must be used with exclusive locks");
 
 promise_test(async t => {
   const res = uniqueName(t);
   const controller = new AbortController();
-  await promise_rejects(
+  await promise_rejects_dom(
     t, 'NotSupportedError',
     navigator.locks.request(
       res, {signal: controller.signal, steal: true}, lock => {}),
     'Request with signal and steal=true should fail');
 }, "The 'signal' and 'steal' options are mutually exclusive");
 
 promise_test(async t => {
   const res = uniqueName(t);
   const controller = new AbortController();
-  await promise_rejects(
+  await promise_rejects_dom(
     t, 'NotSupportedError',
     navigator.locks.request(
       res, {signal: controller.signal, ifAvailable: true}, lock => {}),
     'Request with signal and ifAvailable=true should fail');
 }, "The 'signal' and 'ifAvailable' options are mutually exclusive");
 
 promise_test(async t => {
   const res = uniqueName(t);
--- a/testing/web-platform/tests/web-locks/resource-names.tentative.https.any.js
+++ b/testing/web-platform/tests/web-locks/resource-names.tentative.https.any.js
@@ -38,17 +38,17 @@ promise_test(async t => {
     });
 
     // If we did not time out, this passed.
   });
 }, 'Resource names that are not valid UTF-16 are not mangled');
 
 promise_test(async t => {
   for (const name of ['-', '-foo']) {
-    await promise_rejects(
+    await promise_rejects_dom(
       t, 'NotSupportedError',
       navigator.locks.request(name, lock => {}),
       'Names starting with "-" should be rejected');
   }
   let got_lock = false;
   await navigator.locks.request('x-anything', lock => {
     got_lock = true;
   });
--- a/testing/web-platform/tests/web-locks/signal.tentative.https.any.js
+++ b/testing/web-platform/tests/web-locks/signal.tentative.https.any.js
@@ -23,17 +23,17 @@ promise_test(async t => {
   }
 }, 'The signal option must be an AbortSignal');
 
 promise_test(async t => {
   const res = uniqueName(t);
   const controller = new AbortController();
   controller.abort();
 
-  await promise_rejects(
+  await promise_rejects_dom(
     t, 'AbortError',
     navigator.locks.request(res, {signal: controller.signal},
                             t.unreached_func('callback should not run')),
     'Request should reject with AbortError');
 }, 'Passing an already aborted signal aborts');
 
 promise_test(async t => {
   const res = uniqueName(t);
@@ -50,17 +50,17 @@ promise_test(async t => {
 
   // Verify the request is enqueued:
   const state = await navigator.locks.query();
   assert_equals(state.held.filter(lock => lock.name === res).length, 1,
                 'Number of held locks');
   assert_equals(state.pending.filter(lock => lock.name === res).length, 1,
                 'Number of pending locks');
 
-  const rejected = promise_rejects(
+  const rejected = promise_rejects_dom(
     t, 'AbortError', promise, 'Request should reject with AbortError');
 
   controller.abort();
 
   await rejected;
 
 }, 'An aborted request results in AbortError');
 
@@ -78,17 +78,17 @@ promise_test(async t => {
 
   // Verify the request is enqueued:
   const state = await navigator.locks.query();
   assert_equals(state.held.filter(lock => lock.name === res).length, 1,
                 'Number of held locks');
   assert_equals(state.pending.filter(lock => lock.name === res).length, 1,
                 'Number of pending locks');
 
-  const rejected = promise_rejects(
+  const rejected = promise_rejects_dom(
     t, 'AbortError', promise, 'Request should reject with AbortError');
 
   let callback_called = false;
   t.step_timeout(() => {
     callback_called = true;
     controller.abort();
   }, 10);
 
@@ -117,17 +117,17 @@ promise_test(async t => {
 
   let got_lock = false;
   const p = navigator.locks.request(
     res, {signal: controller.signal}, lock => { got_lock = true; });
 
   // Even though lock is grantable, this abort should be processed synchronously.
   controller.abort();
 
-  await promise_rejects(t, 'AbortError', p, 'Request should abort');
+  await promise_rejects_dom(t, 'AbortError', p, 'Request should abort');
 
   assert_false(got_lock, 'Request should be aborted if signal is synchronous');
 
   await navigator.locks.request(res, lock => { got_lock = true; });
   assert_true(got_lock, 'Subsequent request should not be blocked');
 
 }, 'Synchronously signaled abort');
 
--- a/testing/web-platform/tests/web-locks/steal.tentative.https.any.js
+++ b/testing/web-platform/tests/web-locks/steal.tentative.https.any.js
@@ -32,17 +32,17 @@ promise_test(async t => {
   assert_true(callback_called, 'Callback should be called');
 }, 'Lock not available');
 
 promise_test(async t => {
   const res = uniqueName(t);
 
   // Grab and hold the lock.
   const promise = navigator.locks.request(res, lock => never_settled);
-  const assertion = promise_rejects(
+  const assertion = promise_rejects_dom(
     t, 'AbortError', promise, `Initial request's promise should reject`);
 
   // Steal it.
   await navigator.locks.request(res, {steal: true}, lock => {});
 
   await assertion;
 
 }, `Broken lock's release promise rejects`);
--- a/testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html
+++ b/testing/web-platform/tests/web-nfc/NDEFReader_scan.https.html
@@ -17,17 +17,17 @@ const invalid_signals = [
   true,
   Symbol(),
   () => {},
   self
 ];
 
 function waitSyntaxErrorPromise(t, scan_options) {
   const reader = new NDEFReader();
-  return promise_rejects(t, 'SyntaxError', reader.scan(scan_options));
+  return promise_rejects_dom(t, 'SyntaxError', reader.scan(scan_options));
 }
 
 promise_test(async t => {
   const reader = new NDEFReader();
   const promises = [];
   invalid_signals.forEach(invalid_signal => {
     promises.push(promise_rejects_js(t, TypeError,
         reader.scan({ signal: invalid_signal })));
@@ -37,46 +37,46 @@ promise_test(async t => {
 
 promise_test(async t => {
   if (window.testRunner) {
     // Deny nfc permissions for Chromium testrunner.
     window.testRunner.setPermission('nfc', 'denied',
                                     location.origin, location.origin);
   }
   const reader = new NDEFReader();
-  await promise_rejects(t, 'NotAllowedError', reader.scan());
+  await promise_rejects_dom(t, 'NotAllowedError', reader.scan());
 }, "NDEFReader.scan should fail if user permission is not granted.");
 
 // We do not provide NFC mock here to simulate that there has no available
 // implementation for NFC Mojo interface.
 promise_test(async t => {
   if (window.testRunner) {
     window.testRunner.setPermission('nfc', 'granted',
                                     location.origin, location.origin);
   }
   const reader = new NDEFReader();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   const promise = readerWatcher.wait_for("error").then(event => {
     assert_true(event instanceof ErrorEvent);
   });
-  await promise_rejects(t, 'NotSupportedError', reader.scan());
+  await promise_rejects_dom(t, 'NotSupportedError', reader.scan());
   await promise;
 }, "Test that an error event happens if no implementation for NFC Mojo interface \
 is available.");
 
 nfc_test(async (t, mockNFC) => {
   mockNFC.setHWStatus(NFCHWStatus.DISABLED);
   const reader = new NDEFReader();
-  await promise_rejects(t, 'NotReadableError', reader.scan());
+  await promise_rejects_dom(t, 'NotReadableError', reader.scan());
 }, "NDEFReader.scan should fail if NFC HW is disabled.");
 
 nfc_test(async (t, mockNFC) => {
   mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
   const reader = new NDEFReader();
-  await promise_rejects(t, 'NotSupportedError', reader.scan());
+  await promise_rejects_dom(t, 'NotSupportedError', reader.scan());
 }, "NDEFReader.scan should fail if NFC HW is not supported.");
 
 nfc_test(async (t, mockNFC) => {
   const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   const promise = readerWatcher.wait_for("reading").then(event => {
     assert_true(event instanceof NDEFReadingEvent);
@@ -101,25 +101,25 @@ nfc_test(async (t, mockNFC) => {
   mockNFC.setReadingMessage(createMessage([createTextRecord(test_text_data)]));
   await promise;
 }, "Test that NDEFReader.scan matches any ids if NDEFScanOptions.id is undefined.");
 
 nfc_test(async (t, mockNFC) => {
   const reader = new NDEFReader();
   const controller = new AbortController();
   controller.abort();
-  await promise_rejects(t, 'AbortError', reader.scan({signal: controller.signal}));
+  await promise_rejects_dom(t, 'AbortError', reader.scan({signal: controller.signal}));
 }, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal is already aborted.");
 
 nfc_test(async (t, mockNFC) => {
   const reader = new NDEFReader();
   const controller = new AbortController();
   const promise = reader.scan({signal: controller.signal});
   controller.abort();
-  await promise_rejects(t, 'AbortError', promise);
+  await promise_rejects_dom(t, 'AbortError', promise);
 }, "Test that NDEFReader.scan rejects if NDEFScanOptions.signal aborts right after \
 the scan invocation.");
 
 nfc_test(async (t, mockNFC) => {
   const reader = new NDEFReader();
   const controller = new AbortController();
   const readerWatcher = new EventWatcher(t, reader, ["reading", "error"]);
   const message = createMessage([createTextRecord(test_text_data)]);
--- a/testing/web-platform/tests/web-nfc/NDEFWriter_write.https.html
+++ b/testing/web-platform/tests/web-nfc/NDEFWriter_write.https.html
@@ -123,52 +123,52 @@ promise_test(async t => {
   await Promise.all(promises);
 }, "Test that promise is rejected with TypeError if NDEFMessageSource is invalid.");
 
 promise_test(async t => {
   const writer = new NDEFWriter();
   const promises = [];
   invalid_syntax_messages.forEach(message => {
     promises.push(
-      promise_rejects(t, 'SyntaxError', writer.write(message)));
+      promise_rejects_dom(t, 'SyntaxError', writer.write(message)));
   });
   await Promise.all(promises);
 }, "Test that promise is rejected with SyntaxError if NDEFMessageSource contains\
  invalid records.");
 
 promise_test(async t => {
   if (window.testRunner) {
     // Deny nfc permissions for Chromium testrunner.
     window.testRunner.setPermission('nfc', 'denied',
                                     location.origin, location.origin);
   }
   const writer = new NDEFWriter();
-  await promise_rejects(t, 'NotAllowedError', writer.write(test_text_data));
+  await promise_rejects_dom(t, 'NotAllowedError', writer.write(test_text_data));
 }, 'NDEFWriter.write should fail if user permission is not granted.');
 
 // We do not provide NFC mock here to simulate that there has no available
 // implementation for NFC Mojo interface.
 promise_test(async t => {
   if (window.testRunner) {
     // Deny nfc permissions for Chromium testrunner.
     window.testRunner.setPermission('nfc', 'granted',
                                     location.origin, location.origin);
   }
   const writer = new NDEFWriter();
-  await promise_rejects(t, 'NotSupportedError', writer.write(test_text_data));
+  await promise_rejects_dom(t, 'NotSupportedError', writer.write(test_text_data));
 }, 'NDEFWriter.write should fail if no implementation for NFC Mojo interface is available.');
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   const controller = new AbortController();
 
   //Make sure push is pending
   mockNFC.setPendingPushCompleted(false);
   const p = writer.write(test_text_data, { signal: controller.signal });
-  const rejected = promise_rejects(t, 'AbortError', p);
+  const rejected = promise_rejects_dom(t, 'AbortError', p);
   let callback_called = false;
   await new Promise(resolve => {
     t.step_timeout(() => {
       callback_called = true;
       controller.abort();
       resolve();
     }, 10);
   });
@@ -177,17 +177,17 @@ nfc_test(async (t, mockNFC) => {
 }, "NDEFWriter.write should fail if abort write request before write happends.");
 
 promise_test(async t => {
   const writer = new NDEFWriter();
   const controller = new AbortController();
   assert_false(controller.signal.aborted);
   controller.abort();
   assert_true(controller.signal.aborted);
-  await promise_rejects(t, 'AbortError',
+  await promise_rejects_dom(t, 'AbortError',
       writer.write(test_text_data, { signal: controller.signal }));
 }, "NDEFWriter.write should fail if signal's aborted flag is set.");
 
 promise_test(async t => {
   const writer = new NDEFWriter();
   const promises = [];
   invalid_signals.forEach(invalid_signal => {
     promises.push(promise_rejects_js(t, TypeError,
@@ -200,32 +200,32 @@ nfc_test(async (t, mockNFC) => {
   const writer1 = new NDEFWriter();
   const writer2 = new NDEFWriter();
   const controller = new AbortController();
   const p1 = writer1.write(test_text_data, { signal: controller.signal });
 
   // Even though write request is grantable,
   // this abort should be processed synchronously.
   controller.abort();
-  await promise_rejects(t, 'AbortError', p1);
+  await promise_rejects_dom(t, 'AbortError', p1);
 
   await writer2.write(test_text_data);
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
 }, "Synchronously signaled abort.");
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   mockNFC.setHWStatus(NFCHWStatus.DISABLED);
-  await promise_rejects(t, 'NotReadableError', writer.write(test_text_data));
+  await promise_rejects_dom(t, 'NotReadableError', writer.write(test_text_data));
 }, "NDEFWriter.write should fail when NFC HW is disabled.");
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   mockNFC.setHWStatus(NFCHWStatus.NOT_SUPPORTED);
-  await promise_rejects(t, 'NotSupportedError', writer.write(test_text_data));
+  await promise_rejects_dom(t, 'NotSupportedError', writer.write(test_text_data));
 }, "NDEFWriter.write should fail when NFC HW is not supported.");
 
 promise_test(async () => {
   await new Promise((resolve,reject) => {
     const iframe = document.createElement('iframe');
     iframe.srcdoc = `<script>
                       if (window.testRunner) {
                         // Grant nfc permissions for Chromium testrunner.
@@ -431,17 +431,17 @@ nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   const promise = writer.write(test_text_data);
 
   // Just to make sure the write() request has already reached to the mock.
   const reader = new NDEFReader();
   await reader.scan();
 
   mockNFC.simulateNonNDEFTagDiscovered();
-  await promise_rejects(t, 'NotSupportedError', promise);
+  await promise_rejects_dom(t, 'NotSupportedError', promise);
 }, "NDEFWriter.write should fail when the NFC device coming up does not expose \
 NDEF technology.");
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   await writer.write(test_text_data, { overwrite: false });
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
 }, "NDEFWriter.write should succeed to write data to an unformatted NFC device \
@@ -455,19 +455,19 @@ nfc_test(async (t, mockNFC) => {
   assertNDEFMessagesEqual(test_text_data, mockNFC.pushedMessage());
 }, "NDEFWriter.write should succeed to overwrite the existing data \
 when the NDEFWriteOptions.overwrite is true.");
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   const p = writer.write(test_text_data, { overwrite: false });
   mockNFC.setIsFormattedTag(true);
-  await promise_rejects(t, 'NotAllowedError', p);
+  await promise_rejects_dom(t, 'NotAllowedError', p);
 }, "NDEFWriter.write should fail when there are NDEF records on the NFC device \
 and NDEFWriteOptions.overwrite is false.");
 
 nfc_test(async (t, mockNFC) => {
   const writer = new NDEFWriter();
   mockNFC.simulateDataTransferFails();
-  await promise_rejects(t, 'NetworkError', writer.write(test_text_data));
+  await promise_rejects_dom(t, 'NetworkError', writer.write(test_text_data));
 }, "NDEFWriter.write should fail with NetworkError when NFC data transfer fails.");
 
 </script>
--- a/testing/web-platform/tests/web-share/share-cancel-manual.https.html
+++ b/testing/web-platform/tests/web-share/share-cancel-manual.https.html
@@ -9,16 +9,16 @@
   </head>
   <body>
     <script>
         setup({explicit_timeout: true});
 
         setupManualShareTestRequiringCancellation();
 
         promise_test(t => {
-          return callWhenButtonClicked(() => promise_rejects(
+          return callWhenButtonClicked(() => promise_rejects_dom(
               t, 'AbortError',
               navigator.share({title: 'the title', text: 'the message',
                                url: 'https://example.com'})));
         }, 'share with user cancellation');
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/web-share/share-sharePromise-internal-slot.https.html
+++ b/testing/web-platform/tests/web-share/share-sharePromise-internal-slot.https.html
@@ -24,15 +24,15 @@
               navigator.share({ title: "should also reject" })
             );
             r(promises);
           };
         });
         test_driver.click(button);
         const [, promise2, promise3] = await p;
         await Promise.all([
-          promise_rejects(t, "InvalidStateError", promise2),
-          promise_rejects(t, "InvalidStateError", promise3)
+          promise_rejects_dom(t, "InvalidStateError", promise2),
+          promise_rejects_dom(t, "InvalidStateError", promise3)
         ]);
       }, "Only allow one share call at a time, which is controlled by the [[sharePromise]] internal slot.");
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/web-share/share-without-user-gesture.https.html
+++ b/testing/web-platform/tests/web-share/share-without-user-gesture.https.html
@@ -4,16 +4,16 @@
     <meta charset="utf-8">
     <title>WebShare Test: Share without user gesture error</title>
     <script src="/resources/testharness.js"></script>
     <script src="/resources/testharnessreport.js"></script>
   </head>
   <body>
     <script>
         promise_test(t => {
-          return promise_rejects(
+          return promise_rejects_dom(
               t, 'NotAllowedError',
               navigator.share({title: 'the title', text: 'the message',
                                url: 'https://example.com'}));
         }, 'share without a user gesture');
     </script>
   </body>
 </html>
--- a/testing/web-platform/tests/webrtc-identity/RTCPeerConnection-getIdentityAssertion.sub.https.html
+++ b/testing/web-platform/tests/webrtc-identity/RTCPeerConnection-getIdentityAssertion.sub.https.html
@@ -197,17 +197,17 @@
 
     // Ask mock-idp.js to return an invalid result that is not proper
     // RTCIdentityAssertionResult
     pc.setIdentityProvider(hostString(idpDomain, port), {
       protocol: `mock-idp.js?generatorAction=return-invalid-result`,
       usernameHint: `alice@${idpDomain}`,
     });
 
-    return promise_rejects(t, 'OperationError',
+    return promise_rejects_dom(t, 'OperationError',
       pc.getIdentityAssertion());
   }, `getIdentityAssertion() should reject with OperationError if mock-idp.js return invalid result`);
 
   /*
     9.5.  IdP Error Handling
       - A RTCPeerConnection might be configured with an identity provider, but loading of
         the IdP URI fails. Any procedure that attempts to invoke such an identity provider
         and cannot load the URI fails with an RTCError with errorDetail set to
@@ -366,17 +366,17 @@
     const port = window.location.port;
     const [idpDomain] = getIdpDomains();
 
     pc.setIdentityProvider(hostString(idpDomain, port), {
       protocol: 'mock-idp.js?generatorAction=throw-error',
       usernameHint: `alice@${idpDomain}`
     });
 
-    return promise_rejects(t, 'OperationError',
+    return promise_rejects_dom(t, 'OperationError',
       pc.createOffer());
   }, 'createOffer() should reject with OperationError if identity assertion request fails');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     const port = window.location.port;
     const [idpDomain] = getIdpDomains();
 
@@ -384,14 +384,14 @@
       protocol: 'mock-idp.js?generatorAction=throw-error',
       usernameHint: `alice@${idpDomain}`
     });
 
     return new RTCPeerConnection()
     .createOffer()
     .then(offer => pc.setRemoteDescription(offer))
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.createAnswer()));
 
   }, 'createAnswer() should reject with OperationError if identity assertion request fails');
 
 </script>
--- a/testing/web-platform/tests/webrtc-identity/RTCPeerConnection-peerIdentity.https.html
+++ b/testing/web-platform/tests/webrtc-identity/RTCPeerConnection-peerIdentity.https.html
@@ -98,19 +98,19 @@
 
     pc2.setIdentityProvider(idpHost, {
       protocol: 'mock-idp.js',
       usernameHint: `alice@${idpDomain}`
     });
 
     const offer = await pc1.createOffer();
 
-    await promise_rejects(t, 'OperationError',
+    await promise_rejects_dom(t, 'OperationError',
       pc2.setRemoteDescription(offer));
-    await promise_rejects(t, 'OperationError',
+    await promise_rejects_dom(t, 'OperationError',
       pc2.peerIdentity);
   }, 'setRemoteDescription() on offer with a=identity that resolve to value different from target peer identity should reject with OperationError');
 
   /*
     9.4.  Verifying Identity Assertions
       8.  The RTCPeerConnection decodes the contents and validates that it contains a
           fingerprint value for every a=fingerprint attribute in the session description.
           This ensures that the certificate used by the remote peer for communications
@@ -141,19 +141,19 @@
       protocol: 'mock-idp.js?validatorAction=return-custom-contents&contents=bogus',
       usernameHint: `alice@${idpDomain}`
     });
 
     const peerIdentityPromise = pc2.peerIdentity;
 
     return pc1.createOffer()
     .then(offer => Promise.all([
-      promise_rejects(t, 'IdpError',
+      promise_rejects_dom(t, 'IdpError',
         pc2.setRemoteDescription(offer)),
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         peerIdentityPromise)
     ]));
   }, 'setRemoteDescription() with peerIdentity set and with IdP proxy that return validationAssertion with mismatch contents should reject with OperationError');
 
   /*
     9.4.  Verifying Identity Assertions
       9.  The RTCPeerConnection validates that the domain portion of the identity matches
           the domain of the IdP as described in [RTCWEB-SECURITY-ARCH]. If this check
@@ -190,19 +190,19 @@
         'Sanity check domain of assertion is host1');
 
       assert_equals(assertion.args.options.usernameHint, `alice@${idpDomain2}`,
         'Sanity check domain1 is going to validate a domain2 identity');
 
       return pc1.createOffer();
     })
     .then(offer => Promise.all([
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc2.setRemoteDescription(offer)),
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc2.peerIdentity)
     ]));
   }, 'setRemoteDescription() and peerIdentity should reject with OperationError if IdP return validated identity that is different from its own domain');
 
   /*
     9.4 Verifying Identity Assertions
       If identity validation fails and there is a target peer identity for the
       RTCPeerConnection, the promise returned by setRemoteDescription MUST be rejected
--- a/testing/web-platform/tests/webrtc-quic/RTCQuicStream.https.html
+++ b/testing/web-platform/tests/webrtc-quic/RTCQuicStream.https.html
@@ -398,71 +398,71 @@ promise_test(async t => {
   const localStream = localQuicTransport.createStream();
   localStream.write({
     data: new Uint8Array(localStream.maxWriteBufferedAmount)
   });
   const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
   const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
   localStream.write({ finish: true });
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
     'write() with finish.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write({
     data: new Uint8Array(localStream.maxWriteBufferedAmount)
   });
   localStream.write({ finish: true });
   const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
   const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'waitForWriteBufferedAmountBelow() promises immediately rejected after ' +
     'wrote finish.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write({
     data: new Uint8Array(localStream.maxWriteBufferedAmount)
   });
   const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
   const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
   localStream.reset();
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
     'reset().');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write({
     data: new Uint8Array(localStream.maxWriteBufferedAmount)
   });
   const promise1 = localStream.waitForWriteBufferedAmountBelow(0);
   const promise2 = localStream.waitForWriteBufferedAmountBelow(0);
   localQuicTransport.stop();
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForWriteBufferedAmountBelow() promises rejected after ' +
     'RTCQuicTransport stop().');
 
 closed_stream_test(async (t, stream) => {
-  await promise_rejects(t, 'InvalidStateError',
+  await promise_rejects_dom(t, 'InvalidStateError',
       stream.waitForWriteBufferedAmountBelow(0));
 }, 'waitForWriteBufferedBelow() rejects with InvalidStateError.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   assert_object_equals(
@@ -572,75 +572,75 @@ promise_test(async t => {
   await remoteStream.waitForReadable(remoteStream.maxReadBufferedAmount);
   assert_object_equals(
       remoteStream.readInto(new Uint8Array(10)),
       { amount: 0, finished: true } );
 
   const promise1 = remoteStream.waitForReadable(10);
   const promise2 = remoteStream.waitForReadable(10);
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'waitForReadable() promises immediately rejected with InvalidStateError ' +
     'after finish is read out.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   const promise1 = localStream.waitForReadable(10);
   const promise2 = localStream.waitForReadable(10);
   localStream.reset();
   await Promise.all([
-promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForReadable() promises rejected after reset().');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write({ data: new Uint8Array(1) });
   const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
   const { stream : remoteStream} = await remoteWatcher.wait_for('quicstream');
   const promise1 = remoteStream.waitForReadable(10);
   const promise2 = remoteStream.waitForReadable(10);
   localStream.reset();
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForReadable() promises rejected after remote reset().');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   const promise1 = localStream.waitForReadable(10);
   const promise2 = localStream.waitForReadable(10);
   localQuicTransport.stop();
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForReadable() promises rejected after RTCQuicTransport ' +
    'stop().');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const localStream = localQuicTransport.createStream();
   localStream.write({ data: new Uint8Array(1) });
   const remoteWatcher = new EventWatcher(t, remoteQuicTransport, 'quicstream');
   const { stream : remoteStream} = await remoteWatcher.wait_for('quicstream');
   const promise1 = remoteStream.waitForReadable(10);
   const promise2 = remoteStream.waitForReadable(10);
   localQuicTransport.stop();
   await Promise.all([
-      promise_rejects(t, 'InvalidStateError', promise1),
-      promise_rejects(t, 'InvalidStateError', promise2)]);
+      promise_rejects_dom(t, 'InvalidStateError', promise1),
+      promise_rejects_dom(t, 'InvalidStateError', promise2)]);
 }, 'Pending waitForReadable() promises rejected after remote RTCQuicTransport ' +
     'stop().');
 
 closed_stream_test(async (t, stream) => {
-  await promise_rejects(t, 'InvalidStateError',
+  await promise_rejects_dom(t, 'InvalidStateError',
       stream.waitForReadable(1));
 }, 'waitForReadable() rejects with InvalidStateError.');
 
 </script>
--- a/testing/web-platform/tests/webrtc-quic/RTCQuicTransport.https.html
+++ b/testing/web-platform/tests/webrtc-quic/RTCQuicTransport.https.html
@@ -244,44 +244,44 @@ promise_test(async t => {
   await new Promise(resolve => t.step_timeout(resolve, 20));
   const stats2 = await localQuicTransport.getStats();
   assert_greater_than(stats2.timestamp, stats1.timestamp);
 }, 'Two separate stats returned by getStats() give different timestamps.');
 
 promise_test(async t => {
   const quicTransport = makeStandaloneQuicTransport(t);
   const promise = quicTransport.getStats();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'getStats() promises immediately rejected with InvalidStateError ' +
     `if called before 'connecting'.`);
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const promise = localQuicTransport.getStats();
   localQuicTransport.stop();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'getStats() promises rejected  with InvalidStateError if stop() ' +
    'is called before being fulfilled.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const promise = localQuicTransport.getStats();
   localQuicTransport.transport.stop();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'getStats() promises rejected  with InvalidStateError if ' +
    'RTCIceTransport calls stop() before being fulfilled.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   localQuicTransport.transport.stop();
   const promise = localQuicTransport.getStats();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'getStats() promises immediately rejected if called after ' +
    `'closed' state.`);
 
 test(t => {
   const quicTransport = makeStandaloneQuicTransport(t);
   assert_throws_dom('InvalidStateError',
       () => quicTransport.sendDatagram(new Uint8Array([1])));
 }, `sendDatagram() throws InvalidStateError if called before 'connected'.`);
@@ -343,57 +343,57 @@ promise_test(async t => {
   assert_equals(receiveDatagrams2.length, 1);
   const receiveDatagram2 = new Uint8Array(receiveDatagrams2[0]);
   assert_array_equals(receiveDatagram2, datagram2);
 }, 'sendDatagram() sends a multiple datagrams to remote side');
 
 test(t => {
   const quicTransport = makeStandaloneQuicTransport(t);
   const promise = quicTransport.readyToSendDatagram();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'readyToSendDatagram() promise immediately rejected if called before ' +
     'connecting');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   localQuicTransport.stop();
   const promise = localQuicTransport.readyToSendDatagram();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'readyToSendDatagram() promise immediately rejected if called after ' +
     `'closed' state.`);
 
 test(t => {
   const quicTransport = makeStandaloneQuicTransport(t);
   const promise = quicTransport.receiveDatagrams();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'receiveDatagrams() promise immediately rejected if called before ' +
     'connecting.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   localQuicTransport.stop();
   const promise = localQuicTransport.receiveDatagrams();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'receiveDatagrams() promise immediately rejected if called after ' +
     `'closed' state.`);
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const promise = localQuicTransport.receiveDatagrams();
   localQuicTransport.stop();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'receiveDatagrams() promise rejected  with InvalidStateError if stop() ' +
     'is called before being fulfilled.');
 
 promise_test(async t => {
   const [ localQuicTransport, remoteQuicTransport ] =
       await makeTwoConnectedQuicTransports(t);
   const promise = localQuicTransport.receiveDatagrams();
   localQuicTransport.transport.stop();
-  promise_rejects(t, 'InvalidStateError', promise);
+  promise_rejects_dom(t, 'InvalidStateError', promise);
 }, 'receiveDatagrams() promises rejected  with InvalidStateError if ' +
    'RTCIceTransport calls stop() before being fulfilled.');
 
 </script>
 
--- a/testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
+++ b/testing/web-platform/tests/webrtc/RTCConfiguration-rtcpMuxPolicy.html
@@ -161,17 +161,17 @@
         'a=setup:actpass\r\n' +
         'a=mid:audio1\r\n' +
         'a=sendonly\r\n' +
         'a=rtcp-rsize\r\n' +
         'a=rtpmap:111 opus/48000/2\r\n';
     const pc = new RTCPeerConnection({rtcpMuxPolicy: 'require'});
     t.add_cleanup(() => pc.close());
 
-    return promise_rejects(t, 'InvalidAccessError', pc.setRemoteDescription({type: 'offer', sdp}));
+    return promise_rejects_dom(t, 'InvalidAccessError', pc.setRemoteDescription({type: 'offer', sdp}));
   }, 'setRemoteDescription throws InvalidAccessError when called with an offer without rtcp-mux and rtcpMuxPolicy is set to require');
 
   promise_test(async t => {
     // audio-only SDP answer without BUNDLE and rtcp-mux.
     // Also omitting a=mid in order to avoid parsing it from the offer as this needs to match.
     const sdp = 'v=0\r\n' +
         'o=- 166855176514521964 2 IN IP4 127.0.0.1\r\n' +
         's=-\r\n' +
@@ -186,11 +186,11 @@
         'a=sendonly\r\n' +
         'a=rtcp-rsize\r\n' +
         'a=rtpmap:111 opus/48000/2\r\n';
     const pc = new RTCPeerConnection({rtcpMuxPolicy: 'require'});
     t.add_cleanup(() => pc.close());
 
     const offer = await generateAudioReceiveOnlyOffer(pc);
     await pc.setLocalDescription(offer);
-    return promise_rejects(t, 'InvalidAccessError', pc.setRemoteDescription({type: 'answer', sdp}));
+    return promise_rejects_dom(t, 'InvalidAccessError', pc.setRemoteDescription({type: 'answer', sdp}));
   }, 'setRemoteDescription throws InvalidAccessError when called with an answer without rtcp-mux and rtcpMuxPolicy is set to require');
 </script>
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-addIceCandidate.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-addIceCandidate.html
@@ -123,17 +123,17 @@ a=rtcp-rsize
         1.  If remoteDescription is null return a promise rejected with a
             newly created InvalidStateError.
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       pc.addIceCandidate({
         candidate: candidateStr1,
         sdpMid: sdpMid1,
         sdpMLineIndex: sdpMLineIndex1,
         usernameFragment: usernameFragment1
       }));
   }, 'Add ICE candidate before setting remote description should reject with InvalidStateError');
 
@@ -215,17 +215,17 @@ a=rtcp-rsize
   }, 'addIceCandidate({usernameFragment: usernameFragment2, sdpMLineIndex: 1}) should work, and add a=end-of-candidates to the first m-section');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     await pc.setRemoteDescription(sessionDesc);
-    await promise_rejects(t, 'OperationError',
+    await promise_rejects_dom(t, 'OperationError',
       pc.addIceCandidate({usernameFragment: "no such ufrag"}));
   }, 'addIceCandidate({usernameFragment: "no such ufrag"}) should not work');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
@@ -475,17 +475,17 @@ a=rtcp-rsize
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.setRemoteDescription(sessionDesc)
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.addIceCandidate({
           candidate: candidateStr1,
           sdpMid: 'invalid',
           sdpMLineIndex: sdpMLineIndex1,
           usernameFragement: usernameFragment1
         })));
   }, 'Add candidate with invalid sdpMid should reject with OperationError');
 
@@ -499,17 +499,17 @@ a=rtcp-rsize
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.setRemoteDescription(sessionDesc)
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.addIceCandidate({
           candidate: candidateStr1,
           sdpMLineIndex: 2,
           usernameFragement: usernameFragment1
         })));
   }, 'Add candidate with invalid sdpMLineIndex should reject with OperationError');
 
   // There is an "Else" for the statement:
@@ -555,17 +555,17 @@ a=rtcp-rsize
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.setRemoteDescription(sessionDesc)
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.addIceCandidate({
           candidate: candidateStr1,
           sdpMid: sdpMid1,
           sdpMLineIndex: sdpMLineIndex1,
           usernameFragment: 'invalid'
         })));
   }, 'Add candidate with invalid usernameFragment should reject with OperationError');
 
@@ -578,33 +578,33 @@ a=rtcp-rsize
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.setRemoteDescription(sessionDesc)
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.addIceCandidate({
           candidate: invalidCandidateStr,
           sdpMid: sdpMid1,
           sdpMLineIndex: sdpMLineIndex1,
           usernameFragement: usernameFragment1
         })));
   }, 'Add candidate with invalid candidate string should reject with OperationError');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.setRemoteDescription(sessionDesc)
     .then(() =>
-      promise_rejects(t, 'OperationError',
+      promise_rejects_dom(t, 'OperationError',
         pc.addIceCandidate({
           candidate: candidateStr2,
           sdpMid: sdpMid2,
           sdpMLineIndex: sdpMLineIndex2,
           usernameFragment: usernameFragment1
         })));
   }, 'Add candidate with sdpMid belonging to different usernameFragment should reject with OperationError');
 
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-createAnswer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-createAnswer.html
@@ -19,17 +19,17 @@
 
   /*
    *  4.1.  If connection's remoteDescription is null return a promise rejected with a
    *        newly created InvalidStateError.
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       pc.createAnswer());
   }, 'createAnswer() with null remoteDescription should reject with InvalidStateError');
 
   /*
    *  Final steps to create an answer
    *  4. Let answer be a newly created RTCSessionDescriptionInit dictionary with its
    *     type member initialized to the string "answer" and its sdp member initialized to sdpString.
    */
@@ -54,17 +54,17 @@
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return generateDataChannelOffer(pc)
     .then(offer => pc.setRemoteDescription(offer))
     .then(() => {
       pc.close();
-      return promise_rejects(t, 'InvalidStateError',
+      return promise_rejects_dom(t, 'InvalidStateError',
         pc.createAnswer());
     });
   }, 'createAnswer() when connection is closed reject with InvalidStateError');
 
   /*
    *  TODO
    *  4.3.2 createAnswer
    *    3.  If connection is configured with an identity provider, and an
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-createOffer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-createOffer.html
@@ -60,17 +60,17 @@
       }));
   }, 'createOffer() and then setLocalDescription() should succeed');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     pc.close();
 
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       pc.createOffer());
   }, 'createOffer() after connection is closed should reject with InvalidStateError');
 
   /*
    *  Final steps to create an offer
    *    2.  If connection was modified in such a way that additional inspection of the
    *        system state is necessary, then in parallel begin the steps to create an
    *        offer again, given p, and abort these steps.
@@ -103,17 +103,17 @@
     const states = [];
     pc.addEventListener('signalingstatechange', () => states.push(pc.signalingState));
 
     return generateVideoReceiveOnlyOffer(pc)
     .then(offer =>
        pc.setRemoteDescription(offer)
        .then(() => {
           assert_equals(pc.signalingState, 'have-remote-offer');
-          return promise_rejects(t, 'InvalidStateError',
+          return promise_rejects_dom(t, 'InvalidStateError',
              pc.createOffer());
        })
      )
   }, 'createOffer() should fail when signaling state is not stable or have-local-offer');
   /*
    *  TODO
    *  4.3.2 createOffer
    *    3.  If connection is configured with an identity provider, and an identity
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-generateCertificate.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-generateCertificate.html
@@ -63,22 +63,22 @@
 
   /*
    *  4.10. A user agent must reject a call to generateCertificate() with a
    *        DOMException of type NotSupportedError if the keygenAlgorithm
    *        parameter identifies an algorithm that the user agent cannot or
    *        will not use to generate a certificate for RTCPeerConnection.
    */
   promise_test(t =>
-    promise_rejects(t, 'NotSupportedError',
+    promise_rejects_dom(t, 'NotSupportedError',
       RTCPeerConnection.generateCertificate('invalid-algo')),
     'generateCertificate() with invalid string algorithm should reject with NotSupportedError');
 
   promise_test(t =>
-    promise_rejects(t, 'NotSupportedError',
+    promise_rejects_dom(t, 'NotSupportedError',
       RTCPeerConnection.generateCertificate({
         name: 'invalid-algo'
       })),
     'generateCertificate() with invalid algorithm dict should reject with NotSupportedError');
 
   /*
    *  4.10.1. Dictionary RTCCertificateExpiration
    *    dictionary RTCCertificateExpiration {
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
@@ -59,17 +59,17 @@
           receiver fit this criteria, return a promise rejected with a newly
           created InvalidAccessError.
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return getTrackFromUserMedia('audio')
     .then(([track, mediaStream]) => {
-      return promise_rejects(t, 'InvalidAccessError', pc.getStats(track));
+      return promise_rejects_dom(t, 'InvalidAccessError', pc.getStats(track));
     });
   }, 'getStats() with track not added to connection should reject with InvalidAccessError');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return getTrackFromUserMedia('audio')
     .then(([track, mediaStream]) => {
@@ -98,31 +98,31 @@
       // addTransceiver allows adding same track multiple times
       const transceiver1 = pc.addTransceiver(track);
       const transceiver2 = pc.addTransceiver(track);
 
       assert_not_equals(transceiver1, transceiver2);
       assert_not_equals(transceiver1.sender, transceiver2.sender);
       assert_equals(transceiver1.sender.track, transceiver2.sender.track);
 
-      return promise_rejects(t, 'InvalidAccessError', pc.getStats(track));
+      return promise_rejects_dom(t, 'InvalidAccessError', pc.getStats(track));
     });
   }, `getStats() with track associated with more than one sender should reject with InvalidAccessError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const transceiver1 = pc.addTransceiver('audio');
 
     // Create another transceiver that resends what
     // is being received, kind of like echo
     const transceiver2 = pc.addTransceiver(transceiver1.receiver.track);
     assert_equals(transceiver1.receiver.track, transceiver2.sender.track);
 
-    return promise_rejects(t, 'InvalidAccessError', pc.getStats(transceiver1.receiver.track));
+    return promise_rejects_dom(t, 'InvalidAccessError', pc.getStats(transceiver1.receiver.track));
   }, 'getStats() with track associated with both sender and receiver should reject with InvalidAccessError');
 
   /*
     8.5.  The stats selection algorithm
       2.  If selector is null, gather stats for the whole connection, add them to result,
           return result, and abort these steps.
    */
   promise_test(t => {
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-answer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-answer.html
@@ -127,17 +127,17 @@
 
     t.add_cleanup(() => pc.close());
 
     return generateVideoReceiveOnlyOffer(pc)
     .then(offer =>
       pc.setRemoteDescription(offer)
       .then(() => generateAnswer(offer))
       .then(answer =>
-        promise_rejects(t, 'InvalidModificationError',
+        promise_rejects_dom(t, 'InvalidModificationError',
           pc.setLocalDescription(answer))));
   }, 'setLocalDescription() with answer not created by own createAnswer() should reject with InvalidModificationError');
 
   /*
     4.3.1.6.  Set the RTCSessionSessionDescription
       2.3.  If the description's type is invalid for the current signaling state of
             connection, then reject p with a newly created InvalidStateError and abort
             these steps.
@@ -148,31 +148,31 @@
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
-      promise_rejects(t, 'InvalidModificationError',
+      promise_rejects_dom(t, 'InvalidModificationError',
         pc.setLocalDescription({ type: 'answer', sdp: offer.sdp })));
   }, 'Calling setLocalDescription(answer) from stable state should reject with InvalidModificationError');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
       pc.setLocalDescription(offer)
       .then(() => generateAnswer(offer)))
     .then(answer =>
-      promise_rejects(t, 'InvalidModificationError',
+      promise_rejects_dom(t, 'InvalidModificationError',
         pc.setLocalDescription(answer)));
   }, 'Calling setLocalDescription(answer) from have-local-offer state should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc1 = new RTCPeerConnection();
     t.add_cleanup(() => pc1.close());
     const pc2 = new RTCPeerConnection();
     t.add_cleanup(() => pc2.close());
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-offer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-offer.html
@@ -106,33 +106,33 @@
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const pc2 = new RTCPeerConnection();
 
     t.add_cleanup(() => pc2.close());
 
     return generateDataChannelOffer(pc)
     .then(offer =>
-      promise_rejects(t, 'InvalidModificationError',
+      promise_rejects_dom(t, 'InvalidModificationError',
         pc2.setLocalDescription(offer)));
   }, 'setLocalDescription() with offer not created by own createOffer() should reject with InvalidModificationError');
 
   promise_test(t => {
     // Create first offer with audio line, then second offer with
     // both audio and video line. Since the second offer is the
     // last offer, setLocalDescription would reject when setting
     // with the first offer
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return generateAudioReceiveOnlyOffer(pc)
     .then(offer1 =>
       generateVideoReceiveOnlyOffer(pc)
       .then(offer2 => {
         assert_session_desc_not_similar(offer1, offer2);
-        return promise_rejects(t, 'InvalidModificationError',
+        return promise_rejects_dom(t, 'InvalidModificationError',
           pc.setLocalDescription(offer1));
       }));
   }, 'Set created offer other than last offer should reject with InvalidModificationError');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
 
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-pranswer.html
@@ -60,17 +60,17 @@
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
-      promise_rejects(t, 'InvalidStateError',
+      promise_rejects_dom(t, 'InvalidStateError',
         pc.setLocalDescription({ type: 'pranswer', sdp: offer.sdp })));
   }, 'setLocalDescription(pranswer) from stable state should reject with InvalidStateError');
 
   /*
     4.3.1.6 Set the RTCSessionSessionDescription
       2.2.2.  If description is set as a local description, then run one of the
               following steps:
         - If description is of type "pranswer", then set
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setLocalDescription-rollback.html
@@ -94,30 +94,30 @@
       4.1.8.2.  Rollback
         - Rollback can only be used to cancel proposed changes;
           there is no support for rolling back from a stable state to a
           previous stable state
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       pc.setLocalDescription({ type: 'rollback' }));
   }, `setLocalDescription(rollback) from stable state should reject with InvalidStateError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return generateAudioReceiveOnlyOffer(pc)
     .then(offer =>
       pc.setRemoteDescription(offer)
       .then(() => pc.createAnswer()))
     .then(answer => pc.setLocalDescription(answer))
     .then(() => {
-      return promise_rejects(t, 'InvalidStateError',
+      return promise_rejects_dom(t, 'InvalidStateError',
         pc.setLocalDescription({ type: 'rollback' }));
     });
   }, `setLocalDescription(rollback) after setting answer description should reject with InvalidStateError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return pc.createOffer()
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-answer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-answer.html
@@ -97,27 +97,27 @@
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
-      promise_rejects(t, 'InvalidStateError',
+      promise_rejects_dom(t, 'InvalidStateError',
         pc.setRemoteDescription({ type: 'answer', sdp: offer.sdp })));
   }, 'Calling setRemoteDescription(answer) from stable state should reject with InvalidStateError');
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
       pc.setRemoteDescription(offer)
       .then(() => generateAnswer(offer)))
     .then(answer =>
-      promise_rejects(t, 'InvalidStateError',
+      promise_rejects_dom(t, 'InvalidStateError',
         pc.setRemoteDescription(answer)));
   }, 'Calling setRemoteDescription(answer) from have-remote-offer state should reject with InvalidStateError');
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-offer.html
@@ -269,17 +269,17 @@
     t.add_cleanup(() => pc2.close());
     await pc1.setLocalDescription(await pc1.createOffer());
     const offer = await pc2.createOffer();
     const p1 = pc1.setLocalDescription({type: 'rollback'});
     await new Promise(r => pc1.onsignalingstatechange = r);
     assert_equals(pc1.signalingState, 'stable');
     const p2 = pc1.addIceCandidate();
     const p3 = pc1.setRemoteDescription(offer);
-    await promise_rejects(t, 'InvalidStateError', p2);
+    await promise_rejects_dom(t, 'InvalidStateError', p2);
     await p1;
     await p3;
     assert_equals(pc1.signalingState, 'have-remote-offer');
   }, 'Naive rollback approach is not glare-proof (control)');
 
   promise_test(async t => {
     const pc1 = new RTCPeerConnection();
     const pc2 = new RTCPeerConnection();
@@ -300,11 +300,11 @@
     t.add_cleanup(() => pc1.close());
     t.add_cleanup(() => pc2.close());
     await pc1.setLocalDescription(await pc1.createOffer());
     const p = pc1.setRemoteDescription({type: 'offer', sdp: 'Invalid SDP'});
     await new Promise(r => pc1.onsignalingstatechange = r);
     assert_equals(pc1.signalingState, 'stable');
     assert_equals(pc1.pendingLocalDescription, null);
     assert_equals(pc1.pendingRemoteDescription, null);
-    await promise_rejects(t, 'RTCError', p);
+    await promise_rejects_dom(t, 'RTCError', p);
   }, 'setRemoteDescription(invalidOffer) from have-local-offer does not undo rollback');
 </script>
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-pranswer.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-pranswer.html
@@ -61,17 +61,17 @@
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
 
     t.add_cleanup(() => pc.close());
 
     return pc.createOffer()
     .then(offer =>
-      promise_rejects(t, 'InvalidStateError',
+      promise_rejects_dom(t, 'InvalidStateError',
         pc.setRemoteDescription({ type: 'pranswer', sdp: offer.sdp })));
   }, 'setRemoteDescription(pranswer) from stable state should reject with InvalidStateError');
 
   /*
     4.3.1.6.  Set the RTCSessionSessionDescription
       2.2.3.  Otherwise, if description is set as a remote description, then run one
               of the following steps:
         - If description is of type "pranswer", then set
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-setRemoteDescription-rollback.html
@@ -94,17 +94,17 @@
       4.1.8.2.  Rollback
         - Rollback can only be used to cancel proposed changes;
           there is no support for rolling back from a stable state to a
           previous stable state
    */
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       pc.setRemoteDescription({type: 'rollback'}));
   }, `setRemoteDescription(rollback) from stable state should reject with InvalidStateError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     return generateAudioReceiveOnlyOffer(pc)
     .then(offer => pc.setRemoteDescription(offer))
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-track-stats.https.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-track-stats.https.html
@@ -569,29 +569,29 @@
   }, 'RTCPeerConnection.getStats(receivingTrack) is the same as ' +
      'RTCRtpReceiver.getStats()');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     let [tracks, streams] = await getUserMediaTracksAndStreams(1);
     t.add_cleanup(() => tracks.forEach(track => track.stop()));
-    await promise_rejects(t, 'InvalidAccessError', pc.getStats(tracks[0]));
+    await promise_rejects_dom(t, 'InvalidAccessError', pc.getStats(tracks[0]));
   }, 'RTCPeerConnection.getStats(track) throws InvalidAccessError when there ' +
      'are zero senders or receivers for the track');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     let [tracks, streams] = await getUserMediaTracksAndStreams(2);
     t.add_cleanup(() => tracks.forEach(track => track.stop()));
     let sender1 = pc.addTrack(tracks[0], streams[0]);
     let sender2 = pc.addTrack(tracks[1], streams[1]);
     await sender2.replaceTrack(sender1.track);
-    await promise_rejects(t, 'InvalidAccessError', pc.getStats(sender1.track));
+    await promise_rejects_dom(t, 'InvalidAccessError', pc.getStats(sender1.track));
   }, 'RTCPeerConnection.getStats(track) throws InvalidAccessError when there ' +
      'are multiple senders for the track');
 
   // Helpers.
 
   function findStatsByTypeAndId(report, type, identifier) {
     return findStats(report, stats => {
       return stats.type == type && stats[type + 'Identifier'] == identifier;
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-codecs.html
@@ -94,17 +94,17 @@
     const codec = getFirstCodec(param);
 
     if(codec.payloadType === undefined) {
       codec.payloadType = 8;
     } else {
       codec.payloadType += 1;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.payloadType modified should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -114,17 +114,17 @@
     const codec = getFirstCodec(param);
 
     if(codec.mimeType === undefined) {
       codec.mimeType = 'audio/piedpiper';
     } else {
       codec.mimeType = `${codec.mimeType}-modified`;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.mimeType modified should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -134,17 +134,17 @@
     const codec = getFirstCodec(param);
 
     if(codec.clockRate === undefined) {
       codec.clockRate = 8000;
     } else {
       codec.clockRate += 1;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.clockRate modified should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -154,17 +154,17 @@
     const codec = getFirstCodec(param);
 
     if(codec.channels === undefined) {
       codec.channels = 6;
     } else {
       codec.channels += 1;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.channels modified should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -174,17 +174,17 @@
     const codec = getFirstCodec(param);
 
     if(codec.sdpFmtpLine === undefined) {
       codec.sdpFmtpLine = 'a=fmtp:98 0-15';
     } else {
       codec.sdpFmtpLine = `${codec.sdpFmtpLine};foo=1`;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with codec.sdpFmtpLine modified should reject with InvalidModificationError');
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -195,13 +195,13 @@
 
     codecs.push({
       payloadType: 2,
       mimeType: 'audio/piedpiper',
       clockRate: 1000,
       channels: 2
     });
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, 'setParameters() with new codecs inserted should reject with InvalidModificationError');
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-encodings.html
@@ -172,17 +172,17 @@
 
     const { encodings } = param;
     assert_equals(encodings.length, 1);
 
     // {} is valid RTCRtpEncodingParameters because all fields are optional
     encodings.push({});
     assert_equals(param.encodings.length, 2);
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError`);
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -206,17 +206,17 @@
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
     const encoding = getFirstEncoding(param);
 
     assert_equals(encoding.rid, 'foo');
 
     encoding.rid = 'bar';
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `setParameters() with modified encoding.rid field should reject with InvalidModificationError`);
 
   /*
     5.2.  setParameters
       8.  If the scaleResolutionDownBy parameter in the parameters argument has a
           value less than 1.0, abort these steps and return a promise rejected with
           a newly created RangeError.
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-headerExtensions.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-headerExtensions.html
@@ -63,13 +63,13 @@
     validateSenderRtpParameters(param);
 
     param.headerExtensions = [{
       uri: 'non-existent.example.org',
       id: 404,
       encrypted: false
     }];
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `setParameters() with modified headerExtensions should reject with InvalidModificationError`);
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-rtcp.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-rtcp.html
@@ -69,17 +69,17 @@
 
     } else if(rtcp.cname === undefined) {
       rtcp.cname = 'foo';
 
     } else {
       rtcp.cname = `${rtcp.cname}-modified`;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `setParameters() with modified rtcp.cname should reject with InvalidModificationError`);
 
   promise_test(t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
 
@@ -93,13 +93,13 @@
 
     } else if(rtcp.reducedSize === undefined) {
       rtcp.reducedSize = true;
 
     } else {
       rtcp.reducedSize = !rtcp.reducedSize;
     }
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `setParameters() with modified rtcp.reducedSize should reject with InvalidModificationError`);
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpParameters-transactionId.html
@@ -92,17 +92,17 @@
     await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     const { transactionId } = param;
     param.transactionId = `${transactionId}-modified`;
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param));
   }, `sender.setParameters() with transaction ID different from last getParameters() should reject with InvalidModificationError`);
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -122,17 +122,17 @@
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
 
     const param = sender.getParameters();
     validateSenderRtpParameters(param);
 
     return sender.setParameters(param)
     .then(() =>
-      promise_rejects(t, 'InvalidStateError',
+      promise_rejects_dom(t, 'InvalidStateError',
         sender.setParameters(param)));
   }, `setParameters() twice with the same parameters should reject with InvalidStateError`);
 
   promise_test(async t => {
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const { sender } = pc.addTransceiver('audio');
     await doOfferAnswerExchange(t, pc);
@@ -140,13 +140,13 @@
     const param1 = sender.getParameters();
     const param2 = sender.getParameters();
 
     validateSenderRtpParameters(param1);
     validateSenderRtpParameters(param2);
 
     assert_not_equals(param1.transactionId, param2.transactionId);
 
-    return promise_rejects(t, 'InvalidModificationError',
+    return promise_rejects_dom(t, 'InvalidModificationError',
       sender.setParameters(param1));
   }, `setParameters() with parameters older than last getParameters() should reject with InvalidModificationError`);
 
 </script>
--- a/testing/web-platform/tests/webrtc/RTCRtpSender-replaceTrack.https.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpSender-replaceTrack.https.html
@@ -34,17 +34,17 @@
     const stream = await getNoiseStream({audio: true});
     t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
     const [track] = stream.getTracks();
 
     const transceiver = pc.addTransceiver('audio');
     const { sender } = transceiver;
     pc.close();
 
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       sender.replaceTrack(track));
   }, 'Calling replaceTrack on closed connection should reject with InvalidStateError');
 
   /*
     5.2.  replaceTrack
       7.  If withTrack is non-null and withTrack.kind differs from the
           transceiver kind of transceiver, return a promise rejected with a
           newly created TypeError.
@@ -74,17 +74,17 @@
     const stream = await getNoiseStream({audio: true});
     t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
     const [track] = stream.getTracks();
 
     const transceiver = pc.addTransceiver('audio');
     const { sender } = transceiver;
     transceiver.stop();
 
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       sender.replaceTrack(track));
   }, 'Calling replaceTrack on stopped sender should reject with InvalidStateError');
 
   /*
     5.2.  replaceTrack
       8.  If transceiver is not yet associated with a media description [JSEP]
           (section 3.4.1.), then set sender's track attribute to withTrack, and
           return a promise resolved with undefined.
--- a/testing/web-platform/tests/webrtc/RTCRtpSender-setParameters.html
+++ b/testing/web-platform/tests/webrtc/RTCRtpSender-setParameters.html
@@ -18,13 +18,13 @@
     const pc = new RTCPeerConnection();
     t.add_cleanup(() => pc.close());
     const transceiver = pc.addTransceiver('audio');
     const { sender } = transceiver;
 
     const param = sender.getParameters();
     transceiver.stop();
 
-    return promise_rejects(t, 'InvalidStateError',
+    return promise_rejects_dom(t, 'InvalidStateError',
       sender.setParameters(param));
   }, `setParameters() when transceiver is stopped should reject with InvalidStateError`);
 
 </script>
--- a/testing/web-platform/tests/websockets/stream-tentative/abort.any.js
+++ b/testing/web-platform/tests/websockets/stream-tentative/abort.any.js
@@ -9,35 +9,35 @@ promise_test(async t => {
   const key = token();
   const wsUrl = new URL(
       `/fetch/api/resources/stash-put.py?key=${key}&value=connected`,
       location.href);
   wsUrl.protocol = wsUrl.protocol.replace('http', 'ws');
   // We intentionally use the port for the HTTP server, not the WebSocket
   // server, because we don't expect the connection to be performed.
   const wss = new WebSocketStream(wsUrl, { signal: controller.signal });
-  await promise_rejects(t, 'AbortError', wss.connection,
+  await promise_rejects_dom(t, 'AbortError', wss.connection,
                         'connection should reject');
-  await promise_rejects(t, 'AbortError', wss.closed, 'closed should reject');
+  await promise_rejects_dom(t, 'AbortError', wss.closed, 'closed should reject');
   // An incorrect implementation could pass this test due a race condition,
   // but it is hard to completely eliminate the possibility.
   const response = await fetch(`/fetch/api/resources/stash-take.py?key=${key}`);
   assert_equals(await response.text(), 'null', 'response should be null');
 }, 'abort before constructing should prevent connection');
 
 promise_test(async t => {
   const controller = new AbortController();
   const wss = new WebSocketStream(`${BASEURL}/handshake_sleep_2`,
                                   { signal: controller.signal });
   // Give the connection a chance to start.
   await new Promise(resolve => t.step_timeout(resolve, 0));
   controller.abort();
-  await promise_rejects(t, 'AbortError', wss.connection,
+  await promise_rejects_dom(t, 'AbortError', wss.connection,
                         'connection should reject');
-  await promise_rejects(t, 'AbortError', wss.closed, 'closed should reject');
+  await promise_rejects_dom(t, 'AbortError', wss.closed, 'closed should reject');
 }, 'abort during handshake should work');
 
 promise_test(async t => {
   const controller = new AbortController();
   const wss = new WebSocketStream(ECHOURL, { signal: controller.signal });
   const { readable, writable } = await wss.connection;
   controller.abort();
   writable.getWriter().write('connected');
--- a/testing/web-platform/tests/websockets/stream-tentative/close.any.js
+++ b/testing/web-platform/tests/websockets/stream-tentative/close.any.js
@@ -61,19 +61,19 @@ promise_test(async () => {
   assert_throws_dom('SyntaxError', () => wss.close({ reason }),
                     'close should throw a TypeError');
 }, 'close() with an overlong reason should throw');
 
 promise_test(t => {
   const wss = new WebSocketStream(ECHOURL);
   wss.close();
   return Promise.all([
-    promise_rejects(t, 'NetworkError', wss.connection,
+    promise_rejects_dom(t, 'NetworkError', wss.connection,
                     'connection promise should reject'),
-    promise_rejects(t, 'NetworkError', wss.closed,
+    promise_rejects_dom(t, 'NetworkError', wss.closed,
                     'closed promise should reject')]);
 }, 'close during handshake should work');
 
 for (const invalidCode of [999, 1001, 2999, 5000]) {
   promise_test(async () => {
     const wss = new WebSocketStream(ECHOURL);
     await wss.connection;
     assert_throws_dom('InvalidAccessError', () => wss.close({ code: invalidCode }),
--- a/testing/web-platform/tests/websockets/stream-tentative/constructor.any.js
+++ b/testing/web-platform/tests/websockets/stream-tentative/constructor.any.js
@@ -40,19 +40,19 @@ promise_test(async () => {
   const { value, done } = await reader.read();
   assert_equals(value, 'alpha', 'message contents should match');
   wss.close();
 }, 'setting a protocol in the constructor should work');
 
 promise_test(t => {
   const wss = new WebSocketStream(`${BASEURL}/404`);
   return Promise.all([
-    promise_rejects(t, 'NetworkError', wss.connection,
+    promise_rejects_dom(t, 'NetworkError', wss.connection,
                     'connection should reject'),
-    promise_rejects(t, 'NetworkError', wss.closed, 'closed should reject')
+    promise_rejects_dom(t, 'NetworkError', wss.closed, 'closed should reject')
   ]);
 }, 'connection failure should reject the promises');
 
 promise_test(async () => {
   const wss = new WebSocketStream(ECHOURL);
   const { readable, writable, protocol, extensions} = await wss.connection;
   // Verify that |readable| really is a ReadableStream using the getReader()
   // brand check. If it doesn't throw the test passes.
--- a/testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html
+++ b/testing/web-platform/tests/webxr/ar-module/xrDevice_requestSession_immersive-ar.https.html
@@ -13,16 +13,16 @@
       }, IMMERSIVE_AR_DEVICE, 'immersive-ar', {});
 
     xr_promise_test(
       "Tests requestSession rejects immersive-ar mode when unsupported",
       (t) => {
         return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
           .then((controller) => new Promise((resolve) => {
             navigator.xr.test.simulateUserActivation(() => {
-              resolve(promise_rejects(
+              resolve(promise_rejects_dom(
                 t, "NotSupportedError",
                 navigator.xr.requestSession('immersive-ar', {})));
             });
           }));
       });
 </script>
 </body>
--- a/testing/web-platform/tests/webxr/webGLCanvasContext_makecompatible_contextlost.https.html
+++ b/testing/web-platform/tests/webxr/webGLCanvasContext_makecompatible_contextlost.https.html
@@ -10,14 +10,14 @@
     xr_promise_test(
       "A lost webglCanvasContext should not be able to set xr compatibility",
      (t) => {
       return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
         .then( (controller) => {
           webglCanvas = document.getElementById('webgl-canvas');
           gl = webglCanvas.getContext('webgl', {xrCompatible: true});
           gl.getExtension('WEBGL_lose_context').loseContext();
-          return promise_rejects(t, 'InvalidStateError', gl.makeXRCompatible());
+          return promise_rejects_dom(t, 'InvalidStateError', gl.makeXRCompatible());
         });
     });
 
   </script>
 </body>
--- a/testing/web-platform/tests/webxr/webxr_feature_policy.https.html
+++ b/testing/web-platform/tests/webxr/webxr_feature_policy.https.html
@@ -13,17 +13,17 @@ xr_promise_test(
   return navigator.xr.isSessionSupported("inline").then((supported) => {
     t.step(() => {
       assert_true(supported,
         "inline should always be supported, even without feature policy");
     });
 
     // It shouldn't matter that there's no device connected, the SecurityError
     // should reject first.
-    return promise_rejects(t, "SecurityError",
+    return promise_rejects_dom(t, "SecurityError",
       navigator.xr.isSessionSupported("immersive-vr"),
       "Immersive isSessionSupported should reject");
   });
 });
 
 xr_promise_test(
 "Validate requestSession behavior without xr-spatial-tracking policy",
 (t) => {
@@ -35,21 +35,21 @@ xr_promise_test(
         // Technically the first "requestSession" doesn't need either the device
         // or the activation, but this makes the test code a little cleaner since
         // the others do, as lacking user activation or a valid backing device
         // should also cause the session to reject. In order to guarantee that
         // we're seeing the rejection we want, we eliminate those as possibilities.
         resolve(Promise.all([
           navigator.xr.requestSession("inline").then(session => session.end()),
 
-          promise_rejects(t, "NotSupportedError",
+          promise_rejects_dom(t, "NotSupportedError",
             navigator.xr.requestSession("inline", { requiredFeatures: ["local"] }),
             "Inline with features should reject without feature policy"),
 
-          promise_rejects(t, "NotSupportedError",
+          promise_rejects_dom(t, "NotSupportedError",
             navigator.xr.requestSession("immersive-vr"),
             "Immersive-vr should reject without feature policy")
           ]));
       });
     });
   });
 });
 
--- a/testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_no_gesture.https.html
+++ b/testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_no_gesture.https.html
@@ -4,13 +4,13 @@
   <script src=/resources/testharnessreport.js></script>
   <script src="resources/webxr_util.js"></script>
   <script src="resources/webxr_test_constants.js"></script>
   <script>
     xr_promise_test(
       "Requesting immersive session outside of a user gesture rejects",
       (t) => {
         return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
-          .then( (controller) => promise_rejects(
+          .then( (controller) => promise_rejects_dom(
             t, 'SecurityError', navigator.xr.requestSession('immersive-vr')));
       });
   </script>
 </body>
--- a/testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_unsupported.https.html
+++ b/testing/web-platform/tests/webxr/xrDevice_requestSession_immersive_unsupported.https.html
@@ -6,17 +6,17 @@
   <script src="resources/webxr_test_constants.js"></script>
   <script>
     xr_promise_test(
       "Requesting an immersive session when unsupported rejects",
       (t) => {
         return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
           .then( (controller) => new Promise((resolve) => {
             navigator.xr.test.simulateUserActivation( () => {
-              resolve(promise_rejects(
+              resolve(promise_rejects_dom(
                 t,
                 "NotSupportedError",
                 navigator.xr.requestSession('immersive-vr')
               ))
             });
           }));
       });
   </script>
--- a/testing/web-platform/tests/webxr/xrDevice_requestSession_requiredFeatures_unknown.https.html
+++ b/testing/web-platform/tests/webxr/xrDevice_requestSession_requiredFeatures_unknown.https.html
@@ -7,24 +7,24 @@
   <canvas></canvas>
   <script>
     xr_promise_test(
       "Tests requestSession rejects for unknown requiredFeatures",
       (t) => {
         return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
           .then( (controller) => new Promise((resolve) => {
             navigator.xr.test.simulateUserActivation( () => {
-              resolve(promise_rejects(
+              resolve(promise_rejects_dom(
                 t,
                 "NotSupportedError",
                 navigator.xr.requestSession('immersive-vr',
                                             {requiredFeatures: ['undefined-unicorns']}),
                 "unexpected requestSession success"
               ).then(() => {
-                return promise_rejects(
+                return promise_rejects_dom(
                   t,
                   "NotSupportedError",
                   navigator.xr.requestSession('immersive-vr',
                                             {requiredFeatures: [{unicorns: "please"}]}),
                   "unexpected requestSession success with unknown object"
                 );
               }));
             });
--- a/testing/web-platform/tests/webxr/xrSession_features_deviceSupport.https.html
+++ b/testing/web-platform/tests/webxr/xrSession_features_deviceSupport.https.html
@@ -32,17 +32,17 @@
     }
 
     return navigator.xr.test.simulateDeviceConnection(fakeDeviceInitParams)
       .then((controller) =>
         promise_simulate_user_activation(() => {
           // Attempting to request required features that aren't supported by
           // the device should reject.
 
-          return promise_rejects(t, "NotSupportedError",
+          return promise_rejects_dom(t, "NotSupportedError",
             navigator.xr.requestSession("immersive-vr", {
               requiredFeatures: ['bounded-floor']
             }))
         }).then(() => promise_simulate_user_activation(() => {
             // Attempting to request with an unsupported feature as optional
             // should succeed
             return session_resolves("immersive-vr", {
               optionalFeatures: ['bounded-floor']
--- a/testing/web-platform/tests/webxr/xrSession_prevent_multiple_exclusive.https.html
+++ b/testing/web-platform/tests/webxr/xrSession_prevent_multiple_exclusive.https.html
@@ -15,17 +15,17 @@
           navigator.xr.test.simulateUserActivation( () => {
             resolve(navigator.xr.requestSession('immersive-vr')
               .then( (session) => new Promise((resolve) => {
                 navigator.xr.test.simulateUserActivation( () => {
                   // Requesting a second immersive session when another immersive
                   // session is active should fail. Immersive sessions
                   // should take up the users entire view, and therefore it should
                   // be impossible for a user to be engaged with more than one.
-                  resolve(promise_rejects(
+                  resolve(promise_rejects_dom(
                     t,
                     "InvalidStateError",
                     navigator.xr.requestSession('immersive-vr')
                   ).then( () => {
                       // End the immersive session and try again. Now the immersive
                       // session creation should succeed.
                       return session.end().then( () => new Promise((resolve) => {
                         navigator.xr.test.simulateUserActivation( () => {
--- a/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace.https.html
+++ b/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace.https.html
@@ -40,23 +40,23 @@
               assert_true(referenceSpace instanceof XRReferenceSpace,
                 "floor-level stationary reference space is not correct type.");
             });
           })
         ]))
         .then(() => {
           if (session.mode == 'inline') {
             // Bounded reference spaces are not allowed in inline sessions.
-            return promise_rejects(t, "NotSupportedError", session.requestReferenceSpace('bounded-floor'))
+            return promise_rejects_dom(t, "NotSupportedError", session.requestReferenceSpace('bounded-floor'))
           }
         })
         .then(() => {
           if (session.mode == 'inline') {
             // Unbounded reference spaces are not allowed in inline sessions.
-            return promise_rejects(t, "NotSupportedError", session.requestReferenceSpace('unbounded'))
+            return promise_rejects_dom(t, "NotSupportedError", session.requestReferenceSpace('unbounded'))
           }
         })
     };
 
     // Reference spaces that aren't included in the default feature list must
     // be specified as a required or optional features on session creation.
     xr_session_promise_test(
       immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr',
--- a/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
+++ b/testing/web-platform/tests/webxr/xrSession_requestReferenceSpace_features.https.html
@@ -15,17 +15,17 @@
               "reference space is not correct type.");
           });
         });
       };
     };
 
     let makeInvalidSpaceTest = (space_type) => {
       return (session, fakeDeviceController, t) => {
-          return  promise_rejects(t, "NotSupportedError",
+          return  promise_rejects_dom(t, "NotSupportedError",
                                   session.requestReferenceSpace(space_type),
                                   "requestReferenceSpace('" + space_type + "')");
       };
     };
 
     let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
 
     // Test that reference spaces matching default features work.