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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/iframe-sandbox-register-link-element.https.html

Issue 2896643002: Upstream service wrkr "iframe sandbox" test to WPT (Closed)
Patch Set: Created 3 years, 7 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 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.sub.js"></script>
5 <title>Service worker registration from within sandboxed iframe</title>
6 <body>
7 <script>
8 'use strict';
9 function waitForMsg(id) {
10 return new Promise(function(resolve) {
11 window.addEventListener('message', function onMessage(event) {
12 if (!event.data || event.data.id !== id) {
13 return;
14 }
15 window.removeEventListener('message', onMessage);
16 resolve(event.data.result);
17 });
18 });
19 }
20
21 promise_test(function(t) {
22 var iframe = document.createElement('iframe');
23 iframe.setAttribute('src', 'resources/iframe-register-link-element.html?subt est1');
24 iframe.setAttribute('sandbox', 'allow-scripts');
25
26 document.body.appendChild(iframe);
27 t.add_cleanup(function() {
28 iframe.remove();
29 });
30
31 return waitForMsg('?subtest1')
32 .then(function(data) {
33 assert_equals(data, 'error');
34 });
35 }, 'registration via <link> element `rel` rejected');
36
37 promise_test(function(t) {
38 var iframe = document.createElement('iframe');
39 iframe.setAttribute('src', 'resources/iframe-register-link-element.html?subt est2');
40 iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
41
42 document.body.appendChild(iframe);
43 t.add_cleanup(function() {
44 iframe.remove();
45 });
46
47 return waitForMsg('?subtest2')
48 .then(function(data) {
49 assert_equals(data, 'loaded');
50 });
51 }, 'registration via <link> element `rel` accepted in presence of `allow-same- origin` directive');
52 </script>
53 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698