dom/browser-element/mochitest/file_browserElement_Open1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/browser-element/mochitest/file_browserElement_Open1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +<html>
     1.5 +<body>
     1.6 +<script>
     1.7 +
     1.8 +// Because this file is inside <iframe mozbrowser>, the alert() calls below
     1.9 +// don't trigger actual dialogs.  Instead, the document which contans the
    1.10 +// iframe receives mozbrowsershowmodalprompt events, which the document uses
    1.11 +// to determine test success/failure.
    1.12 +
    1.13 +function is(x, y, reason) {
    1.14 +  if (x === y)  {
    1.15 +    alert("success: " + x + " === " + y + ", " + reason);
    1.16 +  }
    1.17 +  else {
    1.18 +    alert("failure: " + x + " !== " + y + ", " + reason);
    1.19 +  }
    1.20 +}
    1.21 +
    1.22 +function ok(bool, reason) {
    1.23 +  alert((bool ? "success: " : "failure: ") + reason);
    1.24 +}
    1.25 +
    1.26 +// Send "dialog=1" as a test for bug 783644.  It shouldn't have any effect.
    1.27 +var w = window.open("file_browserElement_Open2.html", "name", "dialog=1");
    1.28 +w.addEventListener("load", function() {
    1.29 +  ok(true, "got load");
    1.30 +  is(w.opener, window, 'opener property');
    1.31 +  is(w.location.href, location.href.replace('Open1', 'Open2'), 'correct location');
    1.32 +  is(w.document.getElementById('testElem').innerHTML, 'test', 'elem innerHTML');
    1.33 +  alert("finish");
    1.34 +});
    1.35 +</script>
    1.36 +</body>
    1.37 +</html>

mercurial