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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control-login.html

Issue 2651943002: Block subresource requests whose URLs include credentials. (Closed)
Patch Set: Test. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698