Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/worklet/chromium/import-on-detached-iframe.html

Issue 2697243003: Worklet: Avoid import() on a detached frame (Closed)
Patch Set: move to chromium/ Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset="utf-8">
3 <title>Worklet: import() on a detached iframe</title>
4 <body>
5 </body>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
8 <script>
9
10 function with_iframe(url) {
11 return new Promise(resolve => {
12 let frame = document.createElement('iframe');
13 frame.src = url;
14 frame.onload = () => { resolve(frame); };
15 document.body.appendChild(frame);
16 add_result_callback(() => frame.remove());
17 });
18 }
19
20 // This test should be in chromium/ because the spec does not define behavior in
21 // the case where import() is called from a detached frame.
22 promise_test(t => {
23 const kFrameUrl = 'resources/blank.html';
24 const kScriptUrl = 'resources/empty-worklet-script.js';
25
26 return with_iframe(kFrameUrl)
27 .then(frame => {
28 let worklet = frame.contentWindow.paintWorklet;
29 frame.remove();
30 return worklet.import(kScriptUrl);
31 })
32 .then(() => assert_unreached('import() should fail.'))
33 .catch(e => assert_equals(e.name, 'InvalidStateError', e));
34 }, 'import() on a detached iframe should be rejected.');
35
36 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698