dom/browser-element/mochitest/browserElement_ForwardName.js

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:4c4a553c04e7
1 /* Any copyright is dedicated to the public domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 // Bug 781320 - Test that the name in <iframe mozbrowser name="foo"> is
5 // forwarded down to remote mozbrowsers.
6
7 "use strict";
8
9 SimpleTest.waitForExplicitFinish();
10 browserElementTestHelpers.setEnabledPref(true);
11 browserElementTestHelpers.addPermission();
12
13 function runTest() {
14 var iframe = document.createElement('iframe');
15 SpecialPowers.wrap(iframe).mozbrowser = true;
16 iframe.setAttribute('name', 'foo');
17
18 iframe.addEventListener("mozbrowseropenwindow", function(e) {
19 ok(false, 'Got mozbrowseropenwindow, but should not have.');
20 });
21
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 });
28
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 });
34
35 document.body.appendChild(iframe);
36
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 }
42
43 addEventListener('testready', runTest);

mercurial