author | Sylvestre Ledru <sledru@mozilla.com> |
Mon, 21 May 2018 23:13:07 +0200 | |
changeset 419595 | 02159d1ec622088538ee4a5d1d9af5043e8c787f |
parent 419594 | eedb9180bc3b62eb39e6b1221a355282d1b40149 |
child 419596 | c37fb2bf78d66c664f17af47a6d0f838e54850a2 |
push id | 34040 |
push user | ebalazs@mozilla.com |
push date | Thu, 24 May 2018 09:37:05 +0000 |
treeherder | mozilla-central@c411ccb6bb4a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ahal, gps |
bugs | 1463425 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/.flake8 +++ b/.flake8 @@ -1,7 +1,8 @@ [flake8] # See http://pep8.readthedocs.io/en/latest/intro.html#configuration ignore = E121, E123, E126, E129, E133, E226, E241, E242, E704, W503, E402, E741 max-line-length = 99 exclude = + browser/extensions/mortar/ppapi/, testing/mochitest/pywebsocket, tools/lint/test/files,
--- a/browser/app/macversion.py +++ b/browser/app/macversion.py @@ -31,14 +31,14 @@ if not options.version: define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split() # extract only the major version (i.e. "14" from "14.0b1") majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1) # last two digits of the year twodigityear = buildid[2:4] month = buildid[4:6] if month[0] == '0': - month = month[1] + month = month[1] day = buildid[6:8] if day[0] == '0': - day = day[1] + day = day[1] -print '%s.%s.%s' % (majorVersion + twodigityear, month, day) +print('%s.%s.%s' % (majorVersion + twodigityear, month, day))
--- a/browser/components/migration/tests/marionette/test_refresh_firefox.py +++ b/browser/components/migration/tests/marionette/test_refresh_firefox.py @@ -48,46 +48,46 @@ class TestFirefoxRefresh(MarionetteTestC error = self.runAsyncCode(""" let url = arguments[0]; let title = arguments[1]; PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.menuGuid, url, title }).then(() => marionetteScriptFinished(false), marionetteScriptFinished); """, script_args=(self._bookmarkURL, self._bookmarkText)) if error: - print error + print(error) def createBookmarksOnToolbar(self): error = self.runAsyncCode(""" let children = []; for (let i = 1; i <= 5; i++) { children.push({url: `about:rights?p=${i}`, title: `Bookmark ${i}`}); } PlacesUtils.bookmarks.insertTree({ guid: PlacesUtils.bookmarks.toolbarGuid, children }).then(() => marionetteScriptFinished(false), marionetteScriptFinished); """) if error: - print error + print(error) def createHistory(self): error = self.runAsyncCode(""" PlacesUtils.history.insert({ url: arguments[0], title: arguments[1], visits: [{ date: new Date(Date.now() - 5000), referrer: "about:mozilla" }] }).then(() => marionetteScriptFinished(false), ex => marionetteScriptFinished("Unexpected error in adding visit: " + ex)); """, script_args=(self._historyURL, self._historyTitle)) if error: - print error + print(error) def createFormHistory(self): error = self.runAsyncCode(""" let updateDefinition = { op: "add", fieldname: arguments[0], value: arguments[1], firstUsed: (Date.now() - 5000) * 1000, @@ -101,17 +101,17 @@ class TestFirefoxRefresh(MarionetteTestC handleCompletion() { if (!finished) { marionetteScriptFinished(false); } } }); """, script_args=(self._formHistoryFieldName, self._formHistoryValue)) if error: - print error + print(error) def createFormAutofill(self): if not self._formAutofillAvailable: return self._formAutofillAddressGuid = self.runAsyncCode(""" const TEST_ADDRESS_1 = { "given-name": "John", "additional-name": "R.", @@ -168,28 +168,28 @@ class TestFirefoxRefresh(MarionetteTestC } // Close any other tabs that might be open: let allTabs = Array.from(gBrowser.tabs); for (let tab of allTabs) { if (!expectedTabs.has(tab)) { gBrowser.removeTab(tab); } } - """, script_args=(self._expectedURLs,)) + """, script_args=(self._expectedURLs,)) # NOQA: E501 def createSync(self): # This script will write an entry to the login manager and create # a signedInUser.json in the profile dir. self.runAsyncCode(""" Cu.import("resource://gre/modules/FxAccountsStorage.jsm"); let storage = new FxAccountsStorageManager(); let data = {email: "test@test.com", uid: "uid", keyFetchToken: "top-secret"}; storage.initialize(data); storage.finalize().then(marionetteScriptFinished); - """); + """) def checkPassword(self): loginInfo = self.marionette.execute_script(""" let ary = Services.logins.findLogins({}, "test.marionette.mozilla.com", "http://test.marionette.mozilla.com/some/form/", null, {}); return ary.length ? ary : {username: "null", password: "null"}; @@ -255,50 +255,55 @@ class TestFirefoxRefresh(MarionetteTestC }, }); """, script_args=(self._formHistoryFieldName,)) if type(formFieldResults) == str: self.fail(formFieldResults) return formFieldResultCount = len(formFieldResults) - self.assertEqual(formFieldResultCount, 1, "Should have exactly 1 entry for this field, got %d" % formFieldResultCount) + self.assertEqual(formFieldResultCount, 1, + "Should have exactly 1 entry for this field, got %d" % + formFieldResultCount) if formFieldResultCount == 1: - self.assertEqual(formFieldResults[0]['value'], self._formHistoryValue) + self.assertEqual( + formFieldResults[0]['value'], self._formHistoryValue) formHistoryCount = self.runAsyncCode(""" let count; let callbacks = { handleResult: rv => count = rv, handleCompletion() { marionetteScriptFinished(count); }, }; global.FormHistory.count({}, callbacks); """) - self.assertEqual(formHistoryCount, 1, "There should be only 1 entry in the form history") + self.assertEqual(formHistoryCount, 1, + "There should be only 1 entry in the form history") def checkFormAutofill(self): if not self._formAutofillAvailable: return formAutofillResults = self.runAsyncCode(""" return global.formAutofillStorage.initialize().then(() => { return global.formAutofillStorage.addresses.getAll() }).then(marionetteScriptFinished); """,) if type(formAutofillResults) == str: self.fail(formAutofillResults) return formAutofillAddressCount = len(formAutofillResults) - self.assertEqual(formAutofillAddressCount, 1, "Should have exactly 1 saved address, got %d" % formAutofillAddressCount) + self.assertEqual(formAutofillAddressCount, 1, + "Should have exactly 1 saved address, got %d" % formAutofillAddressCount) if formAutofillAddressCount == 1: - self.assertEqual(formAutofillResults[0]['guid'], self._formAutofillAddressGuid) - + self.assertEqual( + formAutofillResults[0]['guid'], self._formAutofillAddressGuid) def checkCookie(self): cookieInfo = self.runCode(""" try { let cookieEnum = Services.cookies.getCookiesFromHost(arguments[0]); let cookie = null; while (cookieEnum.hasMoreElements()) { let hostCookie = cookieEnum.getNext(); @@ -327,20 +332,20 @@ class TestFirefoxRefresh(MarionetteTestC tabURIs = self.runCode(""" return [... gBrowser.browsers].map(b => b.currentURI && b.currentURI.spec) """) self.assertSequenceEqual(tabURIs, ["about:welcomeback"]) # Dismiss modal dialog if any. This is mainly to dismiss the check for # default browser dialog if it shows up. try: - alert = self.marionette.switch_to_alert() - alert.dismiss() + alert = self.marionette.switch_to_alert() + alert.dismiss() except NoAlertPresentException: - pass + pass tabURIs = self.runAsyncCode(""" let mm = gBrowser.selectedBrowser.messageManager; let {TabStateFlusher} = Cu.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {}); window.addEventListener("SSWindowStateReady", function testSSPostReset() { window.removeEventListener("SSWindowStateReady", testSSPostReset, false); Promise.all(gBrowser.browsers.map(b => TabStateFlusher.flush(b))).then(function() { @@ -354,17 +359,17 @@ class TestFirefoxRefresh(MarionetteTestC } else { content.window.addEventListener("load", function(event) { content.document.getElementById("errorTryAgain").click(); }, { once: true }); } }; mm.loadFrameScript("data:application/javascript,(" + fs.toString() + ")()", true); - """) + """) # NOQA: E501 self.assertSequenceEqual(tabURIs, self._expectedURLs) def checkSync(self, hasMigrated): result = self.runAsyncCode(""" Cu.import("resource://gre/modules/FxAccountsStorage.jsm"); let prefs = new global.Preferences("services.sync."); let storage = new FxAccountsStorageManager(); let result = {}; @@ -373,36 +378,36 @@ class TestFirefoxRefresh(MarionetteTestC result.accountData = data; return storage.finalize(); }).then(() => { result.prefUsername = prefs.get("username"); marionetteScriptFinished(result); }).catch(err => { marionetteScriptFinished(err.toString()); }); - """); + """) if type(result) != dict: self.fail(result) return - self.assertEqual(result["accountData"]["email"], "test@test.com"); - self.assertEqual(result["accountData"]["uid"], "uid"); - self.assertEqual(result["accountData"]["keyFetchToken"], "top-secret"); + self.assertEqual(result["accountData"]["email"], "test@test.com") + self.assertEqual(result["accountData"]["uid"], "uid") + self.assertEqual(result["accountData"]["keyFetchToken"], "top-secret") if hasMigrated: - # This test doesn't actually configure sync itself, so the username - # pref only exists after migration. - self.assertEqual(result["prefUsername"], "test@test.com"); + # This test doesn't actually configure sync itself, so the username + # pref only exists after migration. + self.assertEqual(result["prefUsername"], "test@test.com") def checkProfile(self, hasMigrated=False): self.checkPassword() self.checkBookmarkInMenu() self.checkHistory() self.checkFormHistory() self.checkFormAutofill() self.checkCookie() - self.checkSync(hasMigrated); + self.checkSync(hasMigrated) if hasMigrated: self.checkBookmarkToolbarVisibility() self.checkSession() def createProfileData(self): self.savePassword() self.createBookmarkInMenu() self.createBookmarksOnToolbar() @@ -416,25 +421,25 @@ class TestFirefoxRefresh(MarionetteTestC def setUpScriptData(self): self.marionette.set_context(self.marionette.CONTEXT_CHROME) self.runCode(""" window.global = {}; global.LoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", "nsILoginInfo", "init"); global.profSvc = Cc["@mozilla.org/toolkit/profile-service;1"].getService(Ci.nsIToolkitProfileService); global.Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences; global.FormHistory = Cu.import("resource://gre/modules/FormHistory.jsm", {}).FormHistory; - """) + """) # NOQA: E501 self._formAutofillAvailable = self.runCode(""" try { global.formAutofillStorage = Cu.import("resource://formautofill/FormAutofillStorage.jsm", {}).formAutofillStorage; } catch(e) { return false; } return true; - """) + """) # NOQA: E501 def runCode(self, script, *args, **kwargs): return self.marionette.execute_script(script, new_sandbox=False, sandbox=self._sandbox, *args, **kwargs) @@ -460,38 +465,43 @@ class TestFirefoxRefresh(MarionetteTestC # blank slate for the next person. self.marionette.restart(clean=True, in_app=False) self.setUpScriptData() # Super MarionetteTestCase.tearDown(self) # Some helpers to deal with removing a load of files - import errno, stat + import errno + import stat + def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: - os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 + os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | + stat.S_IRWXO) # 0777 func(path) else: raise if self.desktop_backup_path: - shutil.rmtree(self.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly) + shutil.rmtree(self.desktop_backup_path, + ignore_errors=False, onerror=handleRemoveReadonly) if self.reset_profile_path: # Remove ourselves from profiles.ini self.runCode(""" let name = arguments[0]; let profile = global.profSvc.getProfileByName(name); profile.remove(false) global.profSvc.flush(); """, script_args=(self.profileNameToRemove,)) # And delete all the files. - shutil.rmtree(self.reset_profile_path, ignore_errors=False, onerror=handleRemoveReadonly) + shutil.rmtree(self.reset_profile_path, + ignore_errors=False, onerror=handleRemoveReadonly) def doReset(self): profileName = "marionette-test-profile-" + str(int(time.time() * 1000)) self.profileNameToRemove = profileName self.runCode(""" // Ensure the current (temporary) profile is in profiles.ini: let profD = Services.dirsvc.get("ProfD", Ci.nsIFile); let profileName = arguments[1]; @@ -507,17 +517,18 @@ class TestFirefoxRefresh(MarionetteTestC prefObj[pref] = global.Preferences.get(pref); } env.set("MOZ_MARIONETTE_PREF_STATE_ACROSS_RESTARTS", JSON.stringify(prefObj)); env.set("MOZ_RESET_PROFILE_RESTART", "1"); env.set("XRE_PROFILE_PATH", arguments[0]); env.set("XRE_PROFILE_NAME", profileName); """, script_args=(self.marionette.instance.profile.profile, profileName,)) - profileLeafName = os.path.basename(os.path.normpath(self.marionette.instance.profile.profile)) + profileLeafName = os.path.basename(os.path.normpath( + self.marionette.instance.profile.profile)) # Now restart the browser to get it reset: self.marionette.restart(clean=False, in_app=True) self.setUpScriptData() # Determine the new profile path (we'll need to remove it when we're done) self.reset_profile_path = self.runCode(""" let profD = Services.dirsvc.get("ProfD", Ci.nsIFile); @@ -532,21 +543,24 @@ class TestFirefoxRefresh(MarionetteTestC } catch (ex) { container = Services.dirsvc.get("Home", Ci.nsIFile); } let bundle = Services.strings.createBundle("chrome://mozapps/locale/profile/profileSelection.properties"); let dirName = bundle.formatStringFromName("resetBackupDirectory", [Services.appinfo.name], 1); container.append(dirName); container.append(arguments[0]); return container.path; - """, script_args=(profileLeafName,)) + """, script_args=(profileLeafName,)) # NOQA: E501 - self.assertTrue(os.path.isdir(self.reset_profile_path), "Reset profile path should be present") - self.assertTrue(os.path.isdir(self.desktop_backup_path), "Backup profile path should be present") - self.assertTrue(self.profileNameToRemove in self.reset_profile_path, "Reset profile path should contain profile name to remove") + self.assertTrue(os.path.isdir(self.reset_profile_path), + "Reset profile path should be present") + self.assertTrue(os.path.isdir(self.desktop_backup_path), + "Backup profile path should be present") + self.assertTrue(self.profileNameToRemove in self.reset_profile_path, + "Reset profile path should contain profile name to remove") def testReset(self): self.checkProfile() self.doReset() # Now check that we're doing OK... self.checkProfile(hasMigrated=True)
--- a/browser/components/payments/server.py +++ b/browser/components/payments/server.py @@ -2,17 +2,18 @@ import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler class RequestHandler(SimpleHTTPRequestHandler, object): def translate_path(self, path): # Map autofill paths to their own directory autofillPath = "/formautofill" if (path.startswith(autofillPath)): - path = "browser/extensions/formautofill/content" + path[len(autofillPath):] + path = "browser/extensions/formautofill/content" + \ + path[len(autofillPath):] else: path = "browser/components/payments/res" + path return super(RequestHandler, self).translate_path(path) if __name__ == '__main__': BaseHTTPServer.test(RequestHandler, BaseHTTPServer.HTTPServer)
--- a/browser/locales/filter.py +++ b/browser/locales/filter.py @@ -1,41 +1,42 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -def test(mod, path, entity = None): - import re - # ignore anything but Firefox - if mod not in ("netwerk", "dom", "toolkit", "security/manager", - "devtools/client", "devtools/shared", "devtools/startup", - "browser", - "browser/extensions/formautofill", - "browser/extensions/onboarding", - "browser/extensions/webcompat-reporter", - "extensions/spellcheck", - "other-licenses/branding/firefox", - "browser/branding/official", - "services/sync"): - return "ignore" - if mod not in ("browser", "extensions/spellcheck"): - # we only have exceptions for browser and extensions/spellcheck + +def test(mod, path, entity=None): + import re + # ignore anything but Firefox + if mod not in ("netwerk", "dom", "toolkit", "security/manager", + "devtools/client", "devtools/shared", "devtools/startup", + "browser", + "browser/extensions/formautofill", + "browser/extensions/onboarding", + "browser/extensions/webcompat-reporter", + "extensions/spellcheck", + "other-licenses/branding/firefox", + "browser/branding/official", + "services/sync"): + return "ignore" + if mod not in ("browser", "extensions/spellcheck"): + # we only have exceptions for browser and extensions/spellcheck + return "error" + if entity is None: + # the only files to ignore are spell checkers + if mod == "extensions/spellcheck": + return "ignore" + return "error" + if mod == "extensions/spellcheck": + # l10n ships en-US dictionary or something, do compare + return "error" + if path == "defines.inc": + return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error" + + if mod == "browser" and path == "chrome/browser-region/region.properties": + # only region.properties exceptions remain, compare all others + return ("ignore" + if (re.match(r"browser\.search\.order\.[1-9]", entity) or + re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or + re.match(r"gecko\.handlerService\.schemes\.", entity) or + re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)) + else "error") return "error" - if entity is None: - # the only files to ignore are spell checkers - if mod == "extensions/spellcheck": - return "ignore" - return "error" - if mod == "extensions/spellcheck": - # l10n ships en-US dictionary or something, do compare - return "error" - if path == "defines.inc": - return "ignore" if entity == "MOZ_LANGPACK_CONTRIBUTORS" else "error" - - if mod == "browser" and path == "chrome/browser-region/region.properties": - # only region.properties exceptions remain, compare all others - return ("ignore" - if (re.match(r"browser\.search\.order\.[1-9]", entity) or - re.match(r"browser\.contentHandlers\.types\.[0-5]", entity) or - re.match(r"gecko\.handlerService\.schemes\.", entity) or - re.match(r"gecko\.handlerService\.defaultHandlersVersion", entity)) - else "error") - return "error"
--- a/browser/locales/generate_updater_ini.py +++ b/browser/locales/generate_updater_ini.py @@ -7,21 +7,23 @@ from __future__ import absolute_import, unicode_literals, print_function import buildconfig import codecs import re import shutil + def main(output, updater_ini, updater_ini_append, locale=None): assert(locale is not None) fixup_re = re.compile('^(Info|Title)Text=') # updater.ini is always utf-8. with codecs.open(updater_ini, 'rb', 'utf_8') as f: for line in f: line = fixup_re.sub(r'\1=', line) - line = line.replace('%MOZ_APP_DISPLAYNAME%', buildconfig.substs['MOZ_APP_DISPLAYNAME']) + line = line.replace('%MOZ_APP_DISPLAYNAME%', + buildconfig.substs['MOZ_APP_DISPLAYNAME']) output.write(line) if buildconfig.substs['OS_TARGET'] == 'WINNT': # Also append the contents of `updater_ini_append`. with codecs.open(updater_ini_append, 'rb', 'utf_8') as f: shutil.copyfileobj(f, output)