| OLD | NEW |
| 1 <script> | 1 <script> |
| 2 // Set authentication info | 2 // Set authentication info |
| 3 var port; | |
| 4 var w; | |
| 5 window.addEventListener("message", function(evt) { | 3 window.addEventListener("message", function(evt) { |
| 6 if (evt.ports[0]) { | 4 var port = evt.ports[0]; |
| 7 port = evt.ports[0]; | |
| 8 document.cookie = 'cookie=' + evt.data.cookie; | 5 document.cookie = 'cookie=' + evt.data.cookie; |
| 9 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.user
name); | 6 var xhr = new XMLHttpRequest(); |
| 10 } else { | 7 xhr.addEventListener('load', function() { |
| 11 w.close(); | 8 port.postMessage({msg: 'LOGIN FINISHED'}); |
| 12 w = null; | 9 }, false); |
| 13 port.postMessage({msg: 'LOGIN FINISHED'}); | 10 xhr.open('GET', |
| 14 } | 11 './fetch-access-control.php?Auth', |
| 15 }, false); | 12 true, |
| 16 </script> | 13 evt.data.username, evt.data.password); |
| 14 xhr.send(); |
| 15 }, false); |
| 16 </script> |
| OLD | NEW |