| Index: third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html b/third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bbba10226d11bbccd1cd43cf5927cdbf01e04ddb
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html
|
| @@ -0,0 +1,36 @@
|
| +<!DOCTYPE html>
|
| +<meta charset="utf-8">
|
| +<title>Worklet: import() on a detached iframe</title>
|
| +<body>
|
| +</body>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +function with_iframe(url) {
|
| + return new Promise(resolve => {
|
| + let frame = document.createElement('iframe');
|
| + frame.src = url;
|
| + frame.onload = () => { resolve(frame); };
|
| + document.body.appendChild(frame);
|
| + add_result_callback(() => frame.remove());
|
| + });
|
| +}
|
| +
|
| +// This test should be in chromium/ because the spec does not define behavior in
|
| +// the case where import() is called from a detached frame.
|
| +promise_test(t => {
|
| + const kFrameUrl = 'resources/blank.html';
|
| + const kScriptUrl = 'resources/empty-worklet-script.js';
|
| +
|
| + return with_iframe(kFrameUrl)
|
| + .then(frame => {
|
| + let worklet = frame.contentWindow.paintWorklet;
|
| + frame.remove();
|
| + return worklet.import(kScriptUrl);
|
| + })
|
| + .then(() => assert_unreached('import() should fail.'))
|
| + .catch(e => assert_equals(e.name, 'InvalidStateError', e));
|
| +}, 'import() on a detached iframe should be rejected.');
|
| +
|
| +</script>
|
|
|