dom/browser-element/mochitest/browserElement_TargetTop.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/browser-element/mochitest/browserElement_TargetTop.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +/* Any copyright is dedicated to the public domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Bug 771273 - Check that window.open(url, '_top') works properly with <iframe
     1.8 +// mozbrowser>.
     1.9 +"use strict";
    1.10 +
    1.11 +SimpleTest.waitForExplicitFinish();
    1.12 +browserElementTestHelpers.setEnabledPref(true);
    1.13 +browserElementTestHelpers.addPermission();
    1.14 +
    1.15 +function runTest() {
    1.16 +  var iframe = document.createElement('iframe');
    1.17 +  SpecialPowers.wrap(iframe).mozbrowser = true;
    1.18 +
    1.19 +  iframe.addEventListener('mozbrowseropenwindow', function(e) {
    1.20 +    ok(false, 'Not expecting an openwindow event.');
    1.21 +  });
    1.22 +
    1.23 +  iframe.addEventListener('mozbrowserlocationchange', function(e) {
    1.24 +    if (/file_browserElement_TargetTop.html\?2$/.test(e.detail)) {
    1.25 +      ok(true, 'Got the locationchange we were looking for.');
    1.26 +      SimpleTest.finish();
    1.27 +    }
    1.28 +  });
    1.29 +
    1.30 +  document.body.appendChild(iframe);
    1.31 +  iframe.src = 'file_browserElement_TargetTop.html';
    1.32 +}
    1.33 +
    1.34 +addEventListener('testready', runTest);

mercurial