Bug 1899714 - make DLP block dialog show up again for print preview window r=dlp-reviewers,handyman

I verified that quitting while the synchronous version of the dialog is active doesn't hang, so we're not re-regressing bug 1898718.

Differential Revision: https://phabricator.services.mozilla.com/D212189
This commit is contained in:
Greg Stoll 2024-06-04 23:03:52 +00:00
parent a8c05822a6
commit dd5c341f9f

View file

@ -819,12 +819,25 @@ export const ContentAnalysis = {
} }
body = this.l10n.formatValueSync(bodyId); body = this.l10n.formatValueSync(bodyId);
} }
if (aBrowsingContext.embedderElement?.getAttribute("printpreview")) {
// If we're in a print preview window, the window itself is about to close
// (because of the thrown NS_ERROR_CONTENT_BLOCKED), so using an async
// call would just immediately make the dialog disappear. Instead, use
// a blocking version. (see bug 1899714)
Services.prompt.alertBC(
aBrowsingContext,
Ci.nsIPromptService.MODAL_TYPE_TAB,
this.l10n.formatValueSync(titleId),
body
);
} else {
await Services.prompt.asyncAlert( await Services.prompt.asyncAlert(
aBrowsingContext, aBrowsingContext,
Ci.nsIPromptService.MODAL_TYPE_TAB, Ci.nsIPromptService.MODAL_TYPE_TAB,
this.l10n.formatValueSync(titleId), this.l10n.formatValueSync(titleId),
body body
); );
}
return null; return null;
} }
case Ci.nsIContentAnalysisResponse.eUnspecified: case Ci.nsIContentAnalysisResponse.eUnspecified: