зеркало из https://github.com/mozilla/pjs.git
Fennec should implement firefox-style security error ui. b=437372 r=enndeakin
This commit is contained in:
Родитель
565c8a0003
Коммит
a9bd2bec22
|
@ -161,6 +161,9 @@ pref("accessibility.typeaheadfind.casesensitive", 0);
|
|||
|
||||
// pointer to the default engine name
|
||||
pref("browser.search.defaultenginename", "chrome://browser/locale/region.properties");
|
||||
// SSL error page behaviour
|
||||
pref("browser.ssl_override_behavior", 2);
|
||||
pref("browser.xul.error_pages.expert_bad_cert", false);
|
||||
|
||||
// disable logging for the search service by default
|
||||
pref("browser.search.log", false);
|
||||
|
|
|
@ -96,6 +96,7 @@ var Browser = {
|
|||
|
||||
BrowserUI.init();
|
||||
|
||||
this._content.addEventListener("command", this._handleContentCommand, false);
|
||||
this._content.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
|
||||
this._content.tabList = document.getElementById("tab-list");
|
||||
this._content.newTab(true);
|
||||
|
@ -289,6 +290,61 @@ var Browser = {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Handle command event bubbling up from content. This allows us to do chrome-
|
||||
* privileged things based on buttons in, e.g., unprivileged error pages.
|
||||
* Obviously, care should be taken not to trust events that web pages could have
|
||||
* synthesized.
|
||||
*/
|
||||
_handleContentCommand: function (aEvent) {
|
||||
// Don't trust synthetic events
|
||||
if (!aEvent.isTrusted)
|
||||
return;
|
||||
|
||||
var ot = aEvent.originalTarget;
|
||||
var errorDoc = 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(errorDoc.documentURI)) {
|
||||
if (ot == errorDoc.getElementById('exceptionDialogButton')) {
|
||||
var params = { exceptionAdded : false };
|
||||
|
||||
try {
|
||||
switch (gPrefService.getIntPref("browser.ssl_override_behavior")) {
|
||||
case 2 : // Pre-fetch & pre-populate
|
||||
params.prefetchCert = true;
|
||||
case 1 : // Pre-populate
|
||||
params.location = errorDoc.location.href;
|
||||
}
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Couldn't get ssl_override pref: " + e);
|
||||
}
|
||||
|
||||
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)
|
||||
errorDoc.location.reload();
|
||||
}
|
||||
else if (ot == errorDoc.getElementById('getMeOutOfHereButton')) {
|
||||
// Get the start page from the *default* pref branch, not the user's
|
||||
var defaultPrefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefService).getDefaultBranch(null);
|
||||
var url = "about:blank";
|
||||
try {
|
||||
url = defaultPrefs.getCharPref("browser.startup.homepage");
|
||||
// If url is a pipe-delimited set of pages, just take the first one.
|
||||
if (url.indexOf("|") != -1)
|
||||
url = url.split("|")[0];
|
||||
} catch (e) { /* Fall back on about blank */ }
|
||||
|
||||
Browser.currentBrowser.loadURI(url, null, null, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -42,3 +42,6 @@ classic.jar:
|
|||
browser.properties (locale/@AB_CD@/browser.properties)
|
||||
search.properties (locale/@AB_CD@/search.properties)
|
||||
region.properties (locale/@AB_CD@/region.properties)
|
||||
# Fennec-specific overrides of generic strings
|
||||
* netError.dtd (locale/@AB_CD@/overrides/netError.dtd)
|
||||
% override chrome://global/locale/netErrorApp.dtd chrome://browser/locale/netError.dtd
|
||||
|
|
|
@ -0,0 +1,180 @@
|
|||
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
|
||||
%brandDTD;
|
||||
|
||||
<!ENTITY loadError.label "Problem loading page">
|
||||
<!ENTITY retry.label "Try Again">
|
||||
|
||||
<!-- Specific error messages -->
|
||||
|
||||
<!ENTITY connectionFailure.title "Unable to connect">
|
||||
<!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
|
||||
|
||||
<!ENTITY deniedPortAccess.title "This address is restricted">
|
||||
<!ENTITY deniedPortAccess.longDesc "">
|
||||
|
||||
<!ENTITY dnsNotFound.title "Server not found">
|
||||
<!ENTITY dnsNotFound.longDesc "
|
||||
<ul>
|
||||
<li>Check the address for typing errors such as
|
||||
<strong>ww</strong>.example.com instead of
|
||||
<strong>www</strong>.example.com</li>
|
||||
<li>If you are unable to load any pages, check your computer's network
|
||||
connection.</li>
|
||||
<li>If your computer or network is protected by a firewall or proxy, make sure
|
||||
that &brandShortName; is permitted to access the Web.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY fileNotFound.title "File not found">
|
||||
<!ENTITY fileNotFound.longDesc "
|
||||
<ul>
|
||||
<li>Check the file name for capitalization or other typing errors.</li>
|
||||
<li>Check to see if the file was moved, renamed or deleted.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
|
||||
<!ENTITY generic.title "Oops.">
|
||||
<!ENTITY generic.longDesc "
|
||||
<p>&brandShortName; can't load this page for some reason.</p>
|
||||
">
|
||||
|
||||
<!ENTITY malformedURI.title "The address isn't valid">
|
||||
<!ENTITY malformedURI.longDesc "
|
||||
<ul>
|
||||
<li>Web addresses are usually written like
|
||||
<strong>http://www.example.com/</strong></li>
|
||||
<li>Make sure that you're using forward slashes (i.e.
|
||||
<strong>/</strong>).</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY netInterrupt.title "The connection was interrupted">
|
||||
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
|
||||
|
||||
<!ENTITY netOffline.title "Offline mode">
|
||||
<!ENTITY netOffline.longDesc "
|
||||
<ul>
|
||||
<li>Uncheck "Work Offline" in the File menu, then try again.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY contentEncodingError.title "Content Encoding Error">
|
||||
<!ENTITY contentEncodingError.longDesc "
|
||||
<ul>
|
||||
<li>Please contact the website owners to inform them of this problem.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY unsafeContentType.title "Unsafe File Type">
|
||||
<!ENTITY unsafeContentType.longDesc "
|
||||
<ul>
|
||||
<li>Please contact the website owners to inform them of this problem.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY netReset.title "The connection was reset">
|
||||
<!ENTITY netReset.longDesc "&sharedLongDesc;">
|
||||
|
||||
<!ENTITY netTimeout.title "The connection has timed out">
|
||||
<!ENTITY netTimeout.longDesc "&sharedLongDesc;">
|
||||
|
||||
<!ENTITY protocolNotFound.title "The address wasn't understood">
|
||||
<!ENTITY protocolNotFound.longDesc "
|
||||
<ul>
|
||||
<li>You might need to install other software to open this address.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
|
||||
<!ENTITY proxyConnectFailure.longDesc "
|
||||
<ul>
|
||||
<li>Check the proxy settings to make sure that they are correct.</li>
|
||||
<li>Contact your network administrator to make sure the proxy server is
|
||||
working.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
|
||||
<!ENTITY proxyResolveFailure.longDesc "
|
||||
<ul>
|
||||
<li>Check the proxy settings to make sure that they are correct.</li>
|
||||
<li>Check to make sure your computer has a working network connection.</li>
|
||||
<li>If your computer or network is protected by a firewall or proxy, make sure
|
||||
that &brandShortName; is permitted to access the Web.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY redirectLoop.title "The page isn't redirecting properly">
|
||||
<!ENTITY redirectLoop.longDesc "
|
||||
<ul>
|
||||
<li>This problem can sometimes be caused by disabling or refusing to accept
|
||||
cookies.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY unknownSocketType.title "Unexpected response from server">
|
||||
<!ENTITY unknownSocketType.longDesc "
|
||||
<ul>
|
||||
<li>Check to make sure your system has the Personal Security Manager
|
||||
installed.</li>
|
||||
<li>This might be due to a non-standard configuration on the server.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY nssFailure2.title "Secure Connection Failed">
|
||||
<!ENTITY nssFailure2.longDesc "
|
||||
<ul>
|
||||
<li>The page you are trying to view can not be shown because the authenticity of the received data could not be verified.</li>
|
||||
<li>Please contact the web site owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY nssBadCert.title "Secure Connection Failed">
|
||||
<!ENTITY nssBadCert.longDesc2 "
|
||||
<ul>
|
||||
<li>This could be a problem with the server's configuration, or it could be
|
||||
someone trying to impersonate the server.</li>
|
||||
<li>If you have connected to this server successfully in the past, the error may
|
||||
be temporary, and you can try again later.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY sharedLongDesc "
|
||||
<ul>
|
||||
<li>The site could be temporarily unavailable or too busy. Try again in a few
|
||||
moments.</li>
|
||||
<li>If you are unable to load any pages, check your computer's network
|
||||
connection.</li>
|
||||
<li>If your computer or network is protected by a firewall or proxy, make sure
|
||||
that &brandShortName; is permitted to access the Web.</li>
|
||||
</ul>
|
||||
">
|
||||
|
||||
<!ENTITY malwareBlocked.title "Suspected Attack Site!">
|
||||
<!ENTITY malwareBlocked.longDesc "
|
||||
<p>Attack sites try to install programs that steal private information, use your computer to attack others, or damage your system.</p>
|
||||
<p>Web site owners who believe their site has been reported as an attack site in error may <a href='http://www.stopbadware.org/home/reviewinfo' >request a review</a>.</p>
|
||||
">
|
||||
|
||||
<!ENTITY phishingBlocked.title "Suspected Web Forgery!">
|
||||
<!ENTITY phishingBlocked.longDesc "
|
||||
<p>Entering any personal information on this page may result in identity theft or other fraud.</p>
|
||||
<p>These types of web forgeries are used in scams known as phishing attacks, in which fraudulent web pages and emails are used to imitate sources you may trust.</p>
|
||||
">
|
||||
|
||||
<!ENTITY securityOverride.linkText "Or you can add an exception…">
|
||||
<!ENTITY securityOverride.getMeOutOfHereButton "Get me out of here!">
|
||||
<!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 firefox. -->
|
||||
|
||||
<!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;'/>
|
||||
">
|
Загрузка…
Ссылка в новой задаче