Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* Any copyright is dedicated to the public domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | // Bug 771273 - Check that window.open(url, '_top') works properly with <iframe |
michael@0 | 5 | // mozbrowser>. |
michael@0 | 6 | "use strict"; |
michael@0 | 7 | |
michael@0 | 8 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 9 | browserElementTestHelpers.setEnabledPref(true); |
michael@0 | 10 | browserElementTestHelpers.addPermission(); |
michael@0 | 11 | |
michael@0 | 12 | function runTest() { |
michael@0 | 13 | var iframe = document.createElement('iframe'); |
michael@0 | 14 | SpecialPowers.wrap(iframe).mozbrowser = true; |
michael@0 | 15 | |
michael@0 | 16 | iframe.addEventListener('mozbrowseropenwindow', function(e) { |
michael@0 | 17 | ok(false, 'Not expecting an openwindow event.'); |
michael@0 | 18 | }); |
michael@0 | 19 | |
michael@0 | 20 | iframe.addEventListener('mozbrowserlocationchange', function(e) { |
michael@0 | 21 | if (/file_browserElement_TargetTop.html\?2$/.test(e.detail)) { |
michael@0 | 22 | ok(true, 'Got the locationchange we were looking for.'); |
michael@0 | 23 | SimpleTest.finish(); |
michael@0 | 24 | } |
michael@0 | 25 | }); |
michael@0 | 26 | |
michael@0 | 27 | document.body.appendChild(iframe); |
michael@0 | 28 | iframe.src = 'file_browserElement_TargetTop.html'; |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | addEventListener('testready', runTest); |