Chromium Code Reviews| OLD | NEW |
|---|---|
| 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'); |
|
falken
2017/05/12 05:04:21
I originally missed this critical part of the test
mike3
2017/05/12 15:36:03
Done.
| |
| 7 l.setAttribute('rel', 'preload'); | 7 l.setAttribute('rel', 'preload'); |
| 8 l.setAttribute('href', 'opaque-response'); | 8 l.setAttribute('href', 'opaque-response'); |
| 9 l.onload = function() { | 9 l.onload = function() { |
| 10 xhr = new XMLHttpRequest; | 10 xhr = new XMLHttpRequest; |
| 11 xhr.withCredentials = true; | 11 xhr.withCredentials = true; |
| 12 xhr.open('GET', 'opaque-response'); | 12 xhr.open('GET', 'opaque-response'); |
| 13 // opaque-response returns an opaque response from serviceworker and thus | 13 // opaque-response returns an opaque response from serviceworker and thus |
| 14 // the XHR must fail because it is not no-cors request. | 14 // the XHR must fail because it is not no-cors request. |
| 15 // Particularly, the XHR must not reuse preloaded the opaque response on | 15 // Particularly, the XHR must not reuse the preloaded the opaque response. |
|
falken
2017/05/12 05:04:21
"the preloaded the" is hard to read.
"reuse the o
mike3
2017/05/12 15:36:03
Done.
| |
| 16 // MemoryCache. | |
| 17 xhr.onerror = function() { | 16 xhr.onerror = function() { |
| 18 parent.done('PASS'); | 17 parent.done('PASS'); |
| 19 }; | 18 }; |
| 20 xhr.onload = function() { | 19 xhr.onload = function() { |
| 21 parent.done('FAIL: ' + xhr.responseText); | 20 parent.done('FAIL: ' + xhr.responseText); |
| 22 }; | 21 }; |
| 23 xhr.send(); | 22 xhr.send(); |
| 24 }; | 23 }; |
| 25 l.onerror = function() { | 24 l.onerror = function() { |
| 26 parent.done('FAIL: preload failed unexpectedly'); | 25 parent.done('FAIL: preload failed unexpectedly'); |
| 27 }; | 26 }; |
| 28 document.body.appendChild(l); | 27 document.body.appendChild(l); |
| 29 } | 28 } |
| 30 </script> | 29 </script> |
| 31 <body onload="setTimeout(runTest, 100)"></body> | 30 <body onload="setTimeout(runTest, 100)"></body> |
| OLD | NEW |