dom/tests/mochitest/general/file_showModalDialog.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/general/file_showModalDialog.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +<script>
     1.8 +  function go() {
     1.9 +    is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
    1.10 +    ok("returnValue" in window && "dialogArguments" in window, "We are modal");
    1.11 +    var iwin = document.getElementById('ifr').contentWindow;
    1.12 +    is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");
    1.13 +
    1.14 +    if (location.origin != "http://mochi.test:8888") {
    1.15 +      is(window.dialogArguments, undefined,
    1.16 +        "dialogArguments should be undefined cross-origin: " + location.origin);
    1.17 +    }
    1.18 +
    1.19 +    window.returnValue = "rv: " + window.dialogArguments;
    1.20 +
    1.21 +    // Allow for testing navigations in series.
    1.22 +    if (location.search == "") {
    1.23 +      window.close();
    1.24 +    } else {
    1.25 +      var origins = location.search.split('?')[1].split(',');
    1.26 +      var newsearch = '?' + origins.splice(1).join(',');
    1.27 +      var newurl = location.toString().replace(location.origin, origins[0])
    1.28 +                                      .replace(location.search, newsearch);
    1.29 +      location = newurl;
    1.30 +    }
    1.31 +
    1.32 +  }
    1.33 +</script>
    1.34 +</head>
    1.35 +<body onload="opener.postMessage('dosetup', '*');">
    1.36 +<iframe id="ifr"></iframe>
    1.37 +</body>
    1.38 +</html>

mercurial