5 from subprocess
import Popen
,PIPE
8 # If you are adding prefs that require string values (rather than true/false),
9 # be sure to wrap the string value in quotes, e.g.:
10 # 'browser.active_color': '"#EE0000"',
12 'browser.chrome.favicons': 'false',
13 'browser.chrome.site_icons': 'false',
14 'browser.dom.window.dump.enabled': 'true',
15 'browser.sessionstore.resume_from_crash': 'false',
16 'browser.shell.checkDefaultBrowser': 'false',
17 'browser.tabs.warnOnClose': 'false',
18 'browser.warnOnQuit': 'false',
19 'dom.allow_scripts_to_close_windows': 'true',
20 'dom.disable_open_during_load': 'false',
21 'dom.disable_window_flip': 'false',
22 'dom.disable_window_move_resize': 'false',
23 'layout.fire_onload_after_image_background_loads': 'true',
24 'javascript.options.showInConsole': 'true',
25 'privacy.popups.firstTime': 'false',
26 'layout.debug.enable_data_xbl': 'true',
27 'shell.checkDefaultClient': 'false',
28 'browser.EULA.override': 'true'
32 print "python " + sys
.argv
[0] + " --binary=binary_location [--profileName=default] [--clobber] [--help]"
34 def runCreateProfile(binary
,profileName
):
35 cmd
= binary
+ " -CreateProfile " + profileName
42 m
= re
.search('Success: created profile .* at \'([^\']+)\'',
48 def populatePrefs(profileLocation
):
50 f
= open(profileLocation
, 'w')
52 print "Couldn't write to " + profileLocation
54 f
.write("/* Generated by buildbot */\n\n")
55 for key
in userPrefs
.keys():
56 f
.write('user_pref("' + key
+ '", ' + userPrefs
[key
] + ");\n")
58 print "Wrote testing preferences to %s" % profileLocation
62 opts
, args
= getopt
.getopt(argv
,
68 except getopt
.GetoptError
:
73 profileName
= "default"
76 if o
in ("-h", "--help"):
79 if o
in ("-b","--binary"):
81 if o
in ("-p","--profileName"):
83 if o
in ("-c","--clobber"):
85 if binary
=="" or not os
.path
.exists(binary
):
89 profileLocation
= runCreateProfile(binary
,profileName
)
90 if not profileLocation
or not os
.path
.exists(profileLocation
):
91 print "Couldn't find profile location"
93 # Delete the existing profile directory if clobber is requested.
94 # -CreateProfile will re-create it in the right place.
96 dirname
= os
.path
.dirname(profileLocation
)
97 shutil
.rmtree(dirname
)
98 profileLocation
= runCreateProfile(binary
,profileName
)
99 if not profileLocation
or not os
.path
.exists(profileLocation
):
100 print "Couldn't find profile location on second pass"
103 populatePrefs(profileLocation
)
105 if __name__
== "__main__":