fune/dom/geolocation/GeolocationUIUtilsWin.sys.mjs
David Parks d7a066ab36 Bug 1900225: Part 1 - Add dismissPrompts to Windows geolocation UI utils r=Gijs a=RyanVM
Will be used later in this series to remove a cancel dialog that is presented
over a tab while Gecko waits for the user to grant geolocation permission in the
OS.

Differential Revision: https://phabricator.services.mozilla.com/D217015
2024-08-27 22:47:31 +00:00

26 lines
900 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Implements nsIGeolocationUIUtilsWin
*
* @class GeolocationUIUtilsWin
*/
export class GeolocationUIUtilsWin {
dismissPrompts(aBrowsingContext) {
// browser will be null if the tab was closed
let embedder = aBrowsingContext?.top.embedderElement;
let owner = embedder?.ownerGlobal;
if (owner) {
let dialogBox = owner.gBrowser.getTabDialogBox(embedder);
// Don't close any content-modal dialogs, because we could be doing
// content analysis on something like a prompt() call.
dialogBox.getTabDialogManager().abortDialogs();
}
}
}
GeolocationUIUtilsWin.prototype.QueryInterface = ChromeUtils.generateQI([
"nsIGeolocationUIUtilsWin",
]);