bug 349068 - add first run EULA display option for redistributions, r=gavin

This commit is contained in:
mconnor%steelgryphon.com 2006-09-13 07:55:52 +00:00
Родитель a65f73b7e4
Коммит 9d6fee9566
6 изменённых файлов: 318 добавлений и 0 удалений

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

@ -524,3 +524,11 @@ pref("browser.safebrowsing.provider.0.reportPhishURL", "http://{moz:locale}.phis
// FAQ URL
pref("browser.safebrowsing.warning.infoURL", "http://%LOCALE%.www.mozilla.com/%LOCALE%/firefox/phishing-protection/");
#endif
// defaults to true
pref("browser.EULA.2.accepted", true);
// if we rev the EULA again, we should bump this so users agree to the new EULA
pref("browser.EULA.version", 2);

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

@ -0,0 +1,170 @@
# -*- 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)
# Mike Connor <mconnor@mozilla.com> (modified for app-level EULA)
#
# 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 *****
var gEULADialog = {
/**
* The nsIWebProgress object associated with the privacy policy frame.
*/
_webProgress: null,
/**
* Initializes UI and starts the privacy policy loading.
*/
init: function ()
{
sizeToContent();
const Cc = Components.classes, Ci = Components.interfaces;
// add progress listener to enable OK, radios when page loads
var frame = document.getElementById("EULATextFrame");
var webProgress = frame.docShell
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
webProgress.addProgressListener(this._progressListener,
Ci.nsIWebProgress.NOTIFY_STATE_WINDOW);
this._webProgress = webProgress; // for easy use later
var eulaURL = "chrome://browser/content/EULA.xhtml";
// start loading the privacyURL
const loadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
frame.webNavigation.loadURI(eulaURL, loadFlags, null, null, null);
},
/**
* The nsIWebProgressListener used to watch the status of the load of the
* privacy policy; enables the OK button when the load completes.
*/
_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)) {
// check for failure
if (!Components.isSuccessCode(aRequest.status)) {
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("EULATextFrame");
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!?!";
}
}
}
},
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress,
aMaxSelfProgress, aCurTotalProgress,
aMaxTotalProgress)
{
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
},
QueryInterface : function(aIID)
{
const Ci = Components.interfaces;
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
}
},
/**
* Make sure we set the pref on acceptance so we don't show the EULA again
*/
accept: function ()
{
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var EULAVersion = prefService.getIntPref("browser.EULA.version");
prefService.setBoolPref("browser.EULA." + EULAVersion + ".accepted", true);
},
/**
* If the user did not accept the EULA, kill the app.
*/
cancel: function ()
{
const appStartup = Components.classes['@mozilla.org/toolkit/app-startup;1']
.getService(Components.interfaces.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit);
},
/**
* Clean up any XPCOM-JS cycles we may have created.
*/
uninit: function ()
{
// 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");
}
};

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

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" id="eula" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT</title>
</head>
<body>
<p>MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT<br/>
Version 2.0</p>
<p>A SOURCE CODE VERSION OF CERTAIN FIREFOX BROWSER FUNCTIONALITY THAT YOU MAY USE, MODIFY AND DISTRIBUTE IS AVAILABLE TO YOU FREE-OF-CHARGE FROM WWW.MOZILLA.ORG UNDER THE MOZILLA PUBLIC LICENSE and other open source software licenses.</p>
<p>The accompanying executable code version of Mozilla Firefox and related documentation (the “Product”) is made available to you under the terms of this MOZILLA FIREFOX END-USER SOFTWARE LICENSE AGREEMENT (THE “AGREEMENT”). BY CLICKING THE “ACCEPT” BUTTON, OR BY INSTALLING OR USING THE MOZILLA FIREFOX BROWSER, YOU ARE CONSENTING TO BE BOUND BY THE AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT, DO NOT CLICK THE “ACCEPT” BUTTON, AND DO NOT INSTALL OR USE ANY PART OF THE MOZILLA FIREFOX BROWSER.</p>
<p>DURING THE MOZILLA FIREFOX INSTALLATION PROCESS, AND AT LATER TIMES, YOU MAY BE GIVEN THE OPTION OF INSTALLING ADDITIONAL COMPONENTS FROM THIRD-PARTY SOFTWARE PROVIDERS. THE INSTALLATION AND USE OF THOSE THIRD-PARTY COMPONENTS MAY BE GOVERNED BY ADDITIONAL LICENSE AGREEMENTS.</p>
<p>1. LICENSE GRANT. The Mozilla Corporation grants you a non-exclusive license to use the executable code version of the Product. This Agreement will also govern any software upgrades provided by Mozilla that replace and/or supplement the original Product, unless such upgrades are accompanied by a separate license, in which case the terms of that license will govern.</p>
<p>2. TERMINATION. If you breach this Agreement your right to use the Product will terminate immediately and without notice, but all provisions of this Agreement except the License Grant (Paragraph 1) will survive termination and continue in effect. Upon termination, you must destroy all copies of the Product.</p>
<p>3. PROPRIETARY RIGHTS. Portions of the Product are available in source code form under the terms of the Mozilla Public License and other open source licenses (collectively, “Open Source Licenses”) at http://mozilla.org. Nothing in this Agreement will be construed to limit any rights granted under the Open Source Licenses. Subject to the foregoing, Mozilla, for itself and on behalf of its licensors, hereby reserves all intellectual property rights in the Product, except for the rights expressly granted in this Agreement. You may not remove or alter any trademark, logo, copyright or other proprietary notice in or on the Product. This license does not grant you any right to use the trademarks, service marks or logos of Mozilla or its licensors.</p>
<p>4. PRIVACY POLICY. You agree to the Mozilla Firefox Privacy Policy, made available online at http://www.mozilla.com/firefox/privacy/, as that policy may be changed from time to time. When Mozilla changes the policy in a material way a notice will be posted on the website at www.mozilla.com and when any change is made in the privacy policy, the updated policy will be posted at the above link. It is your responsibility to ensure that you understand the terms of the privacy policy, so you should periodically check the current version of the policy for changes.</p>
<p>5. DISCLAIMER OF WARRANTY. THE PRODUCT IS PROVIDED “AS IS” WITH ALL FAULTS. TO THE EXTENT PERMITTED BY LAW, MOZILLA AND MOZILLAS DISTRIBUTORS, AND LICENSORS HEREBY DISCLAIM ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES THAT THE PRODUCT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE AND NON-INFRINGING. YOU BEAR THE ENTIRE RISK AS TO SELECTING THE PRODUCT FOR YOUR PURPOSES AND AS TO THE QUALITY AND PERFORMANCE OF THE PRODUCT. THIS LIMITATION WILL APPLY NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF IMPLIED WARRANTIES, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.</p>
<p>6. LIMITATION OF LIABILITY. EXCEPT AS REQUIRED BY LAW, MOZILLA AND ITS DISTRIBUTORS, DIRECTORS, LICENSORS, CONTRIBUTORS AND AGENTS (COLLECTIVELY, THE “MOZILLA GROUP”) WILL NOT BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES ARISING OUT OF OR IN ANY WAY RELATING TO THIS AGREEMENT OR THE USE OF OR INABILITY TO USE THE PRODUCT, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, LOST PROFITS, LOSS OF DATA, AND COMPUTER FAILURE OR MALFUNCTION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH SUCH CLAIM IS BASED. THE MOZILLA GROUPS COLLECTIVE LIABILITY UNDER THIS AGREEMENT WILL NOT EXCEED THE GREATER OF $500 (FIVE HUNDRED DOLLARS) AND THE FEES PAID BY YOU UNDER THE LICENSE (IF ANY). SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL, CONSEQUENTIAL OR SPECIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.</p>
<p>7. EXPORT CONTROLS. This license is subject to all applicable export restrictions. You must comply with all export and import laws and restrictions and regulations of any United States or foreign agency or authority relating to the Product and its use.</p>
<p>8. U.S. GOVERNMENT END-USERS. This Product is a “commercial item,” as that term is defined in 48 C.F.R. 2.101, consisting of “commercial computer software” and “commercial computer software documentation,” as such terms are used in 48 C.F.R. 12.212 (Sept. 1995) and 48 C.F.R. 227.7202 (June 1995). Consistent with 48 C.F.R. 12.212, 48 C.F.R. 27.405(b)(2) (June 1998) and 48 C.F.R. 227.7202, all U.S. Government End Users acquire the Product with only those rights as set forth therein.</p>
<p>9. MISCELLANEOUS. (a) This Agreement constitutes the entire agreement between Mozilla and you concerning the subject matter hereof, and it may only be modified by a written amendment signed by an authorized executive of Mozilla. (b) Except to the extent applicable law, if any, provides otherwise, this Agreement will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. (c) This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods. (d) If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties original intent, and the remaining portions will remain in full force and effect. (e) A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. (f) Except as required by law, the controlling language of this Agreement is English. (g) You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms; the Mozilla Corporation may assign its rights under this Agreement without condition. (h) This Agreement will be binding upon and inure to the benefit of the parties, their successors and permitted assigns.</p>
</body>
</html>

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

@ -0,0 +1,82 @@
<?xml version="1.0"?>
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
# ***** 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 the Firefox Preferences System.
#
# 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+bmo@mit.edu> (original author)
# Mike Connor <mconnor@mozilla.com> (tweak to
#
# 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 *****
<?xml-stylesheet href="chrome://global/skin/"?>
<!DOCTYPE dialog [
<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/update/updates.dtd">
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%updateDTD;
%brandDTD;
]>
<dialog id="eulaDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&license.titleText;"
onload="gEULADialog.init();"
ondialogaccept="gEULADialog.accept()"
ondialogcancel="gEULADialog.cancel()"
buttondisabledaccept="true">
<script type="application/javascript"
src="chrome://browser/content/EULA.js"/>
<description>&license.introText;</description>
<separator class="thin"/>
<description>&license.instructionText;</description>
<vbox id="EULAText" flex="1">
<iframe style="min-height: 30em; min-width: 105ex" id="EULATextFrame" type="content" flex="1" src=""/>
</vbox>
<separator class="thin"/>
<radiogroup id="acceptOrDecline"
oncommand="gEULADialog.onChangeRadio();">
<radio value="true" label="&license.accept;" accesskey="&license.accept.accesskey;"/>
<radio value="false" selected="true" label="&license.decline;" accesskey="&license.decline.accesskey;"/>
</radiogroup>
<separator class="thin"/>
</dialog>

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

@ -16,6 +16,9 @@ browser.jar:
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
* content/browser/credits.xhtml (content/credits.xhtml)
* content/browser/EULA.js (content/EULA.js)
* content/browser/EULA.xhtml (content/EULA.xhtml)
* content/browser/EULA.xul (content/EULA.xul)
* content/browser/metaData.js (content/metaData.js)
* content/browser/metaData.xul (content/metaData.xul)
content/browser/monitor.png (content/monitor.png)

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

@ -100,6 +100,23 @@ BrowserGlue.prototype = {
// profile startup handler (contains profile initialization routines)
_onProfileStartup: function()
{
// check to see if the EULA must be shown on startup
try {
var mustDisplayEULA = true;
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var EULAVersion = prefService.getIntPref("browser.EULA.version");
mustDisplayEULA = !prefService.getBoolPref("browser.EULA." + EULAVersion + ".accepted");
} catch(ex) {
}
if (mustDisplayEULA) {
var ww2 = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
ww2.openWindow(null, "chrome://browser/content/EULA.xul",
"_blank", "chrome,centerscreen,modal,resizable=yes", null);
}
this.Sanitizer.onStartup();
// check if we're in safe mode
var app = Components.classes["@mozilla.org/xre/app-info;1"].getService(Components.interfaces.nsIXULAppInfo)