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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/worklet/import-on-detached-iframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/import-on-detached-iframe.html b/third_party/WebKit/LayoutTests/http/tests/worklet/import-on-detached-iframe.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a232a58cea239ef8dcd11ece9fe2d896be7a31c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/worklet/import-on-detached-iframe.html
@@ -0,0 +1,34 @@
+<!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 => {
+ var frame = document.createElement('iframe');
falken 2017/02/16 07:25:03 nit: let or const
nhiroki 2017/02/16 07:33:07 Done.
+ frame.src = url;
+ frame.onload = () => { resolve(frame); };
+ document.body.appendChild(frame);
+ 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
+ });
+}
+
+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>
« 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