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);
}
await Services.prompt.asyncAlert(
aBrowsingContext,
Ci.nsIPromptService.MODAL_TYPE_TAB,
this.l10n.formatValueSync(titleId),
body
);
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(
aBrowsingContext,
Ci.nsIPromptService.MODAL_TYPE_TAB,
this.l10n.formatValueSync(titleId),
body
);
}
return null;
}
case Ci.nsIContentAnalysisResponse.eUnspecified: