Bug 431713: show EULA by default on first run of Firefox on Linux, and add override for unit test/talos machines to avoid it there, r=mconnor, a=mconnor
authorgavin@gavinsharp.com
Mon, 05 May 2008 13:43:44 -0700
changeset 14946 64adbb2b60abab16505eaac33383ec30d64d392c
parent 14945 b3024b57096ae18c050dd44e3551a9eaece6c6cd
child 14947 b43c23621c960437cc93116a1e457d2804ca8eeb
push idunknown
push userunknown
push dateunknown
reviewersmconnor, mconnor
bugs431713
milestone1.9pre
Bug 431713: show EULA by default on first run of Firefox on Linux, and add override for unit test/talos machines to avoid it there, r=mconnor, a=mconnor
browser/app/profile/firefox.js
browser/components/nsBrowserGlue.js
build/pgo/automation.py.in
testing/mochitest/runtests.pl.in
testing/tools/profiles/createTestingProfile.py
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -648,19 +648,17 @@ pref("browser.safebrowsing.malware.repor
 #endif
 
 // defaults to true on Windows and Mac, because the installer shows this
 #ifdef XP_MACOSX
 pref("browser.EULA.3.accepted", true);
 #elifdef XP_WIN
 pref("browser.EULA.3.accepted", true);
 #else
-# Need to fix the unittest and talos machine profiles before flipping this by default
-#pref("browser.EULA.3.accepted", false);
-pref("browser.EULA.3.accepted", true);
+pref("browser.EULA.3.accepted", false);
 #endif
 
 // if we rev the EULA again, we should bump this so users agree to the new EULA
 pref("browser.EULA.version", 3);
 
 pref("browser.sessionstore.enabled", true);
 pref("browser.sessionstore.resume_from_crash", true);
 pref("browser.sessionstore.resume_session_once", false);
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -170,24 +170,35 @@ BrowserGlue.prototype = {
     // other customizations are applied in _onProfileStartup()
     var distro = new DistributionCustomizer();
     distro.applyPrefDefaults();
   },
 
   // profile startup handler (contains profile initialization routines)
   _onProfileStartup: function() 
   {
-    // check to see if the EULA must be shown on startup
+    // Check to see if the EULA must be shown on startup
+
+    // Global override for tinderbox machines
+    var prefBranch = Cc["@mozilla.org/preferences-service;1"].
+                     getService(Ci.nsIPrefBranch);
+    var mustDisplayEULA = true;
     try {
-      var mustDisplayEULA = true;
-      var prefBranch = Cc["@mozilla.org/preferences-service;1"].
-                       getService(Ci.nsIPrefBranch);
-      var EULAVersion = prefBranch.getIntPref("browser.EULA.version");
-      mustDisplayEULA = !prefBranch.getBoolPref("browser.EULA." + EULAVersion + ".accepted");
-    } catch(ex) {
+      mustDisplayEULA = !prefBranch.getBoolPref("browser.EULA.override");
+    } catch (e) {
+      // Pref might not exist
+    }
+
+    // Make sure it hasn't already been accepted
+    if (mustDisplayEULA) {
+      try {
+        var EULAVersion = prefBranch.getIntPref("browser.EULA.version");
+        mustDisplayEULA = !prefBranch.getBoolPref("browser.EULA." + EULAVersion + ".accepted");
+      } catch(ex) {
+      }
     }
 
     if (mustDisplayEULA) {
       var ww2 = Cc["@mozilla.org/embedcomp/window-watcher;1"].
                 getService(Ci.nsIWindowWatcher);
       ww2.openWindow(null, "chrome://browser/content/EULA.xul", 
                      "_blank", "chrome,centerscreen,modal,resizable=yes", null);
     }
--- a/build/pgo/automation.py.in
+++ b/build/pgo/automation.py.in
@@ -236,16 +236,17 @@ user_pref("dom.disable_open_during_load"
 user_pref("dom.max_script_run_time", 0); // no slow script dialogs
 user_pref("signed.applets.codebase_principal_support", true);
 user_pref("security.warn_submit_insecure", false);
 user_pref("browser.shell.checkDefaultBrowser", false);
 user_pref("browser.warnOnQuit", false);
 user_pref("accessibility.typeaheadfind.autostart", false);
 user_pref("javascript.options.showInConsole", true);
 user_pref("layout.debug.enable_data_xbl", true);
+user_pref("browser.EULA.override", true);
 """
   prefs.append(part)
 
   # Grant God-power to all the servers on which tests can run.
   for (i, server) in itertools.izip(itertools.count(1), servers):
     part = """
 user_pref("capability.principal.codebase.p%(i)d.granted",
           "UniversalXPConnect UniversalBrowserRead UniversalBrowserWrite \
--- a/testing/mochitest/runtests.pl.in
+++ b/testing/mochitest/runtests.pl.in
@@ -434,16 +434,17 @@ user_pref("dom.disable_open_during_load"
 user_pref("dom.max_script_run_time", 0); // no slow script dialogs
 user_pref("signed.applets.codebase_principal_support", true);
 user_pref("security.warn_submit_insecure", false);
 user_pref("browser.shell.checkDefaultBrowser", false);
 user_pref("browser.warnOnQuit", false);
 user_pref("accessibility.typeaheadfind.autostart", false);
 user_pref("javascript.options.showInConsole", true);
 user_pref("layout.debug.enable_data_xbl", true);
+user_pref("browser.EULA.override", true);
 PREFEND
 
   # Grant God-power to all the servers on which tests can run.
   my $i = 1;
   my $server;
   foreach $server (@servers) {
     $pref_content .= <<SERVERPREFEND;
 user_pref("capability.principal.codebase.p$i.granted", "UniversalXPConnect UniversalBrowserRead UniversalBrowserWrite UniversalPreferencesRead UniversalPreferencesWrite UniversalFileRead");
--- a/testing/tools/profiles/createTestingProfile.py
+++ b/testing/tools/profiles/createTestingProfile.py
@@ -1,105 +1,107 @@
-import getopt
-import os
-import re
-import shutil
-from subprocess import Popen,PIPE
-import sys
-
-# If you are adding prefs that require string values (rather than true/false),
-# be sure to wrap the string value in quotes, e.g.:
-# 'browser.active_color': '"#EE0000"',
-userPrefs = {
-    'browser.chrome.favicons': 'false',
-    'browser.chrome.site_icons': 'false',
-    'browser.dom.window.dump.enabled': 'true',
-    'browser.sessionstore.enabled': 'false',
-    'browser.sessionstore.resume_from_crash': 'false',
-    'browser.shell.checkDefaultBrowser': 'false',
-    'browser.tabs.warnOnClose': 'false',
-    'browser.warnOnQuit': 'false',
-    'dom.allow_scripts_to_close_windows': 'true',
-    'dom.disable_open_during_load': 'false',
-    'dom.disable_window_flip': 'false',
-    'dom.disable_window_move_resize': 'false',
-    'layout.fire_onload_after_image_background_loads': 'true',
-    'javascript.options.showInConsole': 'true',
-    'privacy.popups.firstTime': 'false',
+import getopt
+import os
+import re
+import shutil
+from subprocess import Popen,PIPE
+import sys
+
+# If you are adding prefs that require string values (rather than true/false),
+# be sure to wrap the string value in quotes, e.g.:
+# 'browser.active_color': '"#EE0000"',
+userPrefs = {
+    'browser.chrome.favicons': 'false',
+    'browser.chrome.site_icons': 'false',
+    'browser.dom.window.dump.enabled': 'true',
+    'browser.sessionstore.enabled': 'false',
+    'browser.sessionstore.resume_from_crash': 'false',
+    'browser.shell.checkDefaultBrowser': 'false',
+    'browser.tabs.warnOnClose': 'false',
+    'browser.warnOnQuit': 'false',
+    'dom.allow_scripts_to_close_windows': 'true',
+    'dom.disable_open_during_load': 'false',
+    'dom.disable_window_flip': 'false',
+    'dom.disable_window_move_resize': 'false',
+    'layout.fire_onload_after_image_background_loads': 'true',
+    'javascript.options.showInConsole': 'true',
+    'privacy.popups.firstTime': 'false',
     'layout.debug.enable_data_xbl': 'true'
-}
-
-def usage():
-    print "python " + sys.argv[0] + " --binary=binary_location [--profileName=default] [--clobber] [--help]" 
-
-def runCreateProfile(binary,profileName):
-    cmd = binary + " -CreateProfile " + profileName
-    p = Popen(cmd, 
-              shell=True, 
-              stdin=PIPE, 
-              stdout=PIPE, 
-              stderr=PIPE)
-    for line in p.stderr:
-        m = re.search('Success: created profile .* at \'([^\']+)\'',
-                      line)
-        if m:
-            return m.group(1)
-    return ""
+    'browser.EULA.override': 'true'
+}
+
+def usage():
+    print "python " + sys.argv[0] + " --binary=binary_location [--profileName=default] [--clobber] [--help]" 
+
+def runCreateProfile(binary,profileName):
+    cmd = binary + " -CreateProfile " + profileName
+    p = Popen(cmd, 
+              shell=True, 
+              stdin=PIPE, 
+              stdout=PIPE, 
+              stderr=PIPE)
+    for line in p.stderr:
+        m = re.search('Success: created profile .* at \'([^\']+)\'',
+                      line)
+        if m:
+            return m.group(1)
+    return ""
+
+def populatePrefs(profileLocation):
+    try:
+        f = open(profileLocation, 'w')
+    except IOError:
+        print "Couldn't write to " + profileLocation
+        sys.exit(2)
+    f.write("/* Generated by buildbot */\n\n")
+    for key in userPrefs.keys():
+        f.write('user_pref("' + key + '", ' + userPrefs[key] + ");\n")
+    f.close()
+    print "Wrote testing preferences to %s" % profileLocation
+
+def main(argv):
+    try:
+        opts, args = getopt.getopt(argv, 
+                                   "hb:p:cd", 
+                                   ["help", 
+                                    "binary=", 
+                                    "profileName=",
+                                    "clobber"])
+    except getopt.GetoptError:
+	usage()
+        sys.exit(2)
+
+    binary = ""
+    profileName = "default"
+    clobber=0
+    for o,a in opts:
+        if o in ("-h", "--help"):
+            usage()
+            sys.exit()
+        if o in ("-b","--binary"):
+            binary=a
+        if o in ("-p","--profileName"):
+            profileName=a
+        if o in ("-c","--clobber"):
+            clobber=1
+    if binary=="" or not os.path.exists(binary):
+	usage()
+        sys.exit(2)
+
+    profileLocation = runCreateProfile(binary,profileName)
+    if not profileLocation or not os.path.exists(profileLocation):
+        print "Couldn't find profile location"
+        sys.exit(2)
+    # Delete the existing profile directory if clobber is requested.
+    # -CreateProfile will re-create it in the right place.
+    if clobber:
+        dirname = os.path.dirname(profileLocation)
+        shutil.rmtree(dirname)
+        profileLocation = runCreateProfile(binary,profileName)
+        if not profileLocation or not os.path.exists(profileLocation):
+            print "Couldn't find profile location on second pass"
+            sys.exit(2)
+
+    populatePrefs(profileLocation)
+
+if __name__ == "__main__":
+    main(sys.argv[1:])
 
-def populatePrefs(profileLocation):
-    try:
-        f = open(profileLocation, 'w')
-    except IOError:
-        print "Couldn't write to " + profileLocation
-        sys.exit(2)
-    f.write("/* Generated by buildbot */\n\n")
-    for key in userPrefs.keys():
-        f.write('user_pref("' + key + '", ' + userPrefs[key] + ");\n")
-    f.close()
-    print "Wrote testing preferences to %s" % profileLocation
-
-def main(argv):
-    try:
-        opts, args = getopt.getopt(argv, 
-                                   "hb:p:cd", 
-                                   ["help", 
-                                    "binary=", 
-                                    "profileName=",
-                                    "clobber"])
-    except getopt.GetoptError:
-	usage()
-        sys.exit(2)
-
-    binary = ""
-    profileName = "default"
-    clobber=0
-    for o,a in opts:
-        if o in ("-h", "--help"):
-            usage()
-            sys.exit()
-        if o in ("-b","--binary"):
-            binary=a
-        if o in ("-p","--profileName"):
-            profileName=a
-        if o in ("-c","--clobber"):
-            clobber=1
-    if binary=="" or not os.path.exists(binary):
-	usage()
-        sys.exit(2)
-
-    profileLocation = runCreateProfile(binary,profileName)
-    if not profileLocation or not os.path.exists(profileLocation):
-        print "Couldn't find profile location"
-        sys.exit(2)
-    # Delete the existing profile directory if clobber is requested.
-    # -CreateProfile will re-create it in the right place.
-    if clobber:
-        dirname = os.path.dirname(profileLocation)
-        shutil.rmtree(dirname)
-        profileLocation = runCreateProfile(binary,profileName)
-        if not profileLocation or not os.path.exists(profileLocation):
-            print "Couldn't find profile location on second pass"
-            sys.exit(2)
-
-    populatePrefs(profileLocation)
-
-if __name__ == "__main__":
-    main(sys.argv[1:])