summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/identity/login.html
blob: eafba22f2d2e33c8c6977315a84d564014255987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE HTML>
<html>
<head>
  <title>Identity Provider Login</title>
  <script type="application/javascript">
  window.onload = () => {
    var xhr = new XMLHttpRequest();
    xhr.open("PUT", "https://example.com/.well-known/idp-proxy/idp.sjs?" +
             window.location.hash.replace('#', ''));
    xhr.onload = () => {
      var isFramed = (window !== window.top);
      var parent = isFramed ? window.parent : window.opener;
      // Using '*' is cheating, but that's OK.
      parent.postMessage('LOGINDONE', '*');
      var done = document.createElement('div');

      done.textContent = 'Done';
      document.body.appendChild(done);

      if (!isFramed) {
        window.close();
      }
    };
    xhr.send();
  };
  </script>
</head>
<body>
  <div>Logging in...</div>
</body>
</html>