Commit 143d2905 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT/common/security-features] Stop using assert_* from common.js

As preparation for
https://chromium-review.googlesource.com/c/chromium/src/+/1565621
this CL replaces assert_*() with Promise.reject() or throw,
to enable common.js to work without testharness.js and outside
promise_test().

Bug: 906850
Change-Id: Iea2b4621c44c0c28aaf1f9bb0a1412e4ef682c4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1565556
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653508}
parent 97ae1d33
......@@ -263,7 +263,8 @@ function requestViaIframe(url, additionalAttributes) {
false);
return bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow);
if (event.source !== iframe.contentWindow)
return Promise.reject(new Error('Unexpected event.source'));
return event.data;
});
}
......@@ -481,8 +482,7 @@ function get_worklet(type) {
if (type == 'audio')
return new OfflineAudioContext(2,44100*40,44100).audioWorklet;
assert_unreached('unknown worklet type is passed.');
return undefined;
throw new Error('unknown worklet type is passed.');
}
function requestViaWorklet(type, url) {
......@@ -510,7 +510,8 @@ function requestViaNavigable(navigableElement, url) {
const promise =
bindEvents2(window, "message", iframe, "error", window, "error")
.then(event => {
assert_equals(event.source, iframe.contentWindow, "event.source");
if (event.source !== iframe.contentWindow)
return Promise.reject(new Error('Unexpected event.source'));
return event.data;
});
navigableElement.click();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment