dom/browser-element/mochitest/browserElement_TargetTop.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the public domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Bug 771273 - Check that window.open(url, '_top') works properly with <iframe
     5 // mozbrowser>.
     6 "use strict";
     8 SimpleTest.waitForExplicitFinish();
     9 browserElementTestHelpers.setEnabledPref(true);
    10 browserElementTestHelpers.addPermission();
    12 function runTest() {
    13   var iframe = document.createElement('iframe');
    14   SpecialPowers.wrap(iframe).mozbrowser = true;
    16   iframe.addEventListener('mozbrowseropenwindow', function(e) {
    17     ok(false, 'Not expecting an openwindow event.');
    18   });
    20   iframe.addEventListener('mozbrowserlocationchange', function(e) {
    21     if (/file_browserElement_TargetTop.html\?2$/.test(e.detail)) {
    22       ok(true, 'Got the locationchange we were looking for.');
    23       SimpleTest.finish();
    24     }
    25   });
    27   document.body.appendChild(iframe);
    28   iframe.src = 'file_browserElement_TargetTop.html';
    29 }
    31 addEventListener('testready', runTest);

mercurial