Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | |
michael@0 | 3 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 4 | - http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 5 | |
michael@0 | 6 | <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
michael@0 | 7 | <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
michael@0 | 8 | |
michael@0 | 9 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | title="Mozilla Bug 771294"> |
michael@0 | 11 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 12 | <script type="application/javascript" src="head.js"/> |
michael@0 | 13 | <!-- test results are displayed in the html:body --> |
michael@0 | 14 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 15 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=771294" |
michael@0 | 16 | target="_blank">Mozilla Bug 771294</a> |
michael@0 | 17 | </body> |
michael@0 | 18 | |
michael@0 | 19 | <script> |
michael@0 | 20 | const Ci = Components.interfaces; |
michael@0 | 21 | const Cu = Components.utils; |
michael@0 | 22 | |
michael@0 | 23 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 24 | |
michael@0 | 25 | SpecialPowers.setAllAppsLaunchable(true); |
michael@0 | 26 | |
michael@0 | 27 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 28 | Cu.import("resource://gre/modules/PopupNotifications.jsm"); |
michael@0 | 29 | |
michael@0 | 30 | let blocked = true; |
michael@0 | 31 | |
michael@0 | 32 | function blockedListener() { |
michael@0 | 33 | blocked = false; |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | let panel = window.top.QueryInterface(Ci.nsIInterfaceRequestor) |
michael@0 | 37 | .getInterface(Ci.nsIWebNavigation) |
michael@0 | 38 | .QueryInterface(Ci.nsIDocShell) |
michael@0 | 39 | .chromeEventHandler.ownerDocument.defaultView |
michael@0 | 40 | .PopupNotifications.panel; |
michael@0 | 41 | |
michael@0 | 42 | panel.addEventListener("popupshowing", blockedListener, false); |
michael@0 | 43 | |
michael@0 | 44 | Services.obs.addObserver( |
michael@0 | 45 | function observeInstalling() { |
michael@0 | 46 | Services.obs.removeObserver(observeInstalling, "webapps-ask-install"); |
michael@0 | 47 | // Spin the event loop before running the test to give the registry time |
michael@0 | 48 | // to process the install request and (hopefully not) show the doorhanger. |
michael@0 | 49 | setTimeout(function verify() { |
michael@0 | 50 | ok(blocked, "Install panel was blocked after immediate redirect"); |
michael@0 | 51 | panel.removeEventListener("popupshowing", blockedListener); |
michael@0 | 52 | SimpleTest.finish(); |
michael@0 | 53 | }, 0); |
michael@0 | 54 | }, |
michael@0 | 55 | "webapps-ask-install", |
michael@0 | 56 | false |
michael@0 | 57 | ); |
michael@0 | 58 | |
michael@0 | 59 | </script> |
michael@0 | 60 | |
michael@0 | 61 | <!-- Load a page that initiates an app installation and then immediately |
michael@0 | 62 | - redirects to a page at a different origin. We can't do this directly |
michael@0 | 63 | - inside this test page, because that would cause the test to hang. --> |
michael@0 | 64 | <iframe src="http://test/chrome/dom/tests/mochitest/webapps/install_and_redirect_helper.xul"/> |
michael@0 | 65 | |
michael@0 | 66 | </window> |