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

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

Issue 2697243003: Worklet: Avoid import() on a detached frame (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/worklet/resources/blank.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 var frame = document.createElement('iframe');
falken 2017/02/16 07:25:03 nit: let or const
nhiroki 2017/02/16 07:33:07 Done.
13 frame.src = url;
14 frame.onload = () => { resolve(frame); };
15 document.body.appendChild(frame);
16 add_completion_callback(() => frame.remove());
falken 2017/02/16 07:25:03 nit: add_result_callback may be slightly cleaner i
nhiroki 2017/02/16 07:33:07 Yeah, it looks like add_result_callback is more pr
17 });
18 }
19
20 promise_test(t => {
21 const kFrameUrl = 'resources/blank.html';
22 const kScriptUrl = 'resources/empty-worklet-script.js';
23
24 return with_iframe(kFrameUrl)
25 .then(frame => {
26 let worklet = frame.contentWindow.paintWorklet;
27 frame.remove();
28 return worklet.import(kScriptUrl);
29 })
30 .then(() => assert_unreached('import() should fail.'))
31 .catch(e => assert_equals(e.name, 'InvalidStateError', e));
32 }, 'import() on a detached iframe should be rejected.');
33
34 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/worklet/resources/blank.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698