summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/general/file_showModalDialog.html
blob: 1cae0b1c0846767f782ec4239280af2c8bfb755a (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
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<script>
  function go() {
    is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
    ok("returnValue" in window && "dialogArguments" in window, "We are modal");
    var iwin = document.getElementById('ifr').contentWindow;
    is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");

    if (location.origin != "http://mochi.test:8888") {
      is(window.dialogArguments, undefined,
        "dialogArguments should be undefined cross-origin: " + location.origin);
    }

    window.returnValue = "rv: " + window.dialogArguments;

    // Allow for testing navigations in series.
    if (location.search == "") {
      window.close();
    } else {
      var origins = location.search.split('?')[1].split(',');
      var newsearch = '?' + origins.splice(1).join(',');
      var newurl = location.toString().replace(location.origin, origins[0])
                                      .replace(location.search, newsearch);
      location = newurl;
    }

  }
</script>
</head>
<body onload="opener.postMessage('dosetup', '*');">
<iframe id="ifr"></iframe>
</body>
</html>