Bug 1553265 - add a document.addCertException function to about:certerror pages and use it there; also treat GeckoView error pages as CallerIsTrusted(Net|Cert)Error; r=snorp,johannh,baku

Add a document.addCertException function to about:certerror pages, and use it on the desktop certerror page.

Also, as the CallerIsTrusted* functions expect URLs like about:certerror, but GeckoView error pages are data URLs, and so need to be handled differently for these special error-page methods to be exposed on their documents.

Example usage of document.addCertException:
  document.addCertException(
    true|false /* true == temporary, false == permanent */
  ).then(
    () => {
      location.reload();
    },
    err => {
      console.error(err);
    }
  );

Differential Revision: https://phabricator.services.mozilla.com/D56974
This commit is contained in:
Thomas Wisniewski
2019-12-17 21:54:32 +00:00
parent 5f59e93dd3
commit 1b8a36fc99
11 changed files with 245 additions and 45 deletions

View File

@@ -511,7 +511,15 @@ function initPageCertError() {
}
function addCertException() {
RPMSendAsyncMessage("AddCertException", { location: document.location.href });
const isPermanent =
!RPMIsWindowPrivate() &&
RPMGetBoolPref("security.certerrors.permanentOverride");
document.addCertException(!isPermanent).then(
() => {
location.reload();
},
err => {}
);
}
function onReturnButtonClick(e) {