bug 405862 - Override netErrorApp.dtd to let users add cert exceptions from the error page, r=Neil sr=jag

This commit is contained in:
kairo%kairo.at 2007-12-16 16:27:29 +00:00
Родитель 7ab528f5fd
Коммит a8e96a4df1
4 изменённых файлов: 63 добавлений и 1 удалений

Просмотреть файл

@ -350,7 +350,11 @@
onnewtab="BrowserOpenTab();"
autocompletepopup="PopupAutoComplete"
onbookmarkgroup="addGroupmarkAs();"
onclick="return contentAreaClick(event);"/>
onclick="return contentAreaClick(event);"
oncommand="BrowserOnCommand(event);"/>
<!-- The oncommand listener above lets us fix bugs like 401575 which
require error page UI to do privileged things, without letting
error pages have any privilege themselves. -->
</hbox>
</vbox>
</hbox>

Просмотреть файл

@ -616,3 +616,42 @@ function validateFileName(aFileName)
return aFileName.replace(re, "_");
}
/**
* Handle command events bubbling up from error page content
* called from oncommand by <browser>s that support error pages
*/
function BrowserOnCommand(event)
{
// Don't trust synthetic events
if (!event.isTrusted)
return;
const ot = event.originalTarget;
const ownerDoc = ot.ownerDocument;
// If the event came from an ssl error page, it is probably either the "Add
// Exception" or "Get Me Out Of Here" button
if (/^about:neterror\?e=nssBadCert/.test(ownerDoc.documentURI)) {
if (ot.id == 'exceptionDialogButton') {
var params = { location : ownerDoc.location.href,
exceptionAdded : false };
window.openDialog('chrome://pippki/content/exceptionDialog.xul',
'', 'chrome,centerscreen,modal', params);
// If the user added the exception cert, attempt to reload the page
if (params.exceptionAdded)
ownerDoc.location.reload();
}
else if (ot.id == 'getMeOutOfHereButton') {
// Redirect them to a known-functioning page, default start page
var url = "about:blank";
try {
url = pref.getComplexValue("browser.startup.homepage",
Components.interfaces.nsIPrefLocalizedString).data;
} catch(e) {
Components.utils.reportError("Couldn't get homepage pref: " + e);
}
content.location = url;
}
}
}

Просмотреть файл

@ -0,0 +1,17 @@
<!-- Override app-specific error messages for SeaMonkey -->
<!ENTITY securityOverride.linkText "Or you can add an exception...">
<!ENTITY securityOverride.getMeOutOfHereButton "This sounds bad, take me to my home page instead">
<!ENTITY securityOverride.exceptionButtonLabel "Add Exception">
<!-- LOCALIZATION NOTE (securityOverride.warningText) - Do not translate the
contents of the <xul:button> tags. The only language content is the label= field,
which uses strings already defined above. The button is included here (instead of
netError.xhtml) because it exposes functionality specific to SeaMonkey. -->
<!ENTITY securityOverride.warningText "
<p>You should not add an exception if you are using an internet connection that you do not trust completely, or if you are not used to seeing a warning for this server.</p>
<xul:button xmlns:xul='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' id='getMeOutOfHereButton' label='&securityOverride.getMeOutOfHereButton;'/>
<xul:button xmlns:xul='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' id='exceptionDialogButton' label='&securityOverride.exceptionButtonLabel;'/>
">

Просмотреть файл

@ -3,6 +3,7 @@
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/@AB_CD@/branding/
% locale communicator @AB_CD@ %locale/@AB_CD@/communicator/
% override chrome://global/locale/netErrorApp.dtd chrome://communicator/locale/overrides/netErrorApp.dtd
% locale communicator-platform @AB_CD@ %locale/@AB_CD@/communicator-platform/
% locale communicator-region @AB_CD@ %locale/@AB_CD@/communicator-region/
% locale messenger @AB_CD@ %locale/@AB_CD@/messenger/
@ -122,6 +123,7 @@
locale/@AB_CD@/communicator/history/findHistory.dtd (%chrome/common/history/findHistory.dtd)
locale/@AB_CD@/communicator/migration/migration.dtd (%chrome/common/migration/migration.dtd)
locale/@AB_CD@/communicator/migration/migration.properties (%chrome/common/migration/migration.properties)
locale/@AB_CD@/communicator/overrides/netErrorApp.dtd (%chrome/common/overrides/netErrorApp.dtd)
locale/@AB_CD@/communicator/permissions/aboutPopups.dtd (%chrome/common/permissions/aboutPopups.dtd)
locale/@AB_CD@/communicator/permissions/cookieViewer.properties (%chrome/common/permissions/cookieViewer.properties)
locale/@AB_CD@/communicator/permissions/cookieViewer.dtd (%chrome/common/permissions/cookieViewer.dtd)