98
97
_log.addHandler(handler)
101
class ZipFileReader(object):
103
Class to read zip files in Python 2.5 and later. Limited to only what we
107
def __init__(self, filename):
108
self._zipfile = zipfile.ZipFile(filename, "r")
111
self._zipfile.close()
113
def _getnormalizedpath(self, path):
115
Gets a normalized path from 'path' (or the current working directory if
116
'path' is None). Also asserts that the path exists.
120
path = os.path.normpath(os.path.expanduser(path))
121
assert os.path.isdir(path)
124
def _extractname(self, name, path):
126
Extracts a file with the given name from the zip file to the given path.
127
Also creates any directories needed along the way.
129
filename = os.path.normpath(os.path.join(path, name))
130
if name.endswith("/"):
131
os.makedirs(filename)
133
path = os.path.split(filename)[0]
134
if not os.path.isdir(path):
136
with open(filename, "wb") as dest:
137
dest.write(self._zipfile.read(name))
140
return self._zipfile.namelist()
142
def read(self, name):
143
return self._zipfile.read(name)
145
def extract(self, name, path = None):
146
if hasattr(self._zipfile, "extract"):
147
return self._zipfile.extract(name, path)
149
# This will throw if name is not part of the zip file.
150
self._zipfile.getinfo(name)
152
self._extractname(name, self._getnormalizedpath(path))
154
def extractall(self, path = None):
155
if hasattr(self._zipfile, "extractall"):
156
return self._zipfile.extractall(path)
158
path = self._getnormalizedpath(path)
160
for name in self._zipfile.namelist():
161
self._extractname(name, path)
164
100
#################
165
101
# PROFILE SETUP #
166
102
#################
404
340
user_pref("dom.allow_scripts_to_close_windows", true);
405
341
user_pref("dom.disable_open_during_load", false);
406
342
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
343
user_pref("hangmonitor.timeout", 0); // no hang monitor
407
344
user_pref("dom.max_chrome_script_run_time", 0);
408
345
user_pref("dom.popup_maximum", -1);
409
346
user_pref("dom.send_after_paint_to_content", true);
418
355
user_pref("devtools.errorconsole.enabled", true);
419
356
user_pref("layout.debug.enable_data_xbl", true);
420
357
user_pref("browser.EULA.override", true);
358
user_pref("javascript.options.jit_hardening", true);
421
359
user_pref("gfx.color_management.force_srgb", true);
422
360
user_pref("network.manage-offline-status", false);
423
361
user_pref("test.mousescroll", true);
429
367
user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
430
368
user_pref("dom.w3c_touch_events.enabled", true);
431
369
user_pref("toolkit.telemetry.prompted", 2);
370
// Existing tests assume there is no font size inflation.
371
user_pref("font.size.inflation.emPerLine", 0);
372
user_pref("font.size.inflation.minTwips", 0);
433
374
// Only load extensions from the application and user profile
434
375
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
1058
999
os.makedirs(extensionsRootDir)
1060
1001
if os.path.isfile(extensionSource):
1061
reader = ZipFileReader(extensionSource)
1002
reader = automationutils.ZipFileReader(extensionSource)
1063
1004
for filename in reader.namelist():
1064
1005
# Sanity check the zip file.