mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests
Replace some "promise_rejects(t, new FooError, stuff)" calls with promise_rejects_js.
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]*)(?:new )?([A-Z][A-Za-z]*Error) *(?:\(\))? *(, *.)/promise_rejects_js(\1\2\3/gs'
(which allows the optional "new" before "FooError" and an optional "()" after
it) and then:
1) Manually editing css/cssom-view/MediaQueryList-addListener-handleEvent.html
to make it get TypeError from the right global.
2) Manually editing fetch/api/response/response-error-from-stream.html to use
promise_rejects_exactly instead of the thing it was doing with a
CustomTestError.
3) Manually editing html/cross-origin-embedder-policy/require-corp.https.html
to use TypeError from the right global in the window.open case.
4) Manually editing
service-workers/service-worker/controller-with-no-fetch-event-handler.https.html
to use TypeError from the right global in the subframe case.
5) Manually editing
service-workers/service-worker/fetch-response-taint.https.html to use TypeError
from the right frame.
6) Manually editing
service-workers/service-worker/redirected-response.https.html to get the
TypeError from the right subframe in various places.
--
wpt-commits: ab733fd9f53eefdc034a2b96d08f080b355b6b10
wpt-pr: 21582
56 lines
1.8 KiB
HTML
56 lines
1.8 KiB
HTML
<!doctype html>
|
|
<meta charset="utf-8">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<body>
|
|
<script>
|
|
promise_test(t => {
|
|
const blob_contents = 'test blob contents';
|
|
const blob = new Blob([blob_contents]);
|
|
const worker = new Worker('resources/create-helper.js');
|
|
let url;
|
|
return new Promise(resolve => {
|
|
worker.onmessage = e => resolve(e.data);
|
|
worker.postMessage({blob: blob});
|
|
}).then(data => {
|
|
url = data.url;
|
|
let result = fetch(url);
|
|
worker.terminate();
|
|
return result;
|
|
}).then(response => response.text()).then(text => {
|
|
assert_equals(text, blob_contents);
|
|
return new Promise(resolve => t.step_timeout(resolve, 100));
|
|
}).then(() => promise_rejects_js(t, TypeError, fetch(url)));
|
|
}, 'Terminating worker revokes its URLs');
|
|
|
|
promise_test(t => {
|
|
const blob_contents = 'test blob contents';
|
|
const blob = new Blob([blob_contents]);
|
|
const frame = document.createElement('iframe');
|
|
frame.setAttribute('style', 'display:none;');
|
|
frame.src = 'resources/create-helper.html';
|
|
document.body.appendChild(frame);
|
|
|
|
let url;
|
|
return new Promise(resolve => {
|
|
frame.onload = t.step_func(e => {
|
|
resolve(e);
|
|
});
|
|
}).then(e => {
|
|
frame.contentWindow.postMessage({blob: blob}, '*');
|
|
return new Promise(resolve => {
|
|
self.addEventListener('message', t.step_func(e => {
|
|
if (e.source === frame.contentWindow) resolve(e);
|
|
}));
|
|
});
|
|
}).then(e => {
|
|
url = e.data.url;
|
|
let fetch_result = fetch(url);
|
|
document.body.removeChild(frame);
|
|
return fetch_result;
|
|
}).then(response => response.text()).then(text => {
|
|
assert_equals(text, blob_contents);
|
|
return new Promise(resolve => t.step_timeout(resolve, 100));
|
|
}).then(() => promise_rejects_js(t, TypeError, fetch(url)));
|
|
}, 'Removing an iframe revokes its URLs');
|
|
</script> |