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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/opaque-response-preloaded-iframe.html

Issue 2903653005: [preload] Mandatory `as` value and related spec alignments (Closed)
Patch Set: IDL changes Created 3 years, 6 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <meta charset="utf-8"> 2 <meta charset="utf-8">
3 <body></body> 3 <body></body>
4 <script> 4 <script>
5 function runTest() { 5 function runTest() {
6 var l = document.createElement('link'); 6 var l = document.createElement('link');
7 // Use link rel=preload to try to get the browser to cache the opaque 7 // Use link rel=preload to try to get the browser to cache the opaque
8 // response. 8 // response.
9 l.setAttribute('rel', 'preload'); 9 l.setAttribute('rel', 'preload');
10 l.setAttribute('href', 'opaque-response'); 10 l.setAttribute('href', 'opaque-response');
11 l.setAttribute('as', 'fetch');
11 l.onload = function() { 12 l.onload = function() {
12 xhr = new XMLHttpRequest; 13 xhr = new XMLHttpRequest;
13 xhr.withCredentials = true; 14 xhr.withCredentials = true;
14 xhr.open('GET', 'opaque-response'); 15 xhr.open('GET', 'opaque-response');
15 // opaque-response returns an opaque response from serviceworker and thus 16 // opaque-response returns an opaque response from serviceworker and thus
16 // the XHR must fail because it is not no-cors request. 17 // the XHR must fail because it is not no-cors request.
17 // Particularly, the XHR must not reuse the opaque response from the 18 // Particularly, the XHR must not reuse the opaque response from the
18 // preload request. 19 // preload request.
19 xhr.onerror = function() { 20 xhr.onerror = function() {
20 parent.done('PASS'); 21 parent.done('PASS');
21 }; 22 };
22 xhr.onload = function() { 23 xhr.onload = function() {
23 parent.done('FAIL: ' + xhr.responseText); 24 parent.done('FAIL: ' + xhr.responseText);
24 }; 25 };
25 xhr.send(); 26 xhr.send();
26 }; 27 };
27 l.onerror = function() { 28 l.onerror = function() {
28 parent.done('FAIL: preload failed unexpectedly'); 29 parent.done('FAIL: preload failed unexpectedly');
29 }; 30 };
30 document.body.appendChild(l); 31 document.body.appendChild(l);
31 } 32 }
32 </script> 33 </script>
33 <body onload="setTimeout(runTest, 100)"></body> 34 <body onload="setTimeout(runTest, 100)"></body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698