tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_popupNotification_hide_after_identity_panel.js (1405B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 add_setup(async function () {
      6  await SpecialPowers.pushPrefEnv({
      7    set: [["browser.urlbar.trustPanel.featureGate", false]],
      8  });
      9 });
     10 
     11 add_task(async function test_displayURI_geo() {
     12  await BrowserTestUtils.withNewTab(
     13    "https://test1.example.com/",
     14    async function (browser) {
     15      let popupShownPromise = waitForNotificationPanel();
     16      await SpecialPowers.spawn(browser, [], async function () {
     17        content.navigator.geolocation.getCurrentPosition(() => {});
     18      });
     19      await popupShownPromise;
     20 
     21      popupShownPromise = BrowserTestUtils.waitForEvent(
     22        window,
     23        "popupshown",
     24        true,
     25        event => event.target == gIdentityHandler._identityPopup
     26      );
     27      EventUtils.synthesizeMouseAtCenter(gIdentityHandler._identityIconBox, {});
     28      await popupShownPromise;
     29 
     30      Assert.ok(!PopupNotifications.isPanelOpen, "Geolocation popup is hidden");
     31 
     32      let popupHidden = BrowserTestUtils.waitForEvent(
     33        gIdentityHandler._identityPopup,
     34        "popuphidden"
     35      );
     36      gIdentityHandler._identityPopup.hidePopup();
     37      await popupHidden;
     38 
     39      Assert.ok(PopupNotifications.isPanelOpen, "Geolocation popup is showing");
     40    }
     41  );
     42 });