dom/browser-element/mochitest/browserElement_ForwardName.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the public domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // Bug 781320 - Test that the name in <iframe mozbrowser name="foo"> is
     5 // forwarded down to remote mozbrowsers.
     7 "use strict";
     9 SimpleTest.waitForExplicitFinish();
    10 browserElementTestHelpers.setEnabledPref(true);
    11 browserElementTestHelpers.addPermission();
    13 function runTest() {
    14   var iframe = document.createElement('iframe');
    15   SpecialPowers.wrap(iframe).mozbrowser = true;
    16   iframe.setAttribute('name', 'foo');
    18   iframe.addEventListener("mozbrowseropenwindow", function(e) {
    19     ok(false, 'Got mozbrowseropenwindow, but should not have.');
    20   });
    22   iframe.addEventListener('mozbrowserlocationchange', function(e) {
    23     ok(true, "Got locationchange to " + e.detail);
    24     if (e.detail.endsWith("ForwardName.html#finish")) {
    25       SimpleTest.finish();
    26     }
    27   });
    29   // The file sends us messages via alert() that start with "success:" or
    30   // "failure:".
    31   iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
    32     ok(e.detail.message.startsWith('success:'), e.detail.message);
    33   });
    35   document.body.appendChild(iframe);
    37   // This file does window.open('file_browserElement_ForwardName.html#finish',
    38   // 'foo');  That should open in the curent window, because the window should
    39   // be named foo.
    40   iframe.src = 'file_browserElement_ForwardName.html';
    41 }
    43 addEventListener('testready', runTest);

mercurial