| Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/resources/credentials-iframe.html
|
| diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/resources/credentials-iframe.html b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/resources/credentials-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..00702df9e5b1f2b4b89d8e096121dd97e81198c2
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/cache-storage/resources/credentials-iframe.html
|
| @@ -0,0 +1,38 @@
|
| +<!DOCTYPE html>
|
| +<meta charset=utf-8>
|
| +<title>Controlled frame for Cache API test with credentials</title>
|
| +<script>
|
| +
|
| +function xhr(url, username, password) {
|
| + return new Promise(function(resolve, reject) {
|
| + var xhr = new XMLHttpRequest(), async = true;
|
| + xhr.open('GET', url, async, username, password);
|
| + xhr.send();
|
| + xhr.onreadystatechange = function() {
|
| + if (xhr.readyState !== XMLHttpRequest.DONE)
|
| + return;
|
| + if (xhr.status === 200) {
|
| + resolve(xhr.responseText);
|
| + } else {
|
| + reject(new Error(xhr.statusText));
|
| + }
|
| + };
|
| + });
|
| +}
|
| +
|
| +window.onmessage = function(e) {
|
| + Promise.all(e.data.map(function(item) {
|
| + return xhr(item.name, item.username, item.password);
|
| + }))
|
| + .then(function() {
|
| + navigator.serviceWorker.controller.postMessage('keys');
|
| + navigator.serviceWorker.onmessage = function(e) {
|
| + window.parent.postMessage(e.data, '*');
|
| + };
|
| + });
|
| +};
|
| +
|
| +</script>
|
| +<body>
|
| +Hello? Yes, this is iframe.
|
| +</body>
|
|
|