Files
firefox/testing/web-platform/tests/workers/data-url.html
T
Hiroki Nakagawa 92a46d2650 Bug 1616200 [wpt PR 21849] - Revert "Reland "Worker: Add data URL tests for nested dedicated workers"", a=testonly
Automatic update from web-platform-tests
Revert "Reland "Worker: Add data URL tests for nested dedicated workers""

This reverts commit 1431d28a18a6bdd158ba9f05e7d372887a6039dd.

Reason for revert:
The tests still consistently time out on WebKit Linux Leak.

Original change's description:
> Reland "Worker: Add data URL tests for nested dedicated workers"
>
> The original patch was reverted because the tests with worker variant
> (nested dedicated workers) consistently timed out on WebKit Linux Leak.
> In general, nested dedicated workers are slow, and also WebKit Linux
> Leak is slow. Probably this is the reason why the tests consistently
> timed out.
>
> To mitigate it, this patch adds timeout=long in the WPT's META line in
> addition to the original patch.
>
> For sheriff: If the tests still time out on WebKit Linux Leak, feel free
> to revert this patch again. In that case, I'll attempt to separate the
> tests into multiple files.
>
> Original change's description:
> > Revert "Worker: Add data URL tests for nested dedicated workers"
> >
> > This reverts commit 1d73a2eb29cb7088b4920cf8958b6b3d053b093a.
> >
> > Reason for revert: Worker variant of tests appears to consistently timeout on WebKit Linux Leak (crbug.com/1052322)
> >
> > Original change's description:
> > > Worker: Add data URL tests for nested dedicated workers
> > >
> > > This CL renames data-url.html to data-url.any.js in order to run the
> > > tests on a dedicated worker. Previously these tests only ran on window.
> > >
> > > Bug: n/a
> > > Change-Id: I4be0cfdddc01fa4865763868c4947ea63e62d491
> > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2054656
> > > Reviewed-by: Makoto Shimazu <[email protected]>
> > > Commit-Queue: Hiroki Nakagawa <[email protected]>
> > > Cr-Commit-Position: refs/heads/master@{#741367}
> >
> > [email protected],[email protected]
> >
> > Change-Id: I00481f9a51c672b4041364674d0bcad00d959c63
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: n/a
> > Bug: 1052322
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057046
> > Reviewed-by: Stephen McGruer <[email protected]>
> > Commit-Queue: Stephen McGruer <[email protected]>
> > Cr-Commit-Position: refs/heads/master@{#741417}
>
> Bug: 1052322
> Change-Id: I348ba1743f58a6f0fedf2b739a1cb6a574af6f2f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060356
> Reviewed-by: Makoto Shimazu <[email protected]>
> Commit-Queue: Hiroki Nakagawa <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#742050}

[email protected],[email protected]

Change-Id: I09412305ad6d2093ffb6c489774552eb0bd58f3b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1052322
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2061577
Reviewed-by: Hiroki Nakagawa <[email protected]>
Commit-Queue: Hiroki Nakagawa <[email protected]>
Cr-Commit-Position: refs/heads/master@{#742080}

--

wpt-commits: f1fc271ead2366fd2fbe8d8957cd9afa86b40a19
wpt-pr: 21849
2020-02-21 10:44:54 +00:00

68 lines
2.8 KiB
HTML

<!DOCTYPE html>
<title>data URL dedicated workers</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Helper assert functions -START-
function assert_worker_sends_pass(test_desc, mime_type, worker_code) {
async_test(function(t) {
var w = new Worker(`data:${mime_type},${worker_code}`);
w.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, 'PASS');
});
w.postMessage('SEND_PASS');
}, test_desc);
}
function assert_worker_throws(test_desc, worker_code) {
assert_worker_sends_pass(test_desc, '', `try { ${worker_code}; self.postMessage("FAIL"); } catch (e) { self.postMessage("PASS"); }`);
}
function assert_worker_construction_fails(test_desc, mime_type, worker_code) {
async_test(function(t) {
var w = new Worker(`data:${mime_type},${worker_code};postMessage("PASS")`);
w.onmessage = t.step_func_done(function(e) {
assert_unreached('Should not receive any message back.');
});
w.onerror = t.step_func_done(function(e) {
assert_true(true, 'Should throw ' + e.message);
// Stop the error from being propagated to the WPT test harness
e.preventDefault();
});
}, test_desc);
}
// Helper assert functions -END-
// Actual tests -START-
// Any MIME type allowed
assert_worker_sends_pass('application/javascript MIME allowed', 'application/javascript', 'self.postMessage("PASS")');
assert_worker_sends_pass('text/plain MIME allowed', 'text/plain', 'self.postMessage("PASS")');
assert_worker_sends_pass('empty MIME allowed', '', 'self.postMessage("PASS")');
// Communications goes both ways
assert_worker_sends_pass('communication goes both ways', 'application/javascript', 'onmessage = function(e) { self.postMessage("PASS"); }');
// test access to storage APIs
// https://w3c.github.io/IndexedDB/#dom-idbfactory-open
assert_worker_sends_pass('indexedDB is present', '', 'self.postMessage("indexedDB" in self ? "PASS" : "FAIL")');
assert_worker_throws('indexedDB is inaccessible', 'self.indexedDB.open("someDBName")');
// Other standardized storage APIs are either not exposed to workers
// (e.g. window.localStorage, window.sessionStorage), or are [SecureContext]
// (e.g. self.caches).
// 'data:' workers are cross-origin
assert_worker_sends_pass('cross-origin worker', '', 'fetch("/").then(() => self.postMessage("FAIL"), () => self.postMessage("PASS"))');
// 'data:' workers have opaque origin
assert_worker_sends_pass('worker has opaque origin', 'application/javascript', 'if (self.location.origin == "null") {postMessage("PASS");} else {postMessage("FAIL");}');
setup({allow_uncaught_exception:true});
// invalid javascript will trigger an ErrorEvent
assert_worker_construction_fails('invalid javascript produces error', 'application/javascript', '}x=3');
// Actual tests -END-
</script>