Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html |
index 4152c669da466f96f961a88ea5a5b95930ca1b34..1dad1c82f11487b39a8209d4e9274f2052d40ffb 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html |
@@ -1,16 +1,16 @@ |
<script> |
// Set authentication info |
+var port; |
+var w; |
window.addEventListener("message", function(evt) { |
- var port = evt.ports[0]; |
+ if (evt.ports[0]) { |
+ port = evt.ports[0]; |
document.cookie = 'cookie=' + evt.data.cookie; |
- var xhr = new XMLHttpRequest(); |
- xhr.addEventListener('load', function() { |
- port.postMessage({msg: 'LOGIN FINISHED'}); |
- }, false); |
- xhr.open('GET', |
- './fetch-access-control.php?Auth', |
- true, |
- evt.data.username, evt.data.password); |
- xhr.send(); |
- }, false); |
-</script> |
+ w = window.open(window.location.protocol + "//" + evt.data.username + ":" + evt.data.password + "@" + window.location.hostname + ":" + window.location.port + "/serviceworker/resources/fetch-access-control.php?Auth&WINDOW", evt.data.username); |
+ } else { |
+ w.close(); |
+ w = null; |
+ port.postMessage({msg: 'LOGIN FINISHED'}); |
+ } |
+}, false); |
+</script> |