} const clientAuthAskURI = "chrome://pippki/content/clientauthask.xhtml"; let retVals = { cert: null, rememberDuration: Ci.nsIClientAuthRememberService.Session, }; let args = lazy.PromptUtils.objectToPropBag({ hostname, certArray, retVals, }); // First attempt to find a TabDialogBox for the loadContext. This allows // for a tab-modal dialog specific to the tab causing the load, which is a // better user experience. let tabDialogBox = getTabDialogBoxForLoadContext(loadContext); if (tabDialogBox) { tabDialogBox.open(clientAuthAskURI, {}, args).closedPromise.then(() => { callback.certificateChosen(retVals.cert, retVals.rememberDuration); }); return; } // Otherwise, attempt to open a window-modal dialog on the window that at // least has the tab the load is occurring in. let browserWindow = loadContext?.topFrameElement?.ownerGlobal; // Failing that, open a window-modal dialog on the most recent window. if (!browserWindow?.gDialogBox) { browserWindow = Services.wm.getMostRecentBrowserWindow(); } if (browserWindow?.gDialogBox) { browserWindow.gDialogBox.open(clientAuthAskURI, args).then(() => { callback.certificateChosen(retVals.cert, retVals.rememberDuration); }); return; } let mostRecentWindow = Services.wm.getMostRecentWindow(""); Services.ww.openWindow( mostRecentWindow, clientAuthAskURI, "_blank", "centerscreen,chrome,modal,titlebar", args ); callback.certificateChosen(retVals.cert, retVals.rememberDuration); }, }; PK