Bug 348820 - Fix followups from bug 346942. r=mconnor

This commit is contained in:
jwalden%mit.edu 2006-08-18 17:46:16 +00:00
parent a7a2cb6e16
commit bd48c1dd29
8 changed files with 108 additions and 56 deletions

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % phisheulaDTD
SYSTEM "chrome://browser/locale/preferences/fallbackEULA.dtd">
%phisheulaDTD;
]>
<html id="fallback-eula"
xmlns="http://www.w3.org/1999/xhtml">
<body>&fallback.text;</body>
</html>

View File

@ -13,6 +13,7 @@ browser.jar:
* content/browser/preferences/connection.js
* content/browser/preferences/downloadactions.xul
* content/browser/preferences/downloadactions.js
* content/browser/preferences/fallbackEULA.xhtml
* content/browser/preferences/feeds.xul
* content/browser/preferences/feeds.js
* content/browser/preferences/fonts.xul

View File

@ -1,40 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Firefox Anti-Phishing Support.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Jeff Walden <jwalden+code@mit.edu> (original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
# -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Firefox Anti-Phishing Support.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Jeff Walden <jwalden+code@mit.edu> (original author)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
/**
* gPhishDialog controls the user interface for displaying the privacy policy of
@ -64,7 +64,6 @@ var gPhishDialog = {
var providerNum = window.arguments[0].providerNum;
var phishBefore = document.getElementById("phishBefore");
var phishAfter = document.getElementById("phishAfter");
var prefb = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).
@ -73,16 +72,15 @@ var gPhishDialog = {
// init before-frame and after-frame strings
// note that description only wraps when the string is the element's
// *content* and *not* when it's the value attribute
var providerName = prefb.getCharPref(providerNum + ".name");
var providerName = prefb.getComplexValue(providerNum + ".name", Ci.nsISupportsString).data
var strings = document.getElementById("bundle_phish");
phishBefore.textContent = strings.getFormattedString("phishBefore", [providerName]);
phishAfter.textContent = strings.getFormattedString("phishAfter", [providerName]);
phishBefore.textContent = strings.getFormattedString("phishBeforeText", [providerName]);
// guaranteed to be present, because only providers with privacy policies
// are displayed in the prefwindow
var privacyURL = prefb.getComplexValue(providerNum + ".privacy.url", Ci.nsISupportsString).data;
// add progress listener to enable OK when page loads
// add progress listener to enable OK, radios when page loads
var frame = document.getElementById("phishPolicyFrame");
var webProgress = frame.docShell
.QueryInterface(Ci.nsIInterfaceRequestor)
@ -103,14 +101,35 @@ var gPhishDialog = {
*/
_progressListener:
{
/**
* True if we tried loading the first URL and encountered a failure.
*/
_loadFailed: false,
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus)
{
// enable the OK button when the request completes
const Ci = Components.interfaces, Cr = Components.results;
if ((aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)) {
// XXX check for load failure here!
document.documentElement.getButton("accept").disabled = false;
// check for failure
if (aRequest.status & 0x80000000) {
if (!this._loadFailed) {
this._loadFailed = true;
// fire off a load of the fallback policy
const loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
const fallbackURL = "chrome://browser/content/preferences/fallbackEULA.xhtml";
var frame = document.getElementById("phishPolicyFrame");
frame.webNavigation.loadURI(fallbackURL, loadFlags, null, null, null);
// disable radios
document.getElementById("acceptOrDecline").disabled = true;
}
else {
throw "Fallback policy failed to load -- what the hay!?!";
}
}
}
},
@ -153,5 +172,14 @@ var gPhishDialog = {
// overly aggressive, but better safe than sorry
this._webProgress.removeProgressListener(this._progressListener);
this._progressListener = this._webProgress = null;
},
/**
* Called when the user changes the agree/disagree radio.
*/
onchangeRadio: function ()
{
var radio = document.getElementById("acceptOrDecline");
document.documentElement.getButton("accept").disabled = (radio.value == "false");
}
};

View File

@ -44,8 +44,8 @@
<dialog id="phishDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&phishDialog.title;"
style="width: &phishDialog.width;; height: &phishDialog.height;;"
title="&phishDlg.title;"
style="width: &phishDlg.width;; height: &phishDlg.height;;"
persist="screenX screenY width height"
onload="gPhishDialog.init();"
onunload="gPhishDialog.uninit();"
@ -69,7 +69,11 @@
<separator class="thin"/>
<description id="phishAfter"/>
<radiogroup id="acceptOrDecline"
oncommand="gPhishDialog.onchangeRadio();">
<radio value="true" label="&acceptToS.label;"/>
<radio value="false" selected="true" label="&declineToS.label;"/>
</radiogroup>
<separator class="thin"/>

View File

@ -0,0 +1 @@
<!ENTITY fallback.text "<p>The privacy agreement failed to load.</p>">

View File

@ -1,4 +1,4 @@
<!ENTITY phishDialog.title "Phishing Protection Privacy Agreement">
<!ENTITY phishDlg.title "Phishing Protection Terms of Service">
<!-- LOCALIZATION NOTE:
The following entities contain sizing information for the phishing privacy
@ -7,8 +7,11 @@
already agreed with the policy for that provider; once you agree to a
provider's policy, you don't see it again).
-->
<!ENTITY phishDialog.height "35em">
<!ENTITY phishDialog.width "35em">
<!ENTITY phishDlg.height "40em">
<!ENTITY phishDlg.width "35em">
<!ENTITY acceptToS.label "I accept these Phishing Protection terms of service">
<!ENTITY declineToS.label "I do NOT accept these Phishing Protection terms of service">
<!ENTITY accept.label "Accept and Continue">
<!ENTITY cancel.label "Cancel">

View File

@ -16,12 +16,10 @@ addReader=Add New Reader...
#### Security
# LOCALIZATION NOTE: phishBefore and phishAfter use %S to represent the name of
# the provider whose privacy policy must be accepted (for
# enabling check-every-page-as-I-load-it phishing
# protection).
phishBefore=Selecting this option will send the address of web pages you are viewing to %S. To continue, please review the following privacy agreement:
phishAfter=Do you want to accept this privacy agreement and ask %S about each site you visit?
# LOCALIZATION NOTE: phishBefore uses %S to represent the name of the provider
# whose privacy policy must be accepted (for enabling
# check-every-page-as-I-load-it phishing protection).
phishBeforeText=Selecting this option will send the address of web pages you are viewing to %S. To continue, please review and accept the following terms of service.
setMasterPassword=Set Master Password...
setMasterPassword_accesskey=M

View File

@ -61,6 +61,7 @@
locale/browser/preferences/content.dtd (%chrome/browser/preferences/content.dtd)
locale/browser/preferences/connection.dtd (%chrome/browser/preferences/connection.dtd)
locale/browser/preferences/downloadactions.dtd (%chrome/browser/preferences/downloadactions.dtd)
locale/browser/preferences/fallbackEULA.dtd (%chrome/browser/preferences/fallbackEULA.dtd)
locale/browser/preferences/feeds.dtd (%chrome/browser/preferences/feeds.dtd)
locale/browser/preferences/fonts.dtd (%chrome/browser/preferences/fonts.dtd)
locale/browser/preferences/main.dtd (%chrome/browser/preferences/main.dtd)