Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* Any copyright is dedicated to the public domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Bug 769182 - window.open to a different origin should load the page.
6 "use strict";
7 SimpleTest.waitForExplicitFinish();
8 browserElementTestHelpers.setEnabledPref(true);
9 browserElementTestHelpers.addPermission();
11 function runTest() {
12 var iframe = document.createElement('iframe');
13 SpecialPowers.wrap(iframe).mozbrowser = true;
15 iframe.addEventListener('mozbrowseropenwindow', function(e) {
16 ok(true, 'Got first window.open call');
18 e.detail.frameElement.addEventListener('mozbrowseropenwindow', function(e) {
19 ok(true, 'Got second window.open call');
20 document.body.appendChild(e.detail.frameElement);
21 });
23 e.detail.frameElement.addEventListener('mozbrowsershowmodalprompt', function(e) {
24 ok(true, 'Got alert from second window.');
25 SimpleTest.finish();
26 });
28 document.body.appendChild(e.detail.frameElement);
29 });
31 // DifferentOrigin.html?1 calls
32 //
33 // window.open('http://example.com/.../DifferentOrigin.html?2'),
34 //
35 // which calls alert().
37 iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_OpenWindowDifferentOrigin.html?1';
38 document.body.appendChild(iframe);
39 }
41 addEventListener('testready', runTest);