mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1233534 - [mozprofile] unable to use a profile generated with recent firefox. r=ahal
--HG-- extra : rebase_source : b9cad07a8d5e5e056704b5a8a6c31b02f66c42e6
This commit is contained in:
parent
151ac66626
commit
7b6fe06dd6
@ -165,10 +165,10 @@ class Preferences(object):
|
||||
"""
|
||||
|
||||
marker = '##//' # magical marker
|
||||
lines = [i.strip() for i in mozfile.load(path).readlines() if i.strip()]
|
||||
lines = [i.strip() for i in mozfile.load(path).readlines()]
|
||||
_lines = []
|
||||
for line in lines:
|
||||
if line.startswith(('#', '//')):
|
||||
if not line.startswith(pref_setter):
|
||||
continue
|
||||
if '//' in line:
|
||||
line = line.replace('//', marker)
|
||||
|
@ -259,6 +259,34 @@ user_pref("webgl.force-enabled", true);
|
||||
finally:
|
||||
shutil.rmtree(tempdir)
|
||||
|
||||
def test_can_read_prefs_with_multiline_comments(self):
|
||||
"""
|
||||
Ensure that multiple comments in the file header do not break reading
|
||||
the prefs (https://bugzilla.mozilla.org/show_bug.cgi?id=1233534).
|
||||
"""
|
||||
user_js = tempfile.NamedTemporaryFile(suffix='.js', delete=False)
|
||||
self.addCleanup(mozfile.remove, user_js.name)
|
||||
with user_js:
|
||||
user_js.write("""
|
||||
# Mozilla User Preferences
|
||||
|
||||
/* Do not edit this file.
|
||||
*
|
||||
* If you make changes to this file while the application is running,
|
||||
* the changes will be overwritten when the application exits.
|
||||
*
|
||||
* To make a manual change to preferences, you can visit the URL about:config
|
||||
*/
|
||||
|
||||
user_pref("webgl.enabled_for_all_sites", true);
|
||||
user_pref("webgl.force-enabled", true);
|
||||
""")
|
||||
self.assertEqual(
|
||||
Preferences.read_prefs(user_js.name),
|
||||
[('webgl.enabled_for_all_sites', True),
|
||||
('webgl.force-enabled', True)]
|
||||
)
|
||||
|
||||
def test_json(self):
|
||||
_prefs = {"browser.startup.homepage": "http://planet.mozilla.org/"}
|
||||
json = '{"browser.startup.homepage": "http://planet.mozilla.org/"}'
|
||||
|
Loading…
Reference in New Issue
Block a user