Version in base suite: 68.4.1esr-1~deb10u1 Version in overlay suite: 68.5.0esr-1~deb10u1 Base version: firefox-esr_68.5.0esr-1~deb10u1 Target version: firefox-esr_68.6.0esr-1~deb10u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/f/firefox-esr/firefox-esr_68.5.0esr-1~deb10u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/f/firefox-esr/firefox-esr_68.6.0esr-1~deb10u1.dsc /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/bin/python |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/bin/python2 |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/bin/python2.7 |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/third_party/python/psutil/tmp/tmpa8gLcn.o |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/third_party/python/psutil/tmp/tmpf5WYJ5.o |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/third_party/python/psutil/tmp/tmpsda7Tq.o |binary /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/third_party/python/psutil/tmp/tmpvKVAlZ.o |binary firefox-esr-68.6.0esr/browser/actors/WebRTCChild.jsm | 4 firefox-esr-68.6.0esr/browser/app/blocklist.xml | 154 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/Policies.jsm | 100 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/content/aboutPolicies.js | 1 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/schemas/policies-schema.json | 24 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_permissions.js | 37 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_requestedlocales.js | 21 firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js | 60 firefox-esr-68.6.0esr/browser/components/extensions/test/browser/browser_ext_tabs_events.js | 43 firefox-esr-68.6.0esr/browser/config/version.txt | 2 firefox-esr-68.6.0esr/browser/config/version_display.txt | 2 firefox-esr-68.6.0esr/browser/extensions/webcompat/data/injections.js | 15 firefox-esr-68.6.0esr/browser/extensions/webcompat/data/ua_overrides.js | 87 firefox-esr-68.6.0esr/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css | 13 firefox-esr-68.6.0esr/browser/extensions/webcompat/manifest.json | 2 firefox-esr-68.6.0esr/browser/extensions/webcompat/moz.build | 1 firefox-esr-68.6.0esr/browser/locales/en-US/browser/policies/policies-descriptions.ftl | 2 firefox-esr-68.6.0esr/config/milestone.txt | 2 firefox-esr-68.6.0esr/debian/changelog | 9 firefox-esr-68.6.0esr/devtools/client/shared/curl.js | 34 firefox-esr-68.6.0esr/dom/base/EventSource.cpp | 4 firefox-esr-68.6.0esr/dom/base/Navigator.cpp | 3 firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceChild.cpp | 2 firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.cpp | 28 firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.h | 20 firefox-esr-68.6.0esr/dom/fetch/FetchStream.cpp | 28 firefox-esr-68.6.0esr/dom/indexedDB/test/mochitest.ini | 1 firefox-esr-68.6.0esr/dom/media/MediaManager.cpp | 31 firefox-esr-68.6.0esr/dom/media/MediaManager.h | 5 firefox-esr-68.6.0esr/dom/media/nsIDOMNavigatorUserMedia.idl | 3 firefox-esr-68.6.0esr/dom/quota/ActorsParent.cpp | 80 firefox-esr-68.6.0esr/dom/quota/test/unit/head.js | 4 firefox-esr-68.6.0esr/dom/quota/test/unit/test_clearStorageForPrincipal.js | 2 firefox-esr-68.6.0esr/dom/xhr/XMLHttpRequestWorker.cpp | 2 firefox-esr-68.6.0esr/dom/xhr/tests/mochitest.ini | 2 firefox-esr-68.6.0esr/dom/xhr/tests/test_worker_xhr_doubleSend.html | 32 firefox-esr-68.6.0esr/dom/xhr/tests/xhr_worker_doubleSend.js | 11 firefox-esr-68.6.0esr/js/src/jit/CacheIR.cpp | 30 firefox-esr-68.6.0esr/js/src/jit/CacheIR.h | 4 firefox-esr-68.6.0esr/js/src/jit/Ion.cpp | 10 firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.cpp | 292 firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.h | 2 firefox-esr-68.6.0esr/js/src/jit/Lowering.cpp | 11 firefox-esr-68.6.0esr/js/src/jit/MIR.h | 4 firefox-esr-68.6.0esr/js/src/vm/CommonPropertyNames.h | 9 firefox-esr-68.6.0esr/layout/generic/ScrollAnchorContainer.cpp | 11 firefox-esr-68.6.0esr/media/libcubeb/src/cubeb_audiounit.cpp | 9 firefox-esr-68.6.0esr/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp | 32 firefox-esr-68.6.0esr/mobile/android/app/mobile.js | 9 firefox-esr-68.6.0esr/mobile/android/app/src/main/res/values/arrays.xml | 10 firefox-esr-68.6.0esr/mobile/android/app/src/main/res/xml/preferences_advanced.xml | 6 firefox-esr-68.6.0esr/mobile/android/base/AndroidManifest.xml.in | 41 firefox-esr-68.6.0esr/mobile/android/base/AppConstants.java.in | 7 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java | 62 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java | 24 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoUpdateReceiver.java | 25 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java | 21 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java | 14 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/PackageVerifier.java | 82 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java | 321 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceReceiver.java | 46 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/Updater.java | 701 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdaterService.java | 50 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesApplyService.java | 18 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesCheckService.java | 19 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesDownloadService.java | 17 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesPrefs.java | 103 firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesRegisterService.java | 31 firefox-esr-68.6.0esr/mobile/android/base/locales/en-US/android_strings.dtd | 28 firefox-esr-68.6.0esr/mobile/android/base/strings.xml.in | 21 firefox-esr-68.6.0esr/mobile/android/chrome/content/about.xhtml | 10 firefox-esr-68.6.0esr/mobile/android/components/geckoview/GeckoViewPermission.js | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/beta/version.txt | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/beta/version_display.txt | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/nightly/version.txt | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/nightly/version_display.txt | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/release/version.txt | 2 firefox-esr-68.6.0esr/mobile/android/config/version-files/release/version_display.txt | 2 firefox-esr-68.6.0esr/mobile/android/extensions/webcompat/data/injections.js | 15 firefox-esr-68.6.0esr/mobile/android/extensions/webcompat/data/ua_overrides.js | 87 firefox-esr-68.6.0esr/mobile/android/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css | 13 firefox-esr-68.6.0esr/mobile/android/extensions/webcompat/manifest.json | 2 firefox-esr-68.6.0esr/mobile/android/extensions/webcompat/moz.build | 1 firefox-esr-68.6.0esr/mobile/android/locales/en-US/chrome/about.dtd | 6 firefox-esr-68.6.0esr/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/BaseRobocopTest.java | 3 firefox-esr-68.6.0esr/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/StringHelper.java | 12 firefox-esr-68.6.0esr/mobile/locales/l10n-changesets.json | 182 firefox-esr-68.6.0esr/netwerk/dns/effective_tld_names.dat | 26 firefox-esr-68.6.0esr/netwerk/dns/nsDNSService2.cpp | 3 firefox-esr-68.6.0esr/netwerk/protocol/http/nsCORSListenerProxy.cpp | 2 firefox-esr-68.6.0esr/netwerk/sctp/src/netinet/sctp.h | 8 firefox-esr-68.6.0esr/netwerk/sctp/src/netinet/sctp_auth.c | 5 firefox-esr-68.6.0esr/netwerk/sctp/src/netinet/sctp_pcb.c | 7 firefox-esr-68.6.0esr/netwerk/sctp/src/netinet/sctp_usrreq.c | 18 firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/lib/python2.7/site-packages/pip-9.0.3.dist-info/RECORD | 58 firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/lib/python2.7/site-packages/setuptools-39.0.1.dist-info/RECORD | 52 firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/lib/python2.7/site-packages/wheel-0.30.0.dist-info/RECORD | 4 firefox-esr-68.6.0esr/security/manager/ssl/StaticHPKPins.h | 6 firefox-esr-68.6.0esr/security/manager/ssl/nsSTSPreloadList.inc | 9006 ++++++---- firefox-esr-68.6.0esr/security/sandbox/linux/SandboxFilter.cpp | 2 firefox-esr-68.6.0esr/services/settings/dumps/blocklists/addons.json | 2 firefox-esr-68.6.0esr/services/settings/dumps/blocklists/plugins.json | 2 firefox-esr-68.6.0esr/services/settings/dumps/security-state/onecrl.json | 2 firefox-esr-68.6.0esr/sourcestamp.txt | 4 firefox-esr-68.6.0esr/taskcluster/ci/build/linux.yml | 3 firefox-esr-68.6.0esr/taskcluster/ci/valgrind/kind.yml | 2 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/AbuseReporter.jsm | 10 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/AddonManager.jsm | 1 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/addonManager.js | 1 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/amContentHandler.jsm | 3 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/amInstallTrigger.jsm | 3 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/amWebAPI.jsm | 10 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm | 30 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/browser/browser_webapi_install.js | 22 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpcshell/test_AbuseReporter.js | 12 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_trigger.js | 23 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_url.js | 22 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpinstall/browser_containers.js | 22 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpinstall/browser_datauri.js | 22 firefox-esr-68.6.0esr/toolkit/mozapps/extensions/test/xpinstall/browser_privatebrowsing.js | 22 127 files changed, 7420 insertions(+), 5281 deletions(-) diff: /srv/release.debian.org/tmp/5x0AfT6eXd/firefox-esr-68.5.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/local/bin: No such file or directory diff: /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/local/bin: No such file or directory diff: /srv/release.debian.org/tmp/5x0AfT6eXd/firefox-esr-68.5.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/local/lib: No such file or directory diff: /srv/release.debian.org/tmp/Ueus4k97a7/firefox-esr-68.6.0esr/obj-x86_64-pc-linux-gnu/_virtualenvs/init/local/lib: No such file or directory diff -Nru firefox-esr-68.5.0esr/browser/actors/WebRTCChild.jsm firefox-esr-68.6.0esr/browser/actors/WebRTCChild.jsm --- firefox-esr-68.5.0esr/browser/actors/WebRTCChild.jsm 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/actors/WebRTCChild.jsm 2020-03-05 20:56:39.000000000 +0000 @@ -222,7 +222,7 @@ // getting a microphone instead. if (audio && (device.mediaSource == "microphone") != sharingAudio) { audioDevices.push({ - name: device.name, + name: device.rawName, // unfiltered device name to show to the user deviceIndex: devices.length, id: device.rawId, mediaSource: device.mediaSource, @@ -235,7 +235,7 @@ // or that if we requested a screen share we aren't getting a camera. if (video && (device.mediaSource == "camera") != sharingScreen) { let deviceObject = { - name: device.name, + name: device.rawName, // unfiltered device name to show to the user deviceIndex: devices.length, id: device.rawId, mediaSource: device.mediaSource, diff -Nru firefox-esr-68.5.0esr/browser/app/blocklist.xml firefox-esr-68.6.0esr/browser/app/blocklist.xml --- firefox-esr-68.5.0esr/browser/app/blocklist.xml 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/app/blocklist.xml 2020-03-05 20:56:39.000000000 +0000 @@ -1,5 +1,5 @@ - + @@ -2948,10 +2948,6 @@ - - - - @@ -3424,10 +3420,6 @@ - - - - @@ -3616,6 +3608,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3648,15 +3772,15 @@ https://get.adobe.com/shockwave/ - - - https://get.adobe.com/flashplayer/ - - https://get.adobe.com/flashplayer/ - + + + + + https://get.adobe.com/flashplayer/ + diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/Policies.jsm firefox-esr-68.6.0esr/browser/components/enterprisepolicies/Policies.jsm --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/Policies.jsm 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/Policies.jsm 2020-03-05 20:56:39.000000000 +0000 @@ -1110,6 +1110,15 @@ setDefaultPermission("microphone", param.Microphone); } + if (param.Autoplay) { + addAllowDenyPermissions( + "autoplay-media", + param.Autoplay.Allow, + param.Autoplay.Block + ); + setDefaultPermission("autoplay-media", param.Autoplay); + } + if (param.Location) { addAllowDenyPermissions( "geo", @@ -1175,8 +1184,10 @@ onBeforeAddons(manager, param) { if (Array.isArray(param)) { Services.locale.requestedLocales = param; - } else { + } else if (param) { Services.locale.requestedLocales = param.split(","); + } else { + Services.locale.requestedLocales = []; } }, }, @@ -1196,47 +1207,100 @@ setAndLockPref("privacy.clearOnShutdown.offlineApps", true); } } else { - setAndLockPref("privacy.sanitize.sanitizeOnShutdown", true); + let locked = true; + // Needed to preserve original behavior in perpetuity. + let lockDefaultPrefs = true; + if ("Locked" in param) { + locked = param.Locked; + lockDefaultPrefs = false; + } + setDefaultPref("privacy.sanitize.sanitizeOnShutdown", true, locked); if ("Cache" in param) { - setAndLockPref("privacy.clearOnShutdown.cache", param.Cache); + setDefaultPref("privacy.clearOnShutdown.cache", param.Cache, locked); } else { - setAndLockPref("privacy.clearOnShutdown.cache", false); + setDefaultPref( + "privacy.clearOnShutdown.cache", + false, + lockDefaultPrefs + ); } if ("Cookies" in param) { - setAndLockPref("privacy.clearOnShutdown.cookies", param.Cookies); + setDefaultPref( + "privacy.clearOnShutdown.cookies", + param.Cookies, + locked + ); } else { - setAndLockPref("privacy.clearOnShutdown.cookies", false); + setDefaultPref( + "privacy.clearOnShutdown.cookies", + false, + lockDefaultPrefs + ); } if ("Downloads" in param) { - setAndLockPref("privacy.clearOnShutdown.downloads", param.Downloads); + setDefaultPref( + "privacy.clearOnShutdown.downloads", + param.Downloads, + locked + ); } else { - setAndLockPref("privacy.clearOnShutdown.downloads", false); + setDefaultPref( + "privacy.clearOnShutdown.downloads", + false, + lockDefaultPrefs + ); } if ("FormData" in param) { - setAndLockPref("privacy.clearOnShutdown.formdata", param.FormData); + setDefaultPref( + "privacy.clearOnShutdown.formdata", + param.FormData, + locked + ); } else { - setAndLockPref("privacy.clearOnShutdown.formdata", false); + setDefaultPref( + "privacy.clearOnShutdown.formdata", + false, + lockDefaultPrefs + ); } if ("History" in param) { - setAndLockPref("privacy.clearOnShutdown.history", param.History); + setDefaultPref( + "privacy.clearOnShutdown.history", + param.History, + locked + ); } else { - setAndLockPref("privacy.clearOnShutdown.history", false); + setDefaultPref( + "privacy.clearOnShutdown.history", + false, + lockDefaultPrefs + ); } if ("Sessions" in param) { - setAndLockPref("privacy.clearOnShutdown.sessions", param.Sessions); + setDefaultPref( + "privacy.clearOnShutdown.sessions", + param.Sessions, + locked + ); } else { - setAndLockPref("privacy.clearOnShutdown.sessions", false); + setDefaultPref( + "privacy.clearOnShutdown.sessions", + false, + lockDefaultPrefs + ); } if ("SiteSettings" in param) { - setAndLockPref( + setDefaultPref( "privacy.clearOnShutdown.siteSettings", - param.SiteSettings + param.SiteSettings, + locked ); } if ("OfflineApps" in param) { - setAndLockPref( + setDefaultPref( "privacy.clearOnShutdown.offlineApps", - param.OfflineApps + param.OfflineApps, + locked ); } } diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/content/aboutPolicies.js firefox-esr-68.6.0esr/browser/components/enterprisepolicies/content/aboutPolicies.js --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/content/aboutPolicies.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/content/aboutPolicies.js 2020-03-05 20:56:39.000000000 +0000 @@ -277,6 +277,7 @@ DisableSetDesktopBackground: "DisableSetAsDesktopBackground", Certificates: "CertificatesDescription", SanitizeOnShutdown: "SanitizeOnShutdown2", + Permissions: "Permissions2", }; for (let policyName in schema.properties) { diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/schemas/policies-schema.json firefox-esr-68.6.0esr/browser/components/enterprisepolicies/schemas/policies-schema.json --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/schemas/policies-schema.json 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/schemas/policies-schema.json 2020-03-05 20:56:39.000000000 +0000 @@ -617,6 +617,27 @@ } }, + "Autoplay": { + "type": "object", + "properties": { + "Allow": { + "type": "array", + "strict": false, + "items": { + "type": "origin" + } + }, + + "Block": { + "type": "array", + "strict": false, + "items": { + "type": "origin" + } + } + } + }, + "Location": { "type": "object", "properties": { @@ -947,6 +968,9 @@ }, "OfflineApps": { "type": "boolean" + }, + "Locked": { + "type": "boolean" } } }, diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_permissions.js firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_permissions.js --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_permissions.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_permissions.js 2020-03-05 20:56:39.000000000 +0000 @@ -8,7 +8,7 @@ } add_task(async function test_setup_preexisting_permissions() { - // Pre-existing ALLOW permissions that should be overriden + // Pre-existing ALLOW permissions that should be overridden // with DENY. // No ALLOW -> DENY override for popup and install permissions, @@ -38,8 +38,14 @@ Ci.nsIPermissionManager.ALLOW_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION ); + Services.perms.add( + URI("https://www.pre-existing-allow.com"), + "autoplay-media", + Ci.nsIPermissionManager.ALLOW_ACTION, + Ci.nsIPermissionManager.EXPIRE_SESSION + ); - // Pre-existing DENY permissions that should be overriden + // Pre-existing DENY permissions that should be overridden // with ALLOW. Services.perms.add( @@ -66,6 +72,12 @@ Ci.nsIPermissionManager.DENY_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION ); + Services.perms.add( + URI("https://www.pre-existing-deny.com"), + "autoplay-media", + Ci.nsIPermissionManager.DENY_ACTION, + Ci.nsIPermissionManager.EXPIRE_SESSION + ); }); add_task(async function test_setup_activate_policies() { @@ -88,6 +100,10 @@ Allow: ["https://www.allow.com", "https://www.pre-existing-deny.com"], Block: ["https://www.deny.com", "https://www.pre-existing-allow.com"], }, + Autoplay: { + Allow: ["https://www.allow.com", "https://www.pre-existing-deny.com"], + Block: ["https://www.deny.com", "https://www.pre-existing-allow.com"], + }, }, }, }); @@ -150,6 +166,10 @@ checkAllPermissionsForType("desktop-notification"); }); +add_task(async function test_autoplay_policy() { + checkAllPermissionsForType("autoplay-media"); +}); + add_task(async function test_change_permission() { // Checks that changing a permission will still retain the // value set through the engine. @@ -177,11 +197,18 @@ Ci.nsIPermissionManager.DENY_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION ); + Services.perms.add( + URI("https://www.allow.com"), + "autoplay-media", + Ci.nsIPermissionManager.DENY_ACTION, + Ci.nsIPermissionManager.EXPIRE_SESSION + ); checkPermission("allow.com", "ALLOW", "camera"); checkPermission("allow.com", "ALLOW", "microphone"); checkPermission("allow.com", "ALLOW", "geo"); checkPermission("allow.com", "ALLOW", "desktop-notification"); + checkPermission("allow.com", "ALLOW", "autoplay-media"); // Also change one un-managed permission to make sure it doesn't // cause any problems to the policy engine or the permission manager. @@ -209,6 +236,12 @@ Ci.nsIPermissionManager.DENY_ACTION, Ci.nsIPermissionManager.EXPIRE_SESSION ); + Services.perms.add( + URI("https://www.unmanaged.com"), + "autoplay-media", + Ci.nsIPermissionManager.DENY_ACTION, + Ci.nsIPermissionManager.EXPIRE_SESSION + ); }); add_task(async function test_setup_trackingprotection() { diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_requestedlocales.js firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_requestedlocales.js --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_requestedlocales.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_requestedlocales.js 2020-03-05 20:56:39.000000000 +0000 @@ -45,3 +45,24 @@ await localePromise; Services.locale.requestedLocales = originalLocales; }); + +add_task(async function test_system_locale_string() { + let originalLocales = Services.locale.requestedLocales; + + let localePromise = promiseLocaleChanged("und"); + Services.locale.requestedLocales = ["und"]; + await localePromise; + + let systemLocale = Cc["@mozilla.org/intl/ospreferences;1"].getService( + Ci.mozIOSPreferences + ).systemLocale; + localePromise = promiseLocaleChanged(systemLocale); + + await setupPolicyEngineWithJson({ + policies: { + RequestedLocales: "", + }, + }); + await localePromise; + Services.locale.requestedLocales = originalLocales; +}); diff -Nru firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js --- firefox-esr-68.5.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/enterprisepolicies/tests/xpcshell/test_simple_pref_policies.js 2020-03-05 20:56:39.000000000 +0000 @@ -355,6 +355,66 @@ }, }, + // POLICY: SanitizeOnShutdown using Locked + { + policies: { + SanitizeOnShutdown: { + Cache: true, + Locked: true, + }, + }, + lockedPrefs: { + "privacy.sanitize.sanitizeOnShutdown": true, + "privacy.clearOnShutdown.cache": true, + }, + unlockedPrefs: { + "privacy.clearOnShutdown.cookies": false, + "privacy.clearOnShutdown.downloads": false, + "privacy.clearOnShutdown.formdata": false, + "privacy.clearOnShutdown.history": false, + "privacy.clearOnShutdown.sessions": false, + }, + }, + + { + policies: { + SanitizeOnShutdown: { + Cache: true, + Cookies: false, + Locked: true, + }, + }, + lockedPrefs: { + "privacy.sanitize.sanitizeOnShutdown": true, + "privacy.clearOnShutdown.cache": true, + "privacy.clearOnShutdown.cookies": false, + }, + unlockedPrefs: { + "privacy.clearOnShutdown.downloads": false, + "privacy.clearOnShutdown.formdata": false, + "privacy.clearOnShutdown.history": false, + "privacy.clearOnShutdown.sessions": false, + }, + }, + + { + policies: { + SanitizeOnShutdown: { + Cache: true, + Locked: false, + }, + }, + unlockedPrefs: { + "privacy.sanitize.sanitizeOnShutdown": true, + "privacy.clearOnShutdown.cache": true, + "privacy.clearOnShutdown.cookies": false, + "privacy.clearOnShutdown.downloads": false, + "privacy.clearOnShutdown.formdata": false, + "privacy.clearOnShutdown.history": false, + "privacy.clearOnShutdown.sessions": false, + }, + }, + // POLICY: DNSOverHTTPS Locked { policies: { diff -Nru firefox-esr-68.5.0esr/browser/components/extensions/test/browser/browser_ext_tabs_events.js firefox-esr-68.6.0esr/browser/components/extensions/test/browser/browser_ext_tabs_events.js --- firefox-esr-68.5.0esr/browser/components/extensions/test/browser/browser_ext_tabs_events.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/components/extensions/test/browser/browser_ext_tabs_events.js 2020-03-05 20:56:39.000000000 +0000 @@ -77,16 +77,24 @@ } try { - let windows = await Promise.all([ - browser.windows.create({ url: "about:blank", incognito }), - browser.windows.create({ url: "about:blank", incognito }), - ]); + let firstWindow = await browser.windows.create({ + url: "about:blank", + incognito, + }); + let otherWindow = await browser.windows.create({ + url: "about:blank", + incognito, + }); - let windowId = windows[0].id; - let otherWindowId = windows[1].id; + let windowId = firstWindow.id; + let otherWindowId = otherWindow.id; - let created = await expectEvents(["onCreated", "onCreated"]); - let initialTab = created[1].tab; + // Wait for a tab in each window + await expectEvents(["onCreated", "onCreated"]); + let initialTab = (await browser.tabs.query({ + active: true, + windowId: otherWindowId, + }))[0]; browser.test.log("Create tab in window 1"); let tab = await browser.tabs.create({ @@ -98,7 +106,7 @@ browser.test.assertEq(0, oldIndex, "Tab has the expected index"); browser.test.assertEq(tab.incognito, incognito, "Tab is incognito"); - [created] = await expectEvents(["onCreated"]); + let [created] = await expectEvents(["onCreated"]); browser.test.assertEq(tab.id, created.tab.id, "Got expected tab ID"); browser.test.assertEq( oldIndex, @@ -159,7 +167,11 @@ await browser.tabs.remove(tab.id); let [removed] = await expectEvents(["onRemoved"]); - browser.test.assertEq(tab.id, removed.tabId, "Expected removed tab ID"); + browser.test.assertEq( + tab.id, + removed.tabId, + "Expected removed tab ID for tabs.remove" + ); browser.test.assertEq( otherWindowId, removed.windowId, @@ -178,7 +190,7 @@ browser.test.assertEq( initialTab.id, removed.tabId, - "Expected removed tab ID" + "Expected removed tab ID for windows.remove" ); browser.test.assertEq( otherWindowId, @@ -408,7 +420,7 @@ await extension.unload(); SpecialPowers.clearUserPref(RESOLUTION_PREF); -}); +}).skip(); // Bug 1614075 perma-fail comparing devicePixelRatio add_task(async function testTabRemovalEvent() { async function background() { @@ -561,8 +573,9 @@ }); add_task(async function testLastTabRemoval() { - const CLOSE_WINDOW_PREF = "browser.tabs.closeWindowWithLastTab"; - await SpecialPowers.pushPrefEnv({ set: [[CLOSE_WINDOW_PREF, false]] }); + await SpecialPowers.pushPrefEnv({ + set: [["browser.tabs.closeWindowWithLastTab", false]], + }); async function background() { let windowId; @@ -602,7 +615,7 @@ await extension.unload(); await BrowserTestUtils.closeWindow(newWin); - SpecialPowers.clearUserPref(CLOSE_WINDOW_PREF); + await SpecialPowers.popPrefEnv(); }); add_task(async function testTabActivationEvent() { diff -Nru firefox-esr-68.5.0esr/browser/config/version.txt firefox-esr-68.6.0esr/browser/config/version.txt --- firefox-esr-68.5.0esr/browser/config/version.txt 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/config/version.txt 2020-03-05 20:56:39.000000000 +0000 @@ -1 +1 @@ -68.5.0 +68.6.0 diff -Nru firefox-esr-68.5.0esr/browser/config/version_display.txt firefox-esr-68.6.0esr/browser/config/version_display.txt --- firefox-esr-68.5.0esr/browser/config/version_display.txt 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/config/version_display.txt 2020-03-05 20:56:39.000000000 +0000 @@ -1 +1 @@ -68.5.0esr +68.6.0esr diff -Nru firefox-esr-68.5.0esr/browser/extensions/webcompat/data/injections.js firefox-esr-68.6.0esr/browser/extensions/webcompat/data/injections.js --- firefox-esr-68.5.0esr/browser/extensions/webcompat/data/injections.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/extensions/webcompat/data/injections.js 2020-03-05 20:56:39.000000000 +0000 @@ -444,6 +444,21 @@ ], }, }, + { + id: "bug1610344", + platform: "android", + domain: "directv.com.co", + bug: "1610344", + contentScripts: { + matches: ["https://*.directv.com.co/*"], + css: [ + { + file: + "injections/css/bug1610344-directv.com.co-hide-unsupported-message.css", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff -Nru firefox-esr-68.5.0esr/browser/extensions/webcompat/data/ua_overrides.js firefox-esr-68.6.0esr/browser/extensions/webcompat/data/ua_overrides.js --- firefox-esr-68.5.0esr/browser/extensions/webcompat/data/ua_overrides.js 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/extensions/webcompat/data/ua_overrides.js 2020-03-05 20:56:39.000000000 +0000 @@ -218,30 +218,8 @@ }, { /* - * Bug 1480710 - m.imgur.com - Build UA override - * WebCompat issue #13154 - https://webcompat.com/issues/13154 - * - * imgur returns a 404 for requests to CSS and JS file if requested with a Fennec - * User Agent. By removing the Fennec identifies and adding Chrome Mobile's, we - * receive the correct CSS and JS files. - */ - id: "bug1480710", - platform: "android", - domain: "m.imgur.com", - bug: "1480710", - config: { - matches: ["*://m.imgur.com/*"], - uaTransformer: originalUA => { - return ( - UAHelpers.getPrefix(originalUA) + - " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.85 Mobile Safari/537.36" - ); - }, - }, - }, - { - /* * Bug 945963 - tieba.baidu.com serves simplified mobile content to Firefox Android + * additionally, Bug 1525839 for more domains * WebCompat issue #18455 - https://webcompat.com/issues/18455 * * tieba.baidu.com and tiebac.baidu.com serve a heavily simplified and less functional @@ -254,8 +232,12 @@ bug: "945963", config: { matches: [ + "*://baike.baidu.com/*", + "*://image.baidu.com/*", + "*://news.baidu.com/*", "*://tieba.baidu.com/*", "*://tiebac.baidu.com/*", + "*://wenku.baidu.com/*", "*://zhidao.baidu.com/*", ], uaTransformer: originalUA => { @@ -303,25 +285,6 @@ }, { /* - * Bug 1338260 - Add UA override for directTV - * (Imported from ua-update.json.in) - * - * DirectTV has issues with scrolling and cut-off images. Pretending to be - * Chrome for Android fixes those issues. - */ - id: "bug1338260", - platform: "android", - domain: "directv.com", - bug: "1338260", - config: { - matches: ["*://*.directv.com/*"], - uaTransformer: _ => { - return "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36"; - }, - }, - }, - { - /* * Bug 1385206 - Create UA override for rakuten.co.jp on Firefox Android * (Imported from ua-update.json.in) * @@ -443,25 +406,6 @@ }, { /* - * Bug 1567945 - Create UA override for beeg.com on Firefox Android - * WebCompat issue #16648 - https://webcompat.com/issues/16648 - * - * beeg.com is hiding content of a page with video if Firefox exists in UA, - * replacing "Firefox" with an empty string makes the page load - */ - id: "bug1567945", - platform: "android", - domain: "beeg.com", - bug: "1567945", - config: { - matches: ["*://beeg.com/*"], - uaTransformer: originalUA => { - return originalUA.replace(/Firefox.+$/, ""); - }, - }, - }, - { - /* * Bug 1574522 - UA override for enuri.com on Firefox for Android * WebCompat issue #37139 - https://webcompat.com/issues/37139 * @@ -647,6 +591,27 @@ }, }, }, + { + /* + * Bug 1442050 - UA overrides for my.nintendo.com + * Webcompat issue #12887 - https://webcompat.com/issues/12887 + * + * Nintendo ships a broken version of their mobile interface to mobile + * browsers that are not Chrome or Safari. In our tests, appending the + * "AppleWebKit" identifier to the UA string results in a version that + * works very well. + */ + id: "bug1442050", + platform: "android", + domain: "nintendo.com", + bug: "1442050", + config: { + matches: ["*://my.nintendo.com/*"], + uaTransformer: originalUA => { + return originalUA + " AppleWebKit"; + }, + }, + }, ]; const UAHelpers = { diff -Nru firefox-esr-68.5.0esr/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css firefox-esr-68.6.0esr/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css --- firefox-esr-68.5.0esr/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css 1970-01-01 00:00:00.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/extensions/webcompat/injections/css/bug1610344-directv.com.co-hide-unsupported-message.css 2020-03-05 20:56:39.000000000 +0000 @@ -0,0 +1,13 @@ +/** + * directv.com.co - Browser is not supported message + * Bug #1610344 - https://bugzilla.mozilla.org/show_bug.cgi?id=1610344 + * WebCompat issue #41822 - https://webcompat.com/issues/41822 + * + * directv.com.co is showing a "This browser is not supported" message in + * Firefox. Our tests indicated that everything is working just fine, and our + * previous contact attempts have not been successful. This intervention + * hides the large red unsupported banner. + */ +.browser-compatible.compatible.incompatible { + display: none; +} diff -Nru firefox-esr-68.5.0esr/browser/extensions/webcompat/manifest.json firefox-esr-68.6.0esr/browser/extensions/webcompat/manifest.json --- firefox-esr-68.5.0esr/browser/extensions/webcompat/manifest.json 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/extensions/webcompat/manifest.json 2020-03-05 20:56:39.000000000 +0000 @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Web Compat", "description": "Urgent post-release fixes for web compatibility.", - "version": "7.0.0", + "version": "8.0.0", "applications": { "gecko": { diff -Nru firefox-esr-68.5.0esr/browser/extensions/webcompat/moz.build firefox-esr-68.6.0esr/browser/extensions/webcompat/moz.build --- firefox-esr-68.5.0esr/browser/extensions/webcompat/moz.build 2020-02-07 00:26:51.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/extensions/webcompat/moz.build 2020-03-05 20:56:39.000000000 +0000 @@ -61,6 +61,7 @@ 'injections/css/bug1605611-maps.google.com-directions-time.css', 'injections/css/bug1609991-cracked.com-flex-basis-fix.css', 'injections/css/bug1610016-gaana.com-input-position-fix.css', + 'injections/css/bug1610344-directv.com.co-hide-unsupported-message.css', ] FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [ diff -Nru firefox-esr-68.5.0esr/browser/locales/en-US/browser/policies/policies-descriptions.ftl firefox-esr-68.6.0esr/browser/locales/en-US/browser/policies/policies-descriptions.ftl --- firefox-esr-68.5.0esr/browser/locales/en-US/browser/policies/policies-descriptions.ftl 2020-02-07 00:26:56.000000000 +0000 +++ firefox-esr-68.6.0esr/browser/locales/en-US/browser/policies/policies-descriptions.ftl 2020-03-05 20:56:39.000000000 +0000 @@ -127,7 +127,7 @@ policy-PasswordManagerEnabled = Enable saving passwords to the password manager. -policy-Permissions = Configure permissions for camera, microphone, location and notifications. +policy-Permissions2 = Configure permissions for camera, microphone, location, notifications, and autoplay. policy-PopupBlocking = Allow certain websites to display popups by default. diff -Nru firefox-esr-68.5.0esr/config/milestone.txt firefox-esr-68.6.0esr/config/milestone.txt --- firefox-esr-68.5.0esr/config/milestone.txt 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/config/milestone.txt 2020-03-05 20:56:40.000000000 +0000 @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -68.5.0 +68.6.0 diff -Nru firefox-esr-68.5.0esr/debian/changelog firefox-esr-68.6.0esr/debian/changelog --- firefox-esr-68.5.0esr/debian/changelog 2020-02-11 21:50:33.000000000 +0000 +++ firefox-esr-68.6.0esr/debian/changelog 2020-03-10 21:59:57.000000000 +0000 @@ -1,3 +1,12 @@ +firefox-esr (68.6.0esr-1~deb10u1) buster-security; urgency=medium + + * New upstream release + * Fixes for mfsa2020-09, also known as: + CVE-2020-6805, CVE-2020-6806, CVE-2020-6807, CVE-2020-6811, + CVE-2019-20503, CVE-2020-6812, CVE-2020-6814. + + -- Mike Hommey Wed, 11 Mar 2020 06:59:57 +0900 + firefox-esr (68.5.0esr-1~deb10u1) buster-security; urgency=medium * New upstream release diff -Nru firefox-esr-68.5.0esr/devtools/client/shared/curl.js firefox-esr-68.6.0esr/devtools/client/shared/curl.js --- firefox-esr-68.5.0esr/devtools/client/shared/curl.js 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/devtools/client/shared/curl.js 2020-03-05 20:56:40.000000000 +0000 @@ -59,6 +59,18 @@ const utils = CurlUtils; let command = ["curl"]; + + // Make sure to use the following helpers to sanitize arguments before execution. + const addParam = value => { + const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value); + command.push(safe); + }; + + const addPostData = value => { + const safe = /^[a-zA-Z-]+$/.test(value) ? value : escapeString(value); + postData.push(safe); + }; + const ignoredHeaders = new Set(); // The cURL command is expected to run on the same platform that Firefox runs @@ -69,7 +81,7 @@ : utils.escapeStringPosix; // Add URL. - command.push(escapeString(data.url)); + addParam(data.url); let postDataText = null; const multipartRequest = utils.isMultipartRequest(data); @@ -85,21 +97,21 @@ // which composed using \n only, not \r\n, may be not parsable for // peers which split parts of multipart payload using \r\n. postDataText = data.postDataText; - postData.push("--data-binary"); + addPostData("--data-binary"); const boundary = utils.getMultipartBoundary(data); const text = utils.removeBinaryDataFromMultipartText( postDataText, boundary ); - postData.push(escapeString(text)); + addPostData(text); ignoredHeaders.add("content-length"); } else if ( utils.isUrlEncodedRequest(data) || ["PUT", "POST", "PATCH"].includes(data.method) ) { postDataText = data.postDataText; - postData.push("--data"); - postData.push(escapeString(utils.writePostDataTextParams(postDataText))); + addPostData("--data"); + addPostData(utils.writePostDataTextParams(postDataText)); ignoredHeaders.add("content-length"); } // curl generates the host header itself based on the given URL @@ -109,13 +121,13 @@ // For servers that supports HEAD. // This will fetch the header of a document only. if (data.method == "HEAD") { - command.push("-I"); + addParam("-I"); } else if (!(data.method == "GET" || data.method == "POST")) { // Add method. // For HEAD, GET and POST requests this is not necessary. GET is the // default, if --data or --binary is added POST is used, -I implies HEAD. - command.push("-X"); - command.push(data.method); + addParam("-X"); + addParam(data.method); } // Add request headers. @@ -127,14 +139,14 @@ for (let i = 0; i < headers.length; i++) { const header = headers[i]; if (header.name.toLowerCase() === "accept-encoding") { - command.push("--compressed"); + addParam("--compressed"); continue; } if (ignoredHeaders.has(header.name.toLowerCase())) { continue; } - command.push("-H"); - command.push(escapeString(header.name + ": " + header.value)); + addParam("-H"); + addParam(header.name + ": " + header.value); } // Add post data. diff -Nru firefox-esr-68.5.0esr/dom/base/EventSource.cpp firefox-esr-68.6.0esr/dom/base/EventSource.cpp --- firefox-esr-68.5.0esr/dom/base/EventSource.cpp 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/base/EventSource.cpp 2020-03-05 20:56:45.000000000 +0000 @@ -377,6 +377,10 @@ return; } + // Ensure EventSourceImpl itself alive until the cleanup is completed, since + // it's possible to only be held by WorkerRef. + RefPtr kungFuDeathGrip = this; + // Invoke CleanupOnMainThread before cleaning any members. It will call // ShutDown, which is supposed to be called before cleaning any members. if (NS_IsMainThread()) { diff -Nru firefox-esr-68.5.0esr/dom/base/Navigator.cpp firefox-esr-68.6.0esr/dom/base/Navigator.cpp --- firefox-esr-68.5.0esr/dom/base/Navigator.cpp 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/base/Navigator.cpp 2020-03-05 20:56:45.000000000 +0000 @@ -1032,8 +1032,7 @@ // release the loadgroup first mLoadGroup = nullptr; - aRequest->Cancel(NS_ERROR_NET_INTERRUPT); - return NS_BINDING_ABORTED; + return NS_ERROR_ABORT; } NS_IMETHODIMP diff -Nru firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceChild.cpp firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceChild.cpp --- firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceChild.cpp 2020-02-07 00:26:58.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceChild.cpp 2020-03-05 20:56:46.000000000 +0000 @@ -33,7 +33,7 @@ bool ClientSourceChild::DeallocPClientSourceOpChild( PClientSourceOpChild* aActor) { - delete aActor; + static_cast(aActor)->ScheduleDeletion(); return true; } diff -Nru firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceOpChild.cpp firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.cpp --- firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceOpChild.cpp 2020-02-07 00:26:58.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.cpp 2020-03-05 20:56:46.000000000 +0000 @@ -8,6 +8,7 @@ #include "ClientSource.h" #include "ClientSourceChild.h" +#include "mozilla/Assertions.h" #include "mozilla/Unused.h" namespace mozilla { @@ -70,7 +71,7 @@ } void ClientSourceOpChild::ActorDestroy(ActorDestroyReason aReason) { - mPromiseRequestHolder.DisconnectIfExists(); + Cleanup(); } void ClientSourceOpChild::Init(const ClientOpConstructorArgs& aArgs) { @@ -101,6 +102,31 @@ break; } } + + mInitialized = true; + + if (mDeletionRequested) { + Cleanup(); + delete this; + } +} + +void ClientSourceOpChild::ScheduleDeletion() { + if (mInitialized) { + Cleanup(); + delete this; + return; + } + + mDeletionRequested = true; +} + +ClientSourceOpChild::~ClientSourceOpChild() { + MOZ_DIAGNOSTIC_ASSERT(mInitialized); +} + +void ClientSourceOpChild::Cleanup() { + mPromiseRequestHolder.DisconnectIfExists(); } } // namespace dom diff -Nru firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceOpChild.h firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.h --- firefox-esr-68.5.0esr/dom/clients/manager/ClientSourceOpChild.h 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/clients/manager/ClientSourceOpChild.h 2020-03-05 20:56:46.000000000 +0000 @@ -15,7 +15,17 @@ class ClientSource; class ClientSourceOpChild final : public PClientSourceOpChild { - MozPromiseRequestHolder mPromiseRequestHolder; + public: + void Init(const ClientOpConstructorArgs& aArgs); + + // Deletes "this" after initialization (or immediately if already + // initialized.) It's UB to use "this" after calling ScheduleDeletion. + void ScheduleDeletion(); + + private: + ~ClientSourceOpChild(); + + void Cleanup(); ClientSource* GetSource() const; @@ -25,11 +35,9 @@ // PClientSourceOpChild interface void ActorDestroy(ActorDestroyReason aReason) override; - public: - ClientSourceOpChild() = default; - ~ClientSourceOpChild() = default; - - void Init(const ClientOpConstructorArgs& aArgs); + MozPromiseRequestHolder mPromiseRequestHolder; + bool mDeletionRequested = false; + bool mInitialized = false; }; } // namespace dom diff -Nru firefox-esr-68.5.0esr/dom/fetch/FetchStream.cpp firefox-esr-68.6.0esr/dom/fetch/FetchStream.cpp --- firefox-esr-68.5.0esr/dom/fetch/FetchStream.cpp 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/fetch/FetchStream.cpp 2020-03-05 20:56:45.000000000 +0000 @@ -5,9 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "FetchStream.h" +#include "mozilla/CycleCollectedJSContext.h" #include "mozilla/dom/DOMException.h" +#include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/WorkerCommon.h" #include "mozilla/dom/WorkerPrivate.h" +#include "mozilla/Maybe.h" #include "nsProxyRelease.h" #include "nsStreamUtils.h" @@ -305,24 +308,21 @@ AssertIsOnOwningThread(); MOZ_DIAGNOSTIC_ASSERT(aStream); - MutexAutoLock lock(mMutex); + Maybe lock; + lock.emplace(mMutex); // Already closed. We have nothing else to do here. if (mState == eClosed) { return NS_OK; } + nsAutoMicroTask mt; + AutoEntryScript aes(mGlobal, "fetch body data available"); + MOZ_DIAGNOSTIC_ASSERT(mInputStream); MOZ_DIAGNOSTIC_ASSERT(mState == eReading || mState == eChecking); - AutoJSAPI jsapi; - if (NS_WARN_IF(!jsapi.Init(mGlobal))) { - // Without JSContext we are not able to close the stream or to propagate the - // error. - return NS_ERROR_FAILURE; - } - - JSContext* cx = jsapi.cx(); + JSContext* cx = aes.cx(); JS::Rooted stream(cx, mStreamHolder->ReadableStreamBody()); uint64_t size = 0; @@ -335,7 +335,7 @@ // No warning for stream closed. if (rv == NS_BASE_STREAM_CLOSED || NS_WARN_IF(NS_FAILED(rv))) { - ErrorPropagation(cx, lock, stream, rv); + ErrorPropagation(cx, *lock, stream, rv); return NS_OK; } @@ -347,13 +347,9 @@ mState = eWriting; - { - MutexAutoUnlock unlock(mMutex); - JS::ReadableStreamUpdateDataAvailableFromSource(cx, stream, size); - } + lock.reset(); - // The WriteInto callback changes mState to eChecking. - MOZ_DIAGNOSTIC_ASSERT(mState == eChecking); + JS::ReadableStreamUpdateDataAvailableFromSource(cx, stream, size); return NS_OK; } diff -Nru firefox-esr-68.5.0esr/dom/indexedDB/test/mochitest.ini firefox-esr-68.6.0esr/dom/indexedDB/test/mochitest.ini --- firefox-esr-68.5.0esr/dom/indexedDB/test/mochitest.ini 2020-02-07 00:26:57.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/indexedDB/test/mochitest.ini 2020-03-05 20:56:45.000000000 +0000 @@ -178,6 +178,7 @@ [test_filehandle_compat.html] [test_filehandle_disabled_pref.html] [test_filehandle_getFile.html] +skip-if = true [test_filehandle_iteration.html] [test_filehandle_lifetimes.html] [test_filehandle_lifetimes_nested.html] diff -Nru firefox-esr-68.5.0esr/dom/media/MediaManager.cpp firefox-esr-68.6.0esr/dom/media/MediaManager.cpp --- firefox-esr-68.5.0esr/dom/media/MediaManager.cpp 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/media/MediaManager.cpp 2020-03-05 20:56:46.000000000 +0000 @@ -713,7 +713,8 @@ mName(aName), mID(aID), mGroupID(aGroupID), - mRawID(aRawID) { + mRawID(aRawID), + mRawName(aName) { MOZ_ASSERT(mSource); } @@ -731,7 +732,8 @@ mName(mSinkInfo->Name()), mID(aID), mGroupID(aGroupID), - mRawID(aRawID) { + mRawID(aRawID), + mRawName(mSinkInfo->Name()) { // For now this ctor is used only for Audiooutput. // It could be used for Audioinput and Videoinput // when we do not instantiate a MediaEngineSource @@ -742,15 +744,22 @@ MediaDevice::MediaDevice(const RefPtr& aOther, const nsString& aID, const nsString& aGroupID, const nsString& aRawID) + : MediaDevice(aOther, aID, aGroupID, aRawID, aOther->mName, false) {} + +MediaDevice::MediaDevice(const RefPtr& aOther, const nsString& aID, + const nsString& aGroupID, const nsString& aRawID, + const nsString& aName, + bool aCompilerBugWorkaround) : mSource(aOther->mSource), mSinkInfo(aOther->mSinkInfo), mKind(aOther->mKind), mScary(aOther->mScary), mType(aOther->mType), - mName(aOther->mName), + mName(aName), mID(aID), mGroupID(aGroupID), - mRawID(aRawID) { + mRawID(aRawID), + mRawName(aOther->mRawName) { MOZ_ASSERT(aOther); } @@ -823,6 +832,13 @@ } NS_IMETHODIMP +MediaDevice::GetRawName(nsAString& aName) { + MOZ_ASSERT(NS_IsMainThread()); + aName.Assign(mRawName); + return NS_OK; +} + +NS_IMETHODIMP MediaDevice::GetType(nsAString& aType) { MOZ_ASSERT(NS_IsMainThread()); aType.Assign(mType); @@ -2974,7 +2990,12 @@ groupId.AppendInt(aWindowId); AnonymizeId(groupId, aOriginKey); - device = new MediaDevice(device, id, groupId, rawId); + nsString name; + device->GetName(name); + if (name.Find(NS_LITERAL_STRING("AirPods")) != -1) { + name = NS_LITERAL_STRING("AirPods"); + } + device = new MediaDevice(device, id, groupId, rawId, name, false); } } } diff -Nru firefox-esr-68.5.0esr/dom/media/MediaManager.h firefox-esr-68.6.0esr/dom/media/MediaManager.h --- firefox-esr-68.5.0esr/dom/media/MediaManager.h 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/media/MediaManager.h 2020-03-05 20:56:46.000000000 +0000 @@ -77,6 +77,10 @@ MediaDevice(const RefPtr& aOther, const nsString& aID, const nsString& aGroupID, const nsString& aRawID); + MediaDevice(const RefPtr& aOther, const nsString& aID, + const nsString& aGroupID, const nsString& aRawID, + const nsString& aName, bool aCompilerBugWorkaround); + uint32_t GetBestFitnessDistance( const nsTArray& aConstraintSets, bool aIsChrome); @@ -127,6 +131,7 @@ const nsString mID; const nsString mGroupID; const nsString mRawID; + const nsString mRawName; }; typedef nsRefPtrHashtable diff -Nru firefox-esr-68.5.0esr/dom/media/nsIDOMNavigatorUserMedia.idl firefox-esr-68.6.0esr/dom/media/nsIDOMNavigatorUserMedia.idl --- firefox-esr-68.5.0esr/dom/media/nsIDOMNavigatorUserMedia.idl 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/media/nsIDOMNavigatorUserMedia.idl 2020-03-05 20:56:46.000000000 +0000 @@ -9,10 +9,11 @@ interface nsIMediaDevice : nsISupports { readonly attribute AString type; - readonly attribute AString name; + readonly attribute AString name; // may have personal info filtered out readonly attribute AString id; readonly attribute AString mediaSource; readonly attribute AString rawId; readonly attribute AString groupId; readonly attribute boolean scary; + readonly attribute AString rawName; // unfiltered device name, from 1616661 }; diff -Nru firefox-esr-68.5.0esr/dom/quota/ActorsParent.cpp firefox-esr-68.6.0esr/dom/quota/ActorsParent.cpp --- firefox-esr-68.5.0esr/dom/quota/ActorsParent.cpp 2020-02-07 00:26:58.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/quota/ActorsParent.cpp 2020-03-05 20:56:46.000000000 +0000 @@ -8221,74 +8221,28 @@ initialized = aQuotaManager->IsTemporaryStorageInitialized(); } - bool hasOtherClient = false; - UsageInfo usageInfo; if (!mClientType.IsNull()) { - // Checking whether there is any other client in the directory is needed. - // If there is not, removing whole directory is needed. - nsCOMPtr originEntries; - if (NS_WARN_IF(NS_FAILED( - file->GetDirectoryEntries(getter_AddRefs(originEntries)))) || - !originEntries) { + nsAutoString clientDirectoryName; + nsresult rv = Client::TypeToText(mClientType.Value(), clientDirectoryName); + if (NS_WARN_IF(NS_FAILED(rv))) { return; } - nsCOMPtr clientFile; - while (NS_SUCCEEDED((rv = originEntries->GetNextFile( - getter_AddRefs(clientFile)))) && - clientFile) { - bool isDirectory; - rv = clientFile->IsDirectory(&isDirectory); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - - if (!isDirectory) { - continue; - } - - nsString leafName; - rv = clientFile->GetLeafName(leafName); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - - Client::Type clientType; - rv = Client::TypeFromText(leafName, clientType); - if (NS_FAILED(rv)) { - UNKNOWN_FILE_WARNING(leafName); - continue; - } - - if (clientType != mClientType.Value()) { - hasOtherClient = true; - break; - } + rv = file->Append(clientDirectoryName); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; } - if (hasOtherClient) { - nsAutoString clientDirectoryName; - rv = Client::TypeToText(mClientType.Value(), clientDirectoryName); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - - rv = file->Append(clientDirectoryName); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } - - bool exists; - rv = file->Exists(&exists); - if (NS_WARN_IF(NS_FAILED(rv))) { - return; - } + bool exists; + rv = file->Exists(&exists); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } - if (!exists) { - continue; - } + if (!exists) { + continue; } if (initialized) { @@ -8326,13 +8280,11 @@ } if (aPersistenceType != PERSISTENCE_TYPE_PERSISTENT) { - if (hasOtherClient) { - MOZ_ASSERT(!mClientType.IsNull()); - + if (mClientType.IsNull()) { + aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin); + } else { aQuotaManager->DecreaseUsageForOrigin(aPersistenceType, group, origin, usageInfo.TotalUsage()); - } else { - aQuotaManager->RemoveQuotaForOrigin(aPersistenceType, group, origin); } } diff -Nru firefox-esr-68.5.0esr/dom/quota/test/unit/head.js firefox-esr-68.6.0esr/dom/quota/test/unit/head.js --- firefox-esr-68.5.0esr/dom/quota/test/unit/head.js 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/quota/test/unit/head.js 2020-03-05 20:56:46.000000000 +0000 @@ -19,6 +19,10 @@ Assert.ok(!!cond, msg); } +function todo(cond, msg) { + todo_check_true(cond); +} + function run_test() { runTest(); } diff -Nru firefox-esr-68.5.0esr/dom/quota/test/unit/test_clearStorageForPrincipal.js firefox-esr-68.6.0esr/dom/quota/test/unit/test_clearStorageForPrincipal.js --- firefox-esr-68.5.0esr/dom/quota/test/unit/test_clearStorageForPrincipal.js 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/quota/test/unit/test_clearStorageForPrincipal.js 2020-03-05 20:56:46.000000000 +0000 @@ -48,7 +48,7 @@ file = getRelativeFile(testingOrigins[i].path); if (testingOrigins[i].only_idb) { - ok(!file.exists(), "Origin file doesn't exist"); + todo(!file.exists(), "Origin file doesn't exist"); } else { ok(file.exists(), "Origin file does exist"); } diff -Nru firefox-esr-68.5.0esr/dom/xhr/XMLHttpRequestWorker.cpp firefox-esr-68.6.0esr/dom/xhr/XMLHttpRequestWorker.cpp --- firefox-esr-68.5.0esr/dom/xhr/XMLHttpRequestWorker.cpp 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/xhr/XMLHttpRequestWorker.cpp 2020-03-05 20:56:46.000000000 +0000 @@ -1939,7 +1939,7 @@ return; } - if (!mProxy) { + if (!mProxy || mStateData.mFlagSend) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; } diff -Nru firefox-esr-68.5.0esr/dom/xhr/tests/mochitest.ini firefox-esr-68.6.0esr/dom/xhr/tests/mochitest.ini --- firefox-esr-68.5.0esr/dom/xhr/tests/mochitest.ini 2020-02-07 00:27:03.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/xhr/tests/mochitest.ini 2020-03-05 20:56:52.000000000 +0000 @@ -115,3 +115,5 @@ [test_nestedSyncXHR.html] [test_event_listener_leaks.html] skip-if = (os == "win" && processor == "aarch64") #bug 1535784 +[test_worker_xhr_doubleSend.html] +support-files = xhr_worker_doubleSend.js diff -Nru firefox-esr-68.5.0esr/dom/xhr/tests/test_worker_xhr_doubleSend.html firefox-esr-68.6.0esr/dom/xhr/tests/test_worker_xhr_doubleSend.html --- firefox-esr-68.5.0esr/dom/xhr/tests/test_worker_xhr_doubleSend.html 1970-01-01 00:00:00.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/xhr/tests/test_worker_xhr_doubleSend.html 2020-03-05 20:56:46.000000000 +0000 @@ -0,0 +1,32 @@ + + + + + Test for DOM Worker Threads XHR - double send + + + + + + + + + + diff -Nru firefox-esr-68.5.0esr/dom/xhr/tests/xhr_worker_doubleSend.js firefox-esr-68.6.0esr/dom/xhr/tests/xhr_worker_doubleSend.js --- firefox-esr-68.5.0esr/dom/xhr/tests/xhr_worker_doubleSend.js 1970-01-01 00:00:00.000000000 +0000 +++ firefox-esr-68.6.0esr/dom/xhr/tests/xhr_worker_doubleSend.js 2020-03-05 20:56:46.000000000 +0000 @@ -0,0 +1,11 @@ +var xhr = new XMLHttpRequest(); +xhr.open("POST", "worker_testXHR.txt"); +xhr.send(); +try { + xhr.send(); + postMessage("KO double send should fail"); +} catch (e) { + postMessage( + e.name === "InvalidStateError" ? "OK" : "KO InvalidStateError expected" + ); +} diff -Nru firefox-esr-68.5.0esr/js/src/jit/CacheIR.cpp firefox-esr-68.6.0esr/js/src/jit/CacheIR.cpp --- firefox-esr-68.5.0esr/js/src/jit/CacheIR.cpp 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/CacheIR.cpp 2020-03-05 20:56:53.000000000 +0000 @@ -4812,11 +4812,16 @@ return AttachDecision::Attach; } -AttachDecision CallIRGenerator::tryAttachFunCall() { +AttachDecision CallIRGenerator::tryAttachFunCall(HandleFunction calleeFunc) { if (JitOptions.disableCacheIRCalls) { return AttachDecision::NoAction; } + MOZ_ASSERT(calleeFunc->isNative()); + if (calleeFunc->native() != fun_call) { + return AttachDecision::NoAction; + } + if (!thisval_.isObject() || !thisval_.toObject().is()) { return AttachDecision::NoAction; } @@ -4866,11 +4871,16 @@ return AttachDecision::Attach; } -AttachDecision CallIRGenerator::tryAttachFunApply() { +AttachDecision CallIRGenerator::tryAttachFunApply(HandleFunction calleeFunc) { if (JitOptions.disableCacheIRCalls) { return AttachDecision::NoAction; } + MOZ_ASSERT(calleeFunc->isNative()); + if (calleeFunc->native() != fun_apply) { + return AttachDecision::NoAction; + } + if (argc_ != 2) { return AttachDecision::NoAction; } @@ -4945,15 +4955,7 @@ MOZ_ASSERT(mode_ == ICState::Mode::Specialized); MOZ_ASSERT(callee->isNative()); - // Check for fun_call and fun_apply. - if (op_ == JSOP_FUNCALL && callee->native() == fun_call) { - return tryAttachFunCall(); - } - if (op_ == JSOP_FUNAPPLY && callee->native() == fun_apply) { - return tryAttachFunApply(); - } - - // Other functions are only optimized for normal calls. + // Special-case functions are only optimized for normal calls. if (op_ != JSOP_CALL && op_ != JSOP_CALL_IGNORES_RV) { return AttachDecision::NoAction; } @@ -5435,6 +5437,12 @@ // Check for native-function optimizations. if (calleeFunc->isNative()) { + if (op_ == JSOP_FUNCALL) { + return tryAttachFunCall(calleeFunc); + } + if (op_ == JSOP_FUNAPPLY) { + return tryAttachFunApply(calleeFunc); + } return tryAttachCallNative(calleeFunc); } diff -Nru firefox-esr-68.5.0esr/js/src/jit/CacheIR.h firefox-esr-68.6.0esr/js/src/jit/CacheIR.h --- firefox-esr-68.5.0esr/js/src/jit/CacheIR.h 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/CacheIR.h 2020-03-05 20:56:53.000000000 +0000 @@ -2382,8 +2382,8 @@ AttachDecision tryAttachArrayPush(); AttachDecision tryAttachArrayJoin(); AttachDecision tryAttachIsSuspendedGenerator(); - AttachDecision tryAttachFunCall(); - AttachDecision tryAttachFunApply(); + AttachDecision tryAttachFunCall(HandleFunction calleeFunc); + AttachDecision tryAttachFunApply(HandleFunction calleeFunc); AttachDecision tryAttachCallScripted(HandleFunction calleeFunc); AttachDecision tryAttachSpecialCaseCallNative(HandleFunction calleeFunc); AttachDecision tryAttachCallNative(HandleFunction calleeFunc); diff -Nru firefox-esr-68.5.0esr/js/src/jit/Ion.cpp firefox-esr-68.6.0esr/js/src/jit/Ion.cpp --- firefox-esr-68.5.0esr/js/src/jit/Ion.cpp 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/Ion.cpp 2020-03-05 20:56:53.000000000 +0000 @@ -1170,16 +1170,6 @@ return false; } - if (!mir->compilingWasm()) { - if (!MakeMRegExpHoistable(mir, graph)) { - return false; - } - - if (mir->shouldCancel("Make MRegExp Hoistable")) { - return false; - } - } - gs.spewPass("BuildSSA"); AssertBasicGraphCoherency(graph); diff -Nru firefox-esr-68.5.0esr/js/src/jit/IonAnalysis.cpp firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.cpp --- firefox-esr-68.5.0esr/js/src/jit/IonAnalysis.cpp 2020-02-07 00:27:04.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.cpp 2020-03-05 20:56:53.000000000 +0000 @@ -2263,298 +2263,6 @@ return true; } -// Check if `def` is only the N-th operand of `useDef`. -static inline size_t IsExclusiveNthOperand(MDefinition* useDef, size_t n, - MDefinition* def) { - uint32_t num = useDef->numOperands(); - if (n >= num || useDef->getOperand(n) != def) { - return false; - } - - for (uint32_t i = 0; i < num; i++) { - if (i == n) { - continue; - } - if (useDef->getOperand(i) == def) { - return false; - } - } - - return true; -} - -static size_t IsExclusiveThisArg(MCall* call, MDefinition* def) { - return IsExclusiveNthOperand(call, MCall::IndexOfThis(), def); -} - -static size_t IsExclusiveFirstArg(MCall* call, MDefinition* def) { - return IsExclusiveNthOperand(call, MCall::IndexOfArgument(0), def); -} - -static bool IsRegExpHoistableCall(CompileRuntime* runtime, MCall* call, - MDefinition* def) { - if (call->isConstructing()) { - return false; - } - - JSAtom* name; - if (WrappedFunction* fun = call->getSingleTarget()) { - if (!fun->isSelfHostedBuiltin()) { - return false; - } - - // Avoid accessing `JSFunction.flags_` via `JSFunction::isExtended`. - if (!fun->isExtended()) { - return false; - } - name = GetClonedSelfHostedFunctionNameOffMainThread(fun->rawJSFunction()); - } else { - MDefinition* funDef = call->getFunction(); - if (funDef->isDebugCheckSelfHosted()) { - funDef = funDef->toDebugCheckSelfHosted()->input(); - } - if (funDef->isTypeBarrier()) { - funDef = funDef->toTypeBarrier()->input(); - } - - if (!funDef->isCallGetIntrinsicValue()) { - return false; - } - name = funDef->toCallGetIntrinsicValue()->name(); - } - - // Hoistable only if the RegExp is the first argument of RegExpBuiltinExec. - if (name == runtime->names().RegExpBuiltinExec || - name == runtime->names().UnwrapAndCallRegExpBuiltinExec || - name == runtime->names().RegExpMatcher || - name == runtime->names().RegExpTester || - name == runtime->names().RegExpSearcher) { - return IsExclusiveFirstArg(call, def); - } - - if (name == runtime->names().RegExp_prototype_Exec || - name == runtime->names().CallRegExpMethodIfWrapped) { - return IsExclusiveThisArg(call, def); - } - - return false; -} - -static bool CanCompareRegExp(MCompare* compare, MDefinition* def) { - MDefinition* value; - if (compare->lhs() == def) { - value = compare->rhs(); - } else { - MOZ_ASSERT(compare->rhs() == def); - value = compare->lhs(); - } - - // Comparing two regexp that weren't cloned will give different result - // than if they were cloned. - if (value->mightBeType(MIRType::Object)) { - return false; - } - - // Make sure @@toPrimitive is not called which could notice - // the difference between a not cloned/cloned regexp. - - JSOp op = compare->jsop(); - // Strict equality comparison won't invoke @@toPrimitive. - if (op == JSOP_STRICTEQ || op == JSOP_STRICTNE) { - return true; - } - - if (op != JSOP_EQ && op != JSOP_NE) { - // Relational comparison always invoke @@toPrimitive. - MOZ_ASSERT(IsRelationalOp(op)); - return false; - } - - // Loose equality comparison can invoke @@toPrimitive. - if (value->mightBeType(MIRType::Boolean) || - value->mightBeType(MIRType::String) || - value->mightBeType(MIRType::Int32) || - value->mightBeType(MIRType::Double) || - value->mightBeType(MIRType::Float32) || - value->mightBeType(MIRType::Symbol) || - value->mightBeType(MIRType::BigInt)) { - return false; - } - - return true; -} - -static inline void SetNotInWorklist(MDefinitionVector& worklist) { - for (size_t i = 0; i < worklist.length(); i++) { - worklist[i]->setNotInWorklist(); - } -} - -static bool IsRegExpHoistable(MIRGenerator* mir, MDefinition* regexp, - MDefinitionVector& worklist, bool* hoistable) { - MOZ_ASSERT(worklist.length() == 0); - - if (!worklist.append(regexp)) { - return false; - } - regexp->setInWorklist(); - - for (size_t i = 0; i < worklist.length(); i++) { - MDefinition* def = worklist[i]; - if (mir->shouldCancel("IsRegExpHoistable outer loop")) { - return false; - } - - for (MUseIterator use = def->usesBegin(); use != def->usesEnd(); use++) { - if (mir->shouldCancel("IsRegExpHoistable inner loop")) { - return false; - } - - // Ignore resume points. At this point all uses are listed. - // No DCE or GVN or something has happened. - if (use->consumer()->isResumePoint()) { - continue; - } - - MDefinition* useDef = use->consumer()->toDefinition(); - - // Step through a few white-listed ops. - if (useDef->isPhi() || useDef->isFilterTypeSet() || - useDef->isGuardShape()) { - if (useDef->isInWorklist()) { - continue; - } - - if (!worklist.append(useDef)) { - return false; - } - useDef->setInWorklist(); - continue; - } - - // Instructions that doesn't invoke unknown code that may modify - // RegExp instance or pass it to elsewhere. - if (useDef->isRegExpMatcher() || useDef->isRegExpTester() || - useDef->isRegExpSearcher()) { - if (IsExclusiveNthOperand(useDef, 0, def)) { - continue; - } - } else if (useDef->isLoadFixedSlot() || useDef->isTypeOf()) { - continue; - } else if (useDef->isCompare()) { - if (CanCompareRegExp(useDef->toCompare(), def)) { - continue; - } - } - // Instructions that modifies `lastIndex` property. - else if (useDef->isStoreFixedSlot()) { - if (IsExclusiveNthOperand(useDef, 0, def)) { - MStoreFixedSlot* store = useDef->toStoreFixedSlot(); - if (store->slot() == RegExpObject::lastIndexSlot()) { - continue; - } - } - } else if (useDef->isSetPropertyCache()) { - if (IsExclusiveNthOperand(useDef, 0, def)) { - MSetPropertyCache* setProp = useDef->toSetPropertyCache(); - if (setProp->idval()->isConstant()) { - Value propIdVal = setProp->idval()->toConstant()->toJSValue(); - if (propIdVal.isString()) { - CompileRuntime* runtime = mir->runtime; - if (propIdVal.toString() == runtime->names().lastIndex) { - continue; - } - } - } - } - } - // MCall is safe only for some known safe functions. - else if (useDef->isCall()) { - if (IsRegExpHoistableCall(mir->runtime, useDef->toCall(), def)) { - continue; - } - } - - // Everything else is unsafe. - SetNotInWorklist(worklist); - worklist.clear(); - *hoistable = false; - - return true; - } - } - - SetNotInWorklist(worklist); - worklist.clear(); - *hoistable = true; - return true; -} - -bool jit::MakeMRegExpHoistable(MIRGenerator* mir, MIRGraph& graph) { - // If we are compiling try blocks, regular expressions may be observable - // from catch blocks (which Ion does not compile). For now just disable the - // pass in this case. - if (graph.hasTryBlock()) { - return true; - } - - MDefinitionVector worklist(graph.alloc()); - - for (ReversePostorderIterator block(graph.rpoBegin()); - block != graph.rpoEnd(); block++) { - if (mir->shouldCancel("MakeMRegExpHoistable outer loop")) { - return false; - } - - for (MDefinitionIterator iter(*block); iter; iter++) { - if (!*iter) { - MOZ_CRASH("confirm bug 1263794."); - } - - if (mir->shouldCancel("MakeMRegExpHoistable inner loop")) { - return false; - } - - if (!iter->isRegExp()) { - continue; - } - - MRegExp* regexp = iter->toRegExp(); - - bool hoistable = false; - if (!IsRegExpHoistable(mir, regexp, worklist, &hoistable)) { - return false; - } - - if (!hoistable) { - continue; - } - - // Make MRegExp hoistable - regexp->setMovable(); - regexp->setDoNotClone(); - - // That would be incorrect for global/sticky, because lastIndex - // could be wrong. Therefore setting the lastIndex to 0. That is - // faster than a not movable regexp. - RegExpObject* source = regexp->source(); - if (source->sticky() || source->global()) { - if (!graph.alloc().ensureBallast()) { - return false; - } - MConstant* zero = MConstant::New(graph.alloc(), Int32Value(0)); - regexp->block()->insertAfter(regexp, zero); - - MStoreFixedSlot* lastIndex = MStoreFixedSlot::New( - graph.alloc(), regexp, RegExpObject::lastIndexSlot(), zero); - regexp->block()->insertAfter(zero, lastIndex); - } - } - } - - return true; -} - void jit::RenumberBlocks(MIRGraph& graph) { size_t id = 0; for (ReversePostorderIterator block(graph.rpoBegin()); diff -Nru firefox-esr-68.5.0esr/js/src/jit/IonAnalysis.h firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.h --- firefox-esr-68.5.0esr/js/src/jit/IonAnalysis.h 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/IonAnalysis.h 2020-03-05 20:56:53.000000000 +0000 @@ -49,8 +49,6 @@ MOZ_MUST_USE bool ApplyTypeInformation(MIRGenerator* mir, MIRGraph& graph); -MOZ_MUST_USE bool MakeMRegExpHoistable(MIRGenerator* mir, MIRGraph& graph); - void RenumberBlocks(MIRGraph& graph); MOZ_MUST_USE bool AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, diff -Nru firefox-esr-68.5.0esr/js/src/jit/Lowering.cpp firefox-esr-68.6.0esr/js/src/jit/Lowering.cpp --- firefox-esr-68.5.0esr/js/src/jit/Lowering.cpp 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/Lowering.cpp 2020-03-05 20:56:53.000000000 +0000 @@ -2264,14 +2264,9 @@ } void LIRGenerator::visitRegExp(MRegExp* ins) { - if (ins->mustClone()) { - LRegExp* lir = new (alloc()) LRegExp(temp()); - define(lir, ins); - assignSafepoint(lir, ins); - } else { - RegExpObject* source = ins->source(); - define(new (alloc()) LPointer(source), ins); - } + LRegExp* lir = new (alloc()) LRegExp(temp()); + define(lir, ins); + assignSafepoint(lir, ins); } void LIRGenerator::visitRegExpMatcher(MRegExpMatcher* ins) { diff -Nru firefox-esr-68.5.0esr/js/src/jit/MIR.h firefox-esr-68.6.0esr/js/src/jit/MIR.h --- firefox-esr-68.5.0esr/js/src/jit/MIR.h 2020-02-07 00:27:09.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/jit/MIR.h 2020-03-05 20:56:58.000000000 +0000 @@ -6431,14 +6431,12 @@ class MRegExp : public MNullaryInstruction { CompilerGCPointer source_; - bool mustClone_; bool hasShared_; MRegExp(TempAllocator& alloc, CompilerConstraintList* constraints, RegExpObject* source, bool hasShared) : MNullaryInstruction(classOpcode), source_(source), - mustClone_(true), hasShared_(hasShared) { setResultType(MIRType::Object); setResultTypeSet(MakeSingletonTypeSet(alloc, constraints, source)); @@ -6448,8 +6446,6 @@ INSTRUCTION_HEADER(RegExp) TRIVIAL_NEW_WRAPPERS_WITH_ALLOC - void setDoNotClone() { mustClone_ = false; } - bool mustClone() const { return mustClone_; } bool hasShared() const { return hasShared_; } RegExpObject* source() const { return source_; } AliasSet getAliasSet() const override { return AliasSet::None(); } diff -Nru firefox-esr-68.5.0esr/js/src/vm/CommonPropertyNames.h firefox-esr-68.6.0esr/js/src/vm/CommonPropertyNames.h --- firefox-esr-68.5.0esr/js/src/vm/CommonPropertyNames.h 2020-02-07 00:27:16.000000000 +0000 +++ firefox-esr-68.6.0esr/js/src/vm/CommonPropertyNames.h 2020-03-05 20:56:59.000000000 +0000 @@ -68,8 +68,6 @@ MACRO(callee, callee, "callee") \ MACRO(caller, caller, "caller") \ MACRO(callFunction, callFunction, "callFunction") \ - MACRO(CallRegExpMethodIfWrapped, CallRegExpMethodIfWrapped, \ - "CallRegExpMethodIfWrapped") \ MACRO(cancel, cancel, "cancel") \ MACRO(case, case_, "case") \ MACRO(caseFirst, caseFirst, "caseFirst") \ @@ -343,13 +341,8 @@ MACRO(proxy, proxy, "proxy") \ MACRO(raw, raw, "raw") \ MACRO(reason, reason, "reason") \ - MACRO(RegExpBuiltinExec, RegExpBuiltinExec, "RegExpBuiltinExec") \ MACRO(RegExpFlagsGetter, RegExpFlagsGetter, "$RegExpFlagsGetter") \ - MACRO(RegExpMatcher, RegExpMatcher, "RegExpMatcher") \ - MACRO(RegExpSearcher, RegExpSearcher, "RegExpSearcher") \ MACRO(RegExpStringIterator, RegExpStringIterator, "RegExp String Iterator") \ - MACRO(RegExpTester, RegExpTester, "RegExpTester") \ - MACRO(RegExp_prototype_Exec, RegExp_prototype_Exec, "RegExp_prototype_Exec") \ MACRO(Reify, Reify, "Reify") \ MACRO(reject, reject, "reject") \ MACRO(rejected, rejected, "rejected") \ @@ -433,8 +426,6 @@ MACRO(uninitialized, uninitialized, "uninitialized") \ MACRO(unsized, unsized, "unsized") \ MACRO(unwatch, unwatch, "unwatch") \ - MACRO(UnwrapAndCallRegExpBuiltinExec, UnwrapAndCallRegExpBuiltinExec, \ - "UnwrapAndCallRegExpBuiltinExec") \ MACRO(url, url, "url") \ MACRO(usage, usage, "usage") \ MACRO(useAsm, useAsm, "use asm") \ diff -Nru firefox-esr-68.5.0esr/layout/generic/ScrollAnchorContainer.cpp firefox-esr-68.6.0esr/layout/generic/ScrollAnchorContainer.cpp --- firefox-esr-68.5.0esr/layout/generic/ScrollAnchorContainer.cpp 2020-02-07 00:27:15.000000000 +0000 +++ firefox-esr-68.6.0esr/layout/generic/ScrollAnchorContainer.cpp 2020-03-05 20:57:05.000000000 +0000 @@ -309,13 +309,16 @@ void ScrollAnchorContainer::ApplyAdjustments() { if (!mAnchorNode || mAnchorNodeIsDirty || mScrollFrame->HasPendingScrollRestoration() || - mScrollFrame->IsProcessingAsyncScroll()) { + mScrollFrame->IsProcessingAsyncScroll() || + mScrollFrame->mApzSmoothScrollDestination.isSome()) { ANCHOR_LOG( "Ignoring post-reflow (anchor=%p, dirty=%d, pendingRestoration=%d, " - "asyncScroll=%d container=%p).\n", + "asyncScroll=%d, apzSmoothDestination=%d, container=%p).\n", mAnchorNode, mAnchorNodeIsDirty, mScrollFrame->HasPendingScrollRestoration(), - mScrollFrame->IsProcessingAsyncScroll(), this); + mScrollFrame->IsProcessingAsyncScroll(), + mScrollFrame->mApzSmoothScrollDestination.isSome(), + this); if (mSuppressAnchorAdjustment) { mSuppressAnchorAdjustment = false; InvalidateAnchor(); @@ -344,7 +347,7 @@ } ANCHOR_LOG("Applying anchor adjustment of %d in %s for %p and anchor %p.\n", - logicalAdjustment, writingMode.DebugString(), this, mAnchorNode); + logicalAdjustment, ToString(writingMode).c_str(), this, mAnchorNode); nsPoint physicalAdjustment; switch (writingMode.GetBlockDir()) { diff -Nru firefox-esr-68.5.0esr/media/libcubeb/src/cubeb_audiounit.cpp firefox-esr-68.6.0esr/media/libcubeb/src/cubeb_audiounit.cpp --- firefox-esr-68.5.0esr/media/libcubeb/src/cubeb_audiounit.cpp 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/media/libcubeb/src/cubeb_audiounit.cpp 2020-03-05 20:57:05.000000000 +0000 @@ -2869,6 +2869,15 @@ static void audiounit_stream_destroy(cubeb_stream * stm) { + int r = audiounit_uninstall_system_changed_callback(stm); + if (r != CUBEB_OK) { + LOG("(%p) Could not uninstall the device changed callback", stm); + } + r = audiounit_uninstall_device_changed_callback(stm); + if (r != CUBEB_OK) { + LOG("(%p) Could not uninstall all device change listeners", stm); + } + if (!stm->shutdown.load()){ auto_lock context_lock(stm->context->mutex); audiounit_stream_stop_internal(stm); diff -Nru firefox-esr-68.5.0esr/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp firefox-esr-68.6.0esr/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp --- firefox-esr-68.5.0esr/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp 2020-03-05 20:57:11.000000000 +0000 @@ -1235,8 +1235,9 @@ mPCObserver->OnCreateOfferError(*buildJSErrorData(result, errorString), rv); } else { + auto pco = mPCObserver; UpdateSignalingState(); - mPCObserver->OnCreateOfferSuccess(ObString(offer.c_str()), rv); + pco->OnCreateOfferSuccess(ObString(offer.c_str()), rv); } return NS_OK; @@ -1265,8 +1266,9 @@ mPCObserver->OnCreateAnswerError(*buildJSErrorData(result, errorString), rv); } else { + auto pco = mPCObserver; UpdateSignalingState(); - mPCObserver->OnCreateAnswerSuccess(ObString(answer.c_str()), rv); + pco->OnCreateAnswerSuccess(ObString(answer.c_str()), rv); } return NS_OK; @@ -1321,9 +1323,10 @@ if (wasRestartingIce) { RecordIceRestartStatistics(sdpType); } - mPCObserver->SyncTransceivers(rv); + auto pco = mPCObserver; + pco->SyncTransceivers(rv); UpdateSignalingState(sdpType == mozilla::kJsepSdpRollback); - mPCObserver->OnSetLocalDescriptionSuccess(rv); + pco->OnSetLocalDescriptionSuccess(rv); } return NS_OK; @@ -1393,6 +1396,7 @@ return NS_ERROR_FAILURE; } + auto pco = mPCObserver; size_t originalTransceiverCount = mJsepSession->GetTransceivers().size(); JsepSession::Result result = mJsepSession->SetRemoteDescription(sdpType, mRemoteRequestedSDP); @@ -1400,8 +1404,8 @@ std::string errorString = mJsepSession->GetLastError(); CSFLogError(LOGTAG, "%s: pc = %s, error = %s", __FUNCTION__, mHandle.c_str(), errorString.c_str()); - mPCObserver->OnSetRemoteDescriptionError( - *buildJSErrorData(result, errorString), jrv); + pco->OnSetRemoteDescriptionError(*buildJSErrorData(result, errorString), + jrv); } else { // Iterate over the JSEP transceivers that were just created for (size_t i = originalTransceiverCount; @@ -1426,12 +1430,12 @@ __FUNCTION__, mHandle.c_str()); switch (receiving.GetMediaType()) { case SdpMediaSection::MediaType::kAudio: - mPCObserver->OnTransceiverNeeded(NS_ConvertASCIItoUTF16("audio"), - *transceiverImpl, jrv); + pco->OnTransceiverNeeded(NS_ConvertASCIItoUTF16("audio"), + *transceiverImpl, jrv); break; case SdpMediaSection::MediaType::kVideo: - mPCObserver->OnTransceiverNeeded(NS_ConvertASCIItoUTF16("video"), - *transceiverImpl, jrv); + pco->OnTransceiverNeeded(NS_ConvertASCIItoUTF16("video"), + *transceiverImpl, jrv); break; default: MOZ_RELEASE_ASSERT(false); @@ -1452,13 +1456,13 @@ RecordIceRestartStatistics(sdpType); } - mPCObserver->SyncTransceivers(jrv); + pco->SyncTransceivers(jrv); - UpdateSignalingState(sdpType == mozilla::kJsepSdpRollback); + startCallTelem(); - mPCObserver->OnSetRemoteDescriptionSuccess(jrv); + UpdateSignalingState(sdpType == mozilla::kJsepSdpRollback); - startCallTelem(); + pco->OnSetRemoteDescriptionSuccess(jrv); } return NS_OK; diff -Nru firefox-esr-68.5.0esr/mobile/android/app/mobile.js firefox-esr-68.6.0esr/mobile/android/app/mobile.js --- firefox-esr-68.5.0esr/mobile/android/app/mobile.js 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/app/mobile.js 2020-03-05 20:57:16.000000000 +0000 @@ -476,15 +476,6 @@ pref("ui.windowtext", "#101010"); pref("ui.windowframe", "#efebe7"); -/* prefs used by the update timer system (including blocklist pings) */ -pref("app.update.timerFirstInterval", 30000); // milliseconds -pref("app.update.timerMinimumDelay", 30); // seconds - -// used by update service to decide whether or not to -// automatically download an update -pref("app.update.autodownload", "wifi"); -pref("app.update.url.android", "https://aus5.mozilla.org/update/4/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%MOZ_VERSION%/update.xml"); - #ifdef MOZ_UPDATER /* prefs used specifically for updating the app */ pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); diff -Nru firefox-esr-68.5.0esr/mobile/android/app/src/main/res/values/arrays.xml firefox-esr-68.6.0esr/mobile/android/app/src/main/res/values/arrays.xml --- firefox-esr-68.5.0esr/mobile/android/app/src/main/res/values/arrays.xml 2020-02-07 00:27:23.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/app/src/main/res/values/arrays.xml 2020-03-05 20:57:16.000000000 +0000 @@ -123,16 +123,6 @@ always quit - - @string/pref_update_autodownload_enabled - @string/pref_update_autodownload_wifi - @string/pref_update_autodownload_disabled - - - enabled - wifi - disabled - @string/pref_tap_to_load_images_enabled diff -Nru firefox-esr-68.5.0esr/mobile/android/app/src/main/res/xml/preferences_advanced.xml firefox-esr-68.6.0esr/mobile/android/app/src/main/res/xml/preferences_advanced.xml --- firefox-esr-68.5.0esr/mobile/android/app/src/main/res/xml/preferences_advanced.xml 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/app/src/main/res/xml/preferences_advanced.xml 2020-03-05 20:57:16.000000000 +0000 @@ -19,12 +19,6 @@ android:negativeButtonText="@string/button_cancel" android:persistent="false" /> - - - #ifndef MOZILLA_OFFICIAL #else @@ -259,12 +258,6 @@ android:targetActivity="@MOZ_ANDROID_BROWSER_INTENT_CLASS@" android:exported="true" /> - - - - - - @@ -427,40 +420,6 @@ - - - - - - - - - - - - - - - - - - - - diff -Nru firefox-esr-68.5.0esr/mobile/android/base/AppConstants.java.in firefox-esr-68.6.0esr/mobile/android/base/AppConstants.java.in --- firefox-esr-68.5.0esr/mobile/android/base/AppConstants.java.in 2020-02-07 00:27:16.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/AppConstants.java.in 2020-03-05 20:57:10.000000000 +0000 @@ -219,13 +219,6 @@ false; //#endif - public static final boolean MOZ_UPDATER = -//#ifdef MOZ_UPDATER - true; -//#else - false; -//#endif - // Android Beam is only supported on API14+, so we don't even bother building // it if this APK doesn't include API14 support. public static final boolean MOZ_ANDROID_BEAM = diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java 2020-03-05 20:57:16.000000000 +0000 @@ -150,7 +150,6 @@ import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState; import org.mozilla.gecko.toolbar.PwaConfirm; import org.mozilla.gecko.updater.PostUpdateHandler; -import org.mozilla.gecko.updater.UpdateServiceHelper; import org.mozilla.gecko.util.ActivityUtils; import org.mozilla.gecko.util.ContextUtils; import org.mozilla.gecko.util.DrawableUtil; @@ -792,7 +791,6 @@ "CharEncoding:Data", "CharEncoding:State", "Settings:Show", - "Updater:Launch", "Sanitize:Finished", "Sanitize:OpenTabs", "NotificationSettings:FeatureTipsStatusUpdated", @@ -879,22 +877,6 @@ // Set the maximum bits-per-pixel the favicon system cares about. IconDirectoryEntry.setMaxBPP(GeckoAppShell.getScreenDepth()); - // The update service is enabled for RELEASE_OR_BETA, which includes the release and beta channels. - // However, no updates are served. Therefore, we don't trust the update service directly, and - // try to avoid prompting unnecessarily. See Bug 1232798. - if (!AppConstants.RELEASE_OR_BETA && UpdateServiceHelper.isUpdaterEnabled(this)) { - Permissions.from(this) - .withPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE) - .doNotPrompt() - .andFallback(new Runnable() { - @Override - public void run() { - showUpdaterPermissionSnackbar(); - } - }) - .run(); - } - for (final BrowserAppDelegate delegate : delegates) { delegate.onCreate(this, savedInstanceState); } @@ -999,24 +981,6 @@ TelemetryUploadService.setDisabled(isInAutomation); } - private void showUpdaterPermissionSnackbar() { - SnackbarBuilder.SnackbarCallback allowCallback = new SnackbarBuilder.SnackbarCallback() { - @Override - public void onClick(View v) { - Permissions.from(BrowserApp.this) - .withPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE) - .run(); - } - }; - - SnackbarBuilder.builder(this) - .message(R.string.updater_permission_text) - .duration(Snackbar.LENGTH_INDEFINITE) - .action(R.string.updater_permission_allow) - .callback(allowCallback) - .buildAndShow(); - } - private Class getMediaPlayerManager() { if (AppConstants.MOZ_MEDIA_PLAYER) { try { @@ -1606,7 +1570,6 @@ "CharEncoding:Data", "CharEncoding:State", "Settings:Show", - "Updater:Launch", "Sanitize:Finished", "Sanitize:OpenTabs", "NotificationSettings:FeatureTipsStatusUpdated", @@ -2088,31 +2051,6 @@ GeckoApplication.createBrowserShortcut(title, bookmarkUrl); break; - case "Updater:Launch": - /** - * Launch UI that lets the user update Firefox. - * - * This depends on the current channel: Release and Beta both direct to - * the Google Play Store. If updating is enabled, Aurora, Nightly, and - * custom builds open about:firefox, which provides an update interface. - * - * If updating is not enabled, this simply logs an error. - */ - if (AppConstants.RELEASE_OR_BETA) { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse("market://details?id=" + getPackageName())); - startActivity(intent); - break; - } - - if (AppConstants.MOZ_UPDATER) { - Tabs.getInstance().loadUrlInTab(AboutPages.FIREFOX); - break; - } - - Log.w(LOGTAG, "No candidate updater found; ignoring launch request."); - break; - case "Download:AndroidDownloadManager": // Downloading via Android's download manager final String uri = message.getString("uri"); diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java 2020-02-07 00:27:31.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java 2020-03-05 20:57:10.000000000 +0000 @@ -30,7 +30,6 @@ import org.mozilla.gecko.restrictions.Restrictions; import org.mozilla.gecko.tabqueue.TabQueueHelper; import org.mozilla.gecko.text.TextSelection; -import org.mozilla.gecko.updater.UpdateServiceHelper; import org.mozilla.gecko.util.ActivityUtils; import org.mozilla.gecko.util.BundleEventListener; import org.mozilla.gecko.util.EventCallback; @@ -787,15 +786,6 @@ } else if ("ToggleChrome:Show".equals(event)) { toggleChrome(true); - } else if ("Update:Check".equals(event)) { - UpdateServiceHelper.checkForUpdate(this); - - } else if ("Update:Download".equals(event)) { - UpdateServiceHelper.downloadUpdate(this); - - } else if ("Update:Install".equals(event)) { - UpdateServiceHelper.applyUpdate(this); - } else if ("Mma:reader_available".equals(event)) { MmaDelegate.track(READER_AVAILABLE); @@ -1042,9 +1032,6 @@ EventDispatcher.getInstance().registerUiThreadListener(this, "Gecko:CorruptAPK", - "Update:Check", - "Update:Download", - "Update:Install", null); if (sAlreadyLoaded) { @@ -1614,14 +1601,6 @@ } }, 50); - final int updateServiceDelay = 30 * 1000; - ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() { - @Override - public void run() { - UpdateServiceHelper.registerForUpdates(GeckoAppShell.getApplicationContext()); - } - }, updateServiceDelay); - if (mIsRestoringActivity) { Tab selectedTab = Tabs.getInstance().getSelectedTab(); if (selectedTab != null) { @@ -2158,9 +2137,6 @@ EventDispatcher.getInstance().unregisterUiThreadListener(this, "Gecko:CorruptAPK", - "Update:Check", - "Update:Download", - "Update:Install", null); getAppEventDispatcher().unregisterGeckoThreadListener(this, diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoUpdateReceiver.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoUpdateReceiver.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoUpdateReceiver.java 2020-02-07 00:27:23.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/GeckoUpdateReceiver.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko; - -import org.mozilla.gecko.updater.UpdateServiceHelper; -import org.mozilla.gecko.util.GeckoBundle; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; - -public class GeckoUpdateReceiver extends BroadcastReceiver -{ - @Override - public void onReceive(Context context, Intent intent) { - if (UpdateServiceHelper.ACTION_CHECK_UPDATE_RESULT.equals(intent.getAction())) { - final GeckoBundle data = new GeckoBundle(1); - data.putString("result", intent.getStringExtra("result")); - EventDispatcher.getInstance().dispatch("Update:CheckResult", data); - } - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java 2020-02-07 00:27:31.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/notifications/NotificationHelper.java 2020-03-05 20:57:16.000000000 +0000 @@ -27,7 +27,6 @@ import org.mozilla.gecko.GeckoAppShell; import org.mozilla.gecko.R; import org.mozilla.gecko.mozglue.SafeIntent; -import org.mozilla.gecko.updater.UpdateServiceHelper; import org.mozilla.gecko.util.BitmapUtils; import org.mozilla.gecko.util.BundleEventListener; import org.mozilla.gecko.util.EventCallback; @@ -105,10 +104,6 @@ */ MEDIA, /** - * Built-in updater - use only when AppConstants.MOZ_UPDATER is true. - */ - UPDATER, - /** * Synced tabs notification channel */ SYNCED_TABS, @@ -131,7 +126,7 @@ // How to determine the initialCapacity: Count all channels (including the Updater, which is // only added further down in initNotificationChannels), multiply by 4/3 for a maximum load // factor of 75 % and round up to the next multiple of two. - private final Map mDefinedNotificationChannels = new HashMap(16) {{ + private final Map mDefinedNotificationChannels = new HashMap(15) {{ final String DEFAULT_CHANNEL_TAG = "default2-notification-channel"; put(Channel.DEFAULT, DEFAULT_CHANNEL_TAG); @@ -207,11 +202,8 @@ private void initNotificationChannels() { final String UPDATER_CHANNEL_TAG = "updater-notification-channel"; - if (UpdateServiceHelper.isUpdaterEnabled(mContext)) { - mDefinedNotificationChannels.put(Channel.UPDATER, UPDATER_CHANNEL_TAG); - } else { - mDeprecatedNotificationChannels.add(UPDATER_CHANNEL_TAG); - } + mDeprecatedNotificationChannels.add(UPDATER_CHANNEL_TAG); + final NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE); @@ -253,13 +245,6 @@ NotificationManager.IMPORTANCE_LOW); } break; - - case UPDATER: { - channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel), - mContext.getString(R.string.updater_notification_channel), - NotificationManager.IMPORTANCE_LOW); - } - break; case SYNCED_TABS: { channel = new NotificationChannel(mDefinedNotificationChannels.get(definedChannel), diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java 2020-03-05 20:57:10.000000000 +0000 @@ -83,8 +83,6 @@ import org.mozilla.gecko.switchboard.SwitchBoard; import org.mozilla.gecko.tabqueue.TabQueueHelper; import org.mozilla.gecko.tabqueue.TabQueuePrompt; -import org.mozilla.gecko.updater.UpdateServiceHelper; -import org.mozilla.gecko.updater.UpdateServiceHelper.AutoDownloadPolicy; import org.mozilla.gecko.util.BundleEventListener; import org.mozilla.gecko.util.ContextUtils; import org.mozilla.gecko.util.EventCallback; @@ -134,8 +132,6 @@ private static final String PREFS_CRASHREPORTER_ENABLED = "datareporting.crashreporter.submitEnabled"; private static final String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding"; private static final String PREFS_MP_ENABLED = "privacy.masterpassword.enabled"; - private static final String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload"; - private static final String PREFS_UPDATER_URL = "app.update.url.android"; private static final String PREFS_GEO_REPORTING = NON_PREF_PREFIX + "app.geo.reportdata"; private static final String PREFS_GEO_LEARN_MORE = NON_PREF_PREFIX + "geo.learn_more"; public static final String PREFS_DEVTOOLS_REMOTE_USB_ENABLED = "devtools.remote.usb.enabled"; @@ -698,12 +694,6 @@ i--; continue; } - } else if (PREFS_UPDATER_AUTODOWNLOAD.equals(key)) { - if (!AppConstants.MOZ_UPDATER || ContextUtils.isInstalledFromGooglePlay(this)) { - preferences.removePreference(pref); - i--; - continue; - } } else if (PREFS_TELEMETRY_ENABLED.equals(key)) { if (!AppConstants.MOZ_TELEMETRY_REPORTING || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) { preferences.removePreference(pref); @@ -1188,10 +1178,6 @@ if (PREFS_MENU_CHAR_ENCODING.equals(prefName)) { setCharEncodingState(((String) newValue).equals("true")); - } else if (PREFS_UPDATER_AUTODOWNLOAD.equals(prefName)) { - UpdateServiceHelper.setAutoDownloadPolicy(this, AutoDownloadPolicy.get((String) newValue)); - } else if (PREFS_UPDATER_URL.equals(prefName)) { - UpdateServiceHelper.setUpdateUrl(this, (String) newValue); } else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(prefName)) { final Boolean newBooleanValue = (Boolean) newValue; AdjustConstants.getAdjustHelper().setEnabled(newBooleanValue); diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/PackageVerifier.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/PackageVerifier.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/PackageVerifier.java 2020-02-07 00:27:16.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/PackageVerifier.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.util.Log; - -import org.mozilla.apache.commons.codec.binary.Hex; -import org.mozilla.gecko.BuildConfig; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.security.MessageDigest; - -public class PackageVerifier { - private static final String LOGTAG = "GeckoPackageVerifier"; - private static final boolean DEBUG = false; - - static boolean verifyDownloadedPackage(final UpdatesPrefs prefs, final File updateFile, final int bufSize) { - MessageDigest digest = createMessageDigest(prefs.getLastHashFunction()); - if (digest == null) - return false; - - InputStream input = null; - - try { - input = new BufferedInputStream(new FileInputStream(updateFile)); - - byte[] buf = new byte[bufSize]; - int len; - while ((len = input.read(buf, 0, bufSize)) > 0) { - digest.update(buf, 0, len); - } - } catch (java.io.IOException e) { - if (DEBUG) { - Log.e(LOGTAG, "Failed to verify update package: ", e); - } - return false; - } finally { - try { - if (input != null) - input.close(); - } catch (java.io.IOException e) { } - } - - String hex = Hex.encodeHexString(digest.digest()); - if (!hex.equals(prefs.getLastHashValue())) { - if (DEBUG) { - Log.e(LOGTAG, "Package hash does not match"); - } - return false; - } - - return true; - } - - private static MessageDigest createMessageDigest(String hashFunction) { - String javaHashFunction; - - if ("sha512".equalsIgnoreCase(hashFunction)) { - javaHashFunction = "SHA-512"; - } else { - if (DEBUG) { - Log.e(LOGTAG, "Unhandled hash function: " + hashFunction); - } - return null; - } - - try { - return MessageDigest.getInstance(javaHashFunction); - } catch (java.security.NoSuchAlgorithmException e) { - if (DEBUG) { - Log.e(LOGTAG, "Couldn't find algorithm " + javaHashFunction, e); - } - return null; - } - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java 2020-02-07 00:27:16.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceHelper.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,321 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Context; -import android.content.Intent; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.os.Build; -import android.support.annotation.NonNull; -import android.support.v4.app.JobIntentService; -import android.util.Log; - -import org.mozilla.gecko.AppConstants; -import org.mozilla.gecko.JobIdsConstants; -import org.mozilla.gecko.PrefsHelper; -import org.mozilla.gecko.annotation.RobocopTarget; -import org.mozilla.gecko.util.ContextUtils; -import org.mozilla.gecko.util.GeckoJarReader; - -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; - -public class UpdateServiceHelper { - // Following can be used to start a specific UpdaterService - public static final String ACTION_REGISTER_FOR_UPDATES = AppConstants.ANDROID_PACKAGE_NAME + ".REGISTER_FOR_UPDATES"; - public static final String ACTION_CHECK_FOR_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_FOR_UPDATE"; - public static final String ACTION_DOWNLOAD_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".DOWNLOAD_UPDATE"; - public static final String ACTION_APPLY_UPDATE = AppConstants.ANDROID_PACKAGE_NAME + ".APPLY_UPDATE"; - - // Used to inform Gecko about current status - public static final String ACTION_CHECK_UPDATE_RESULT = AppConstants.ANDROID_PACKAGE_NAME + ".CHECK_UPDATE_RESULT"; // - // Used to change running service state - public static final String ACTION_CANCEL_DOWNLOAD = AppConstants.ANDROID_PACKAGE_NAME + ".CANCEL_DOWNLOAD"; // - - // Update intervals - private static final int INTERVAL_LONG = 1000 * 60 * 60 * 24; // 1 day in milliseconds - private static final int INTERVAL_SHORT = 1000 * 60 * 60 * 4; // 4 hours in milliseconds - private static final int INTERVAL_RETRY = 1000 * 60 * 60 * 1; // 1 hour in milliseconds - - // The number of bytes to read when working with the updated package - static final int BUFSIZE = 8192; - - // All the notifications posted by the update services will use the same id - static final int NOTIFICATION_ID = 0x3e40ddbd; - - // Name of the Intent extra for the autodownload policy, used with ACTION_REGISTER_FOR_UPDATES - protected static final String EXTRA_AUTODOWNLOAD_NAME = "autodownload"; - - // Name of the Intent extra that holds the flags for ACTION_CHECK_FOR_UPDATE - protected static final String EXTRA_UPDATE_FLAGS_NAME = "updateFlags"; - - // Name of the Intent extra that holds the APK path, used with ACTION_APPLY_UPDATE - protected static final String EXTRA_PACKAGE_PATH_NAME = "packagePath"; - - // Name of the Intent extra for the update URL, used with ACTION_REGISTER_FOR_UPDATES - protected static final String EXTRA_UPDATE_URL_NAME = "updateUrl"; - - private static final String LOGTAG = "GeckoUpdatesHelper"; - private static final boolean DEBUG = false; - private static final String DEFAULT_UPDATE_LOCALE = "en-US"; - - // So that updates can be disabled by tests. - private static volatile boolean isEnabled = true; - - static final class UpdateInfo { - public URI uri; - public String buildID; - public String hashFunction; - public String hashValue; - public int size; - - private boolean isNonEmpty(String s) { - return s != null && s.length() > 0; - } - - public boolean isValid() { - return uri != null && isNonEmpty(buildID) && - isNonEmpty(hashFunction) && isNonEmpty(hashValue) && size > 0; - } - - @Override - public String toString() { - return "uri = " + uri + ", buildID = " + buildID + ", hashFunction = " + hashFunction + ", hashValue = " + hashValue + ", size = " + size; - } - } - - public enum AutoDownloadPolicy { - NONE(-1), - WIFI(0), - DISABLED(1), - ENABLED(2); - - public final int value; - - AutoDownloadPolicy(int value) { - this.value = value; - } - - private final static AutoDownloadPolicy[] sValues = AutoDownloadPolicy.values(); - - public static AutoDownloadPolicy get(int value) { - for (AutoDownloadPolicy id: sValues) { - if (id.value == value) { - return id; - } - } - return NONE; - } - - public static AutoDownloadPolicy get(String name) { - for (AutoDownloadPolicy id: sValues) { - if (name.equalsIgnoreCase(id.toString())) { - return id; - } - } - return NONE; - } - } - - enum CheckUpdateResult { - // Keep these in sync with mobile/android/chrome/content/about.xhtml - NOT_AVAILABLE, - AVAILABLE, - DOWNLOADING, - DOWNLOADED - } - - private enum Pref { - AUTO_DOWNLOAD_POLICY("app.update.autodownload"), - UPDATE_URL("app.update.url.android"); - - final String name; - - Pref(String name) { - this.name = name; - } - - final static String[] names; - - @Override - public String toString() { - return this.name; - } - - static { - ArrayList nameList = new ArrayList(); - - for (Pref id: Pref.values()) { - nameList.add(id.toString()); - } - - names = nameList.toArray(new String[0]); - } - } - - @RobocopTarget - public static void setEnabled(final boolean enabled) { - isEnabled = enabled; - } - - public static URI expandUpdateURI(Context context, String updateUri, boolean force) { - if (updateUri == null) { - return null; - } - - PackageManager pm = context.getPackageManager(); - - String pkgSpecial = AppConstants.MOZ_PKG_SPECIAL != null ? - "-" + AppConstants.MOZ_PKG_SPECIAL : - ""; - String locale = DEFAULT_UPDATE_LOCALE; - - try { - ApplicationInfo info = pm.getApplicationInfo(AppConstants.ANDROID_PACKAGE_NAME, 0); - String updateLocaleUrl = "jar:jar:file://" + info.sourceDir + "!/" + AppConstants.OMNIJAR_NAME + "!/update.locale"; - - final String jarLocale = GeckoJarReader.getText(context, updateLocaleUrl); - if (jarLocale != null) { - locale = jarLocale.trim(); - } - } catch (android.content.pm.PackageManager.NameNotFoundException e) { - // Shouldn't really be possible, but fallback to default locale - if (DEBUG) { - Log.i(LOGTAG, "Failed to read update locale file, falling back to " + locale); - } - } - - String url = updateUri.replace("%PRODUCT%", AppConstants.MOZ_APP_BASENAME) - .replace("%VERSION%", AppConstants.MOZ_APP_VERSION) - .replace("%BUILD_ID%", force ? "0" : AppConstants.MOZ_APP_BUILDID) - .replace("%BUILD_TARGET%", "Android_" + AppConstants.MOZ_APP_ABI + pkgSpecial) - .replace("%LOCALE%", locale) - .replace("%CHANNEL%", AppConstants.MOZ_UPDATE_CHANNEL) - .replace("%OS_VERSION%", Build.VERSION.RELEASE) - .replace("%DISTRIBUTION%", "default") - .replace("%DISTRIBUTION_VERSION%", "default") - .replace("%MOZ_VERSION%", AppConstants.MOZILLA_VERSION); - - Log.i(LOGTAG, "AUS Url is: " + url); - - try { - return new URI(url); - } catch (java.net.URISyntaxException e) { - Log.e(LOGTAG, "Failed to create update url: ", e); - return null; - } - } - - public static boolean isUpdaterEnabled(final Context context) { - return AppConstants.MOZ_UPDATER && isEnabled && !ContextUtils.isInstalledFromGooglePlay(context); - } - - public static void setUpdateUrl(Context context, String url) { - registerForUpdates(context, null, url); - } - - public static void setAutoDownloadPolicy(Context context, AutoDownloadPolicy policy) { - registerForUpdates(context, policy, null); - } - - public static void checkForUpdate(Context context) { - if (context == null) { - return; - } - - enqueueUpdateCheck(context, new Intent()); - } - - public static void downloadUpdate(Context context) { - if (context == null) { - return; - } - - enqueueUpdateDownload(context, new Intent()); - } - - public static void applyUpdate(Context context) { - if (context == null) { - return; - } - - enqueueUpdateApply(context, new Intent()); - } - - public static void registerForUpdates(final Context context) { - if (!isUpdaterEnabled(context)) { - return; - } - - final HashMap prefs = new HashMap(); - - PrefsHelper.getPrefs(Pref.names, new PrefsHelper.PrefHandlerBase() { - @Override public void prefValue(String pref, String value) { - prefs.put(pref, value); - } - - @Override public void finish() { - UpdateServiceHelper.registerForUpdates(context, - AutoDownloadPolicy.get( - (String) prefs.get(Pref.AUTO_DOWNLOAD_POLICY.toString())), - (String) prefs.get(Pref.UPDATE_URL.toString())); - } - }); - } - - private static void registerForUpdates(Context context, AutoDownloadPolicy policy, String url) { - if (!isUpdaterEnabled(context)) { - return; - } - - Intent intent = new Intent(ACTION_REGISTER_FOR_UPDATES); - - if (policy != null) { - intent.putExtra(EXTRA_AUTODOWNLOAD_NAME, policy.value); - } - - if (url != null) { - intent.putExtra(EXTRA_UPDATE_URL_NAME, url); - } - - enqueueUpdateRegister(context, intent); - } - - static int getUpdateInterval(boolean isRetry) { - int interval; - if (isRetry) { - interval = INTERVAL_RETRY; - } else if (!AppConstants.RELEASE_OR_BETA) { - interval = INTERVAL_SHORT; - } else { - interval = INTERVAL_LONG; - } - - return interval; - } - - public static void enqueueUpdateApply(@NonNull final Context context, @NonNull final Intent workIntent) { - JobIntentService.enqueueWork(context, UpdatesApplyService.class, - JobIdsConstants.getIdForUpdatesApplyJob(), workIntent); - } - - public static void enqueueUpdateCheck(@NonNull final Context context, @NonNull final Intent workIntent) { - JobIntentService.enqueueWork(context, UpdatesCheckService.class, - JobIdsConstants.getIdForUpdatesCheckJob(), workIntent); - } - - public static void enqueueUpdateDownload(@NonNull final Context context, @NonNull final Intent workIntent) { - JobIntentService.enqueueWork(context, UpdatesDownloadService.class, - JobIdsConstants.getIdForUpdatesDownloadJob(), workIntent); - } - - public static void enqueueUpdateRegister(@NonNull final Context context, @NonNull final Intent workIntent) { - JobIntentService.enqueueWork(context, UpdatesRegisterService.class, - JobIdsConstants.getIdForUpdatesRegisterJob(), workIntent); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceReceiver.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceReceiver.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceReceiver.java 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdateServiceReceiver.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -/** - * Receiver only used in local notifications posted by an {@link UpdaterService} after which it finishes.
- * Used to start another variant of {@link UpdaterService}. - */ -public class UpdateServiceReceiver extends BroadcastReceiver { - private static final String LOGTAG = "GeckoUpdateServiceRcv"; // must be <= 23 characters - private static final boolean DEBUG = false; - - public UpdateServiceReceiver() { - } - - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - - if (DEBUG) { - Log.d(LOGTAG, String.format("Will enqueue \"%s\" work", action)); - } - - switch (action) { - case UpdateServiceHelper.ACTION_CHECK_FOR_UPDATE: - UpdateServiceHelper.enqueueUpdateCheck(context, intent); - break; - case UpdateServiceHelper.ACTION_APPLY_UPDATE: - UpdateServiceHelper.enqueueUpdateApply(context, intent); - break; - case UpdateServiceHelper.ACTION_DOWNLOAD_UPDATE: - UpdateServiceHelper.enqueueUpdateDownload(context, intent); - break; - default: - // no-op, we only listen for the above - } - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/Updater.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/Updater.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/Updater.java 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/Updater.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,701 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.Manifest; -import android.annotation.SuppressLint; -import android.app.AlarmManager; -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.net.Uri; -import android.net.wifi.WifiManager; -import android.net.wifi.WifiManager.WifiLock; -import android.os.Environment; -import android.provider.Settings; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.content.ContextCompat; -import android.support.v4.content.FileProvider; -import android.support.v4.net.ConnectivityManagerCompat; -import android.util.Log; - -import org.mozilla.gecko.AppConstants; -import org.mozilla.gecko.GeckoUpdateReceiver; -import org.mozilla.gecko.R; -import org.mozilla.gecko.notifications.NotificationHelper; -import org.mozilla.gecko.permissions.Permissions; -import org.mozilla.gecko.updater.UpdateServiceHelper.AutoDownloadPolicy; -import org.mozilla.gecko.updater.UpdateServiceHelper.CheckUpdateResult; -import org.mozilla.gecko.updater.UpdateServiceHelper.UpdateInfo; -import org.mozilla.gecko.util.IOUtils; -import org.mozilla.gecko.util.ProxySelector; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URL; -import java.net.URLConnection; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -/** - * Helper class that handles everything needed to download and apply an updated package.
- * Only to be used on background threads because of the long time running operations involved. - */ -public class Updater { - // Because this class can be called by multiple parties the log tag - // will actually be the caller's name to easily identify whom requested the operations. - private String logtag; - private static final boolean DEBUG = false; - - // Flags for ACTION_CHECK_FOR_UPDATE - static final int FLAG_FORCE_DOWNLOAD = 1; - static final int FLAG_OVERWRITE_EXISTING = 1 << 1; - static final int FLAG_REINSTALL = 1 << 2; - - private final Context context; - private final ConnectivityManager connectivityManager; - private final NotificationManagerCompat notificationManager; - private final int bufferSize; - private final int notificationId; - private volatile WifiLock mWifiLock; - - private NotificationCompat.Builder notifBuilder; - private BroadcastReceiver innerBroadcastReceiver; - private UpdatesPrefs prefs; - - private boolean shouldCancelDownload; - private boolean shouldApplyImmediately; - - Updater(final Context context, final UpdatesPrefs prefs, final int bufSize, final int notificationId) { - this.logtag = getLogtagFromParentName(context); - this.context = context; - this.connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); - this.notificationManager = NotificationManagerCompat.from(context); - this.prefs = prefs; - this.mWifiLock = ((WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE)) - .createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, prefs.getPreferenceName()); - this.bufferSize = bufSize; - this.notificationId = notificationId; - - registerForLocalBroadcasts(context); - - if (DEBUG) { - Log.d(logtag, "Updater created"); - } - } - - /** - * Must be called everytime the caller finished it's work to cleanup used resources. - */ - void finish() { - unregisterFromLocalBroadcasts(); - - if (mWifiLock.isHeld()) { - mWifiLock.release(); - } - } - - void setIfShouldApplyUpdateImmediately(boolean shouldApplyImmediately) { - this.shouldApplyImmediately = shouldApplyImmediately; - } - - void startUpdate(final int flags) { - prefs.setLastAttemptDate(); - - if (!UpdateServiceHelper.isUpdaterEnabled(context)) { - if (DEBUG) { - Log.i(logtag, "Updater not enabled"); - } - sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE); - return; - } - - NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo(); - if (netInfo == null || !netInfo.isConnected()) { - if (DEBUG) { - Log.i(logtag, "not connected to the network"); - } - registerForUpdates(true); - sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE); - return; - } - - registerForUpdates(false); - - final UpdateInfo info = findUpdate(hasFlag(flags, FLAG_REINSTALL)); - boolean haveUpdate = (info != null); - - if (!haveUpdate) { - if (DEBUG) { - Log.i(logtag, "no update available"); - } - sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE); - return; - } - - if (DEBUG) { - Log.i(logtag, "update available, buildID = " + info.buildID); - } - - Permissions.from(context) - .withPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE) - .doNotPrompt() - .andFallback(new Runnable() { - @Override - public void run() { - showPermissionNotification(); - sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE); - } - }) - .run(new Runnable() { - @Override - public void run() { - startDownload(info, flags); - } - }); - - } - - void registerForUpdates(boolean isRetry) { - Calendar lastAttempt = prefs.getLastAttemptDate(); - Calendar now = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - - int interval = UpdateServiceHelper.getUpdateInterval(isRetry); - - if (lastAttempt == null || (now.getTimeInMillis() - lastAttempt.getTimeInMillis()) > interval) { - // We've either never attempted an update, or we are passed the desired - // time. Start an update now. - if (DEBUG) { - Log.i(logtag, "no update has ever been attempted, checking now"); - } - startUpdate(0); - return; - } - - AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - if (manager == null) - return; - - PendingIntent pending = PendingIntent.getBroadcast(context, 0, - new Intent(UpdateServiceHelper.ACTION_CHECK_FOR_UPDATE, null, context, UpdateServiceReceiver.class), - PendingIntent.FLAG_UPDATE_CURRENT); - manager.cancel(pending); - - lastAttempt.setTimeInMillis(lastAttempt.getTimeInMillis() + interval); - if (DEBUG) { - Log.i(logtag, "next update will be at: " + lastAttempt.getTime()); - } - - manager.set(AlarmManager.RTC_WAKEUP, lastAttempt.getTimeInMillis(), pending); - } - - void applyUpdate(String updatePath) { - if (updatePath == null) { - updatePath = prefs.getLastFileName(); - } - - if (updatePath != null) { - applyUpdate(new File(updatePath)); - } - } - - @SuppressLint("NewApi") - private void showPermissionNotification() { - Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, - Uri.fromParts("package", context.getPackageName(), null)); - - PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); - - NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle() - .bigText(getString(R.string.updater_permission_text)); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setContentTitle(getString(R.string.updater_permission_title)) - .setContentText(getString(R.string.updater_permission_text)) - .setStyle(bigTextStyle) - .setAutoCancel(true) - .setSmallIcon(R.drawable.ic_status_logo) - .setColor(ContextCompat.getColor(context, R.color.rejection_red)) - .setContentIntent(pendingIntent); - - if (!AppConstants.Versions.preO) { - builder.setChannelId(NotificationHelper.getInstance(context) - .getNotificationChannel(NotificationHelper.Channel.UPDATER).getId()); - } - - NotificationManagerCompat.from(context) - .notify(R.id.updateServicePermissionNotification, builder.build()); - } - - @SuppressLint("NewApi") - private void startDownload(UpdateInfo info, int flags) { - AutoDownloadPolicy policy = prefs.getAutoDownloadPolicy(); - - // We only start a download automatically if one of following criteria are met: - // - // - We have a FORCE_DOWNLOAD flag passed in - // - The preference is set to 'always' - // - The preference is set to 'wifi' and we are using a non-metered network (i.e. the user - // is OK with large data transfers occurring) - // - boolean shouldStartDownload = hasFlag(flags, FLAG_FORCE_DOWNLOAD) || - policy == AutoDownloadPolicy.ENABLED || - (policy == AutoDownloadPolicy.WIFI && !ConnectivityManagerCompat.isActiveNetworkMetered(connectivityManager)); - - if (!shouldStartDownload) { - if (DEBUG) { - Log.i(logtag, "not initiating automatic update download due to policy " + policy.toString()); - } - sendCheckUpdateResult(CheckUpdateResult.AVAILABLE); - - // We aren't autodownloading here, so prompt to start the update with a new JobIntentService - Intent notificationIntent = new Intent(UpdateServiceHelper.ACTION_DOWNLOAD_UPDATE); - notificationIntent.setClass(context, UpdateServiceReceiver.class); - PendingIntent contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - builder.setSmallIcon(R.drawable.ic_status_logo); - builder.setWhen(System.currentTimeMillis()); - builder.setAutoCancel(true); - builder.setContentTitle(getString(R.string.updater_start_title)); - builder.setContentText(getString(R.string.updater_start_select)); - builder.setContentIntent(contentIntent); - - if (!AppConstants.Versions.preO) { - builder.setChannelId(NotificationHelper.getInstance(context) - .getNotificationChannel(NotificationHelper.Channel.UPDATER).getId()); - } - - notificationManager.notify(notificationId, builder.build()); - - return; - } - - File pkg = downloadUpdatePackage(info, hasFlag(flags, FLAG_OVERWRITE_EXISTING)); - if (pkg == null) { - sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE); - return; - } - - if (DEBUG) { - Log.i(logtag, "have update package at " + pkg); - } - - prefs.saveUpdateInfo(info, pkg); - sendCheckUpdateResult(CheckUpdateResult.DOWNLOADED); - - if (shouldApplyImmediately) { - applyUpdate(pkg); - } else { - // Prompt to apply the update with a new JobIntentService - - Intent notificationIntent = new Intent(UpdateServiceHelper.ACTION_APPLY_UPDATE); - notificationIntent.setClass(context, UpdateServiceReceiver.class); - notificationIntent.putExtra(UpdateServiceHelper.EXTRA_PACKAGE_PATH_NAME, pkg.getAbsolutePath()); - PendingIntent contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - builder.setSmallIcon(R.drawable.ic_status_logo); - builder.setWhen(System.currentTimeMillis()); - builder.setAutoCancel(true); - builder.setContentTitle(getString(R.string.updater_apply_title)); - builder.setContentText(getString(R.string.updater_apply_select)); - builder.setContentIntent(contentIntent); - - if (!AppConstants.Versions.preO) { - builder.setChannelId(NotificationHelper.getInstance(context) - .getNotificationChannel(NotificationHelper.Channel.UPDATER).getId()); - } - - notificationManager.notify(notificationId, builder.build()); - } - } - - private File downloadUpdatePackage(UpdateInfo info, boolean overwriteExisting) { - URL url = null; - try { - url = info.uri.toURL(); - } catch (java.net.MalformedURLException e) { - Log.e(logtag, "failed to read URL: ", e); - return null; - } - - File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - path.mkdirs(); - String fileName = new File(url.getFile()).getName(); - File downloadFile = new File(path, fileName); - - - final String lastBuildId = prefs.getLastBuildID(); - if (!overwriteExisting && info.buildID.equals(lastBuildId) && downloadFile.exists()) { - // The last saved buildID is the same as the one for the current update. We also have a file - // already downloaded, so it's probably the package we want. Verify it to be sure and just - // return that if it matches. - - if (PackageVerifier.verifyDownloadedPackage(prefs, downloadFile, bufferSize)) { - if (DEBUG) { - Log.i(logtag, "using existing update package"); - } - return downloadFile; - } else { - // Didn't match, so we're going to download a new one. - downloadFile.delete(); - } - } - - if (!info.buildID.equals(prefs.getLastBuildID())) { - // Delete the previous package when a new version becomes available. - deleteUpdatePackage(prefs.getLastFileName()); - } - - if (DEBUG) { - Log.i(logtag, "downloading update package"); - } - sendCheckUpdateResult(CheckUpdateResult.DOWNLOADING); - - OutputStream output = null; - InputStream input = null; - URLConnection conn = null; - - shouldCancelDownload = false; - showDownloadNotification(downloadFile); - - try { - NetworkInfo netInfo = connectivityManager.getActiveNetworkInfo(); - if (netInfo != null && netInfo.isConnected() && - netInfo.getType() == ConnectivityManager.TYPE_WIFI) { - mWifiLock.acquire(); - } - - conn = ProxySelector.openConnectionWithProxy(info.uri); - int length = conn.getContentLength(); - - output = new BufferedOutputStream(new FileOutputStream(downloadFile)); - input = new BufferedInputStream(conn.getInputStream()); - - byte[] buf = new byte[bufferSize]; - int len = 0; - - int bytesRead = 0; - int lastNotify = 0; - - while ((len = input.read(buf, 0, bufferSize)) > 0 && !shouldCancelDownload) { - output.write(buf, 0, len); - bytesRead += len; - // Updating the notification takes time so only do it every 1MB - if (bytesRead - lastNotify > 1048576) { - notifBuilder.setProgress(length, bytesRead, false); - notificationManager.notify(notificationId, notifBuilder.build()); - lastNotify = bytesRead; - } - } - - notificationManager.cancel(notificationId); - - // if the download was canceled by the user - // delete the update package - if (shouldCancelDownload) { - if (DEBUG) { - Log.i(logtag, "download canceled by user!"); - } - downloadFile.delete(); - - return null; - } else { - if (DEBUG) { - Log.i(logtag, "completed update download!"); - } - return downloadFile; - } - } catch (Exception e) { - downloadFile.delete(); - showDownloadFailure(); - - Log.e(logtag, "failed to download update: ", e); - return null; - } finally { - IOUtils.safeStreamClose(input); - IOUtils.safeStreamClose(output); - - if (mWifiLock.isHeld()) { - mWifiLock.release(); - } - - // conn isn't guaranteed to be an HttpURLConnection, hence we don't want to cast earlier - // in this method. However in our current implementation it usually is, so we need to - // make sure we close it in that case: - final HttpURLConnection httpConn = (HttpURLConnection) conn; - if (httpConn != null) { - httpConn.disconnect(); - } - } - } - - private void showDownloadNotification() { - showDownloadNotification(null); - } - - @SuppressLint("NewApi") - private void showDownloadNotification(File downloadFile) { - - Intent notificationIntent = new Intent(UpdateServiceHelper.ACTION_APPLY_UPDATE); - Intent cancelIntent = new Intent(UpdateServiceHelper.ACTION_CANCEL_DOWNLOAD); - - if (downloadFile != null) - notificationIntent.putExtra(UpdateServiceHelper.EXTRA_PACKAGE_PATH_NAME, downloadFile.getAbsolutePath()); - - PendingIntent contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); - PendingIntent deleteIntent = PendingIntent.getBroadcast(context, 0, cancelIntent, PendingIntent.FLAG_CANCEL_CURRENT); - - notifBuilder = new NotificationCompat.Builder(context); - notifBuilder.setContentTitle(getString(R.string.updater_downloading_title)) - .setContentText(shouldApplyImmediately ? "" : getString(R.string.updater_downloading_select)) - .setSmallIcon(android.R.drawable.stat_sys_download) - .setContentIntent(contentIntent) - .setDeleteIntent(deleteIntent) - .setOnlyAlertOnce(true); - - if (!AppConstants.Versions.preO) { - notifBuilder.setChannelId(NotificationHelper.getInstance(context) - .getNotificationChannel(NotificationHelper.Channel.UPDATER).getId()); - } - - notifBuilder.setProgress(100, 0, true); - notificationManager.notify(notificationId, notifBuilder.build()); - } - - @SuppressLint("NewApi") - private void showDownloadFailure() { - // Let the user restart the update process with a new JobIntentService - Intent notificationIntent = new Intent(UpdateServiceHelper.ACTION_CHECK_FOR_UPDATE); - notificationIntent.setClass(context, UpdateServiceReceiver.class); - PendingIntent contentIntent = PendingIntent.getBroadcast(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - builder.setSmallIcon(R.drawable.ic_status_logo); - builder.setWhen(System.currentTimeMillis()); - builder.setContentTitle(getString(R.string.updater_downloading_title_failed)); - builder.setContentText(getString(R.string.updater_downloading_retry)); - builder.setContentIntent(contentIntent); - - if (!AppConstants.Versions.preO) { - builder.setChannelId(NotificationHelper.getInstance(context) - .getNotificationChannel(NotificationHelper.Channel.UPDATER).getId()); - } - - notificationManager.notify(notificationId, builder.build()); - } - - private void applyUpdate(File updateFile) { - shouldApplyImmediately = false; - - if (!updateFile.exists()) - return; - - if (DEBUG) { - Log.i(logtag, "Verifying package: " + updateFile); - } - - if (!PackageVerifier.verifyDownloadedPackage(prefs, updateFile, bufferSize)) { - Log.e(logtag, "Not installing update, failed verification"); - return; - } - - Intent intent = new Intent(Intent.ACTION_VIEW); - if (AppConstants.Versions.preN) { - intent.setDataAndType(Uri.fromFile(updateFile), "application/vnd.android.package-archive"); - } else { - Uri apkUri = FileProvider.getUriForFile(context, - AppConstants.MOZ_FILE_PROVIDER_AUTHORITY, updateFile); - intent.setDataAndType(apkUri, "application/vnd.android.package-archive"); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - } - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intent); - } - - private boolean deleteUpdatePackage(String path) { - if (path == null) { - return false; - } - - File pkg = new File(path); - if (!pkg.exists()) { - return false; - } - - pkg.delete(); - - if (DEBUG) { - Log.i(logtag, "deleted update package: " + path); - } - - return true; - } - - private void sendCheckUpdateResult(CheckUpdateResult result) { - Intent resultIntent = new Intent(context, GeckoUpdateReceiver.class); - resultIntent.setAction(UpdateServiceHelper.ACTION_CHECK_UPDATE_RESULT); - resultIntent.putExtra("result", result.toString()); - context.sendBroadcast(resultIntent); - } - - private UpdateInfo findUpdate(boolean force) { - URLConnection conn = null; - try { - URI uri = prefs.getUpdateURI(force); - - if (uri == null) { - Log.e(logtag, "failed to get update URI"); - return null; - } - - DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - conn = ProxySelector.openConnectionWithProxy(uri); - Document dom = builder.parse(conn.getInputStream()); - - NodeList nodes = dom.getElementsByTagName("update"); - if (nodes == null || nodes.getLength() == 0) - return null; - - Node updateNode = nodes.item(0); - Node buildIdNode = updateNode.getAttributes().getNamedItem("buildID"); - if (buildIdNode == null) - return null; - - nodes = dom.getElementsByTagName("patch"); - if (nodes == null || nodes.getLength() == 0) - return null; - - Node patchNode = nodes.item(0); - Node urlNode = patchNode.getAttributes().getNamedItem("URL"); - Node hashFunctionNode = patchNode.getAttributes().getNamedItem("hashFunction"); - Node hashValueNode = patchNode.getAttributes().getNamedItem("hashValue"); - Node sizeNode = patchNode.getAttributes().getNamedItem("size"); - - if (urlNode == null || hashFunctionNode == null || - hashValueNode == null || sizeNode == null) { - return null; - } - - // Fill in UpdateInfo from the XML data - UpdateInfo info = new UpdateInfo(); - info.uri = new URI(urlNode.getTextContent()); - info.buildID = buildIdNode.getTextContent(); - info.hashFunction = hashFunctionNode.getTextContent(); - info.hashValue = hashValueNode.getTextContent(); - - try { - info.size = Integer.parseInt(sizeNode.getTextContent()); - } catch (NumberFormatException e) { - Log.e(logtag, "Failed to find APK size: ", e); - return null; - } - - // Make sure we have all the stuff we need to apply the update - if (!info.isValid()) { - Log.e(logtag, "missing some required update information, have: " + info); - return null; - } - - return info; - } catch (Exception e) { - Log.e(logtag, "failed to check for update: ", e); - return null; - } finally { - // conn isn't guaranteed to be an HttpURLConnection, hence we don't want to cast earlier - // in this method. However in our current implementation it usually is, so we need to - // make sure we close it in that case: - final HttpURLConnection httpConn = (HttpURLConnection) conn; - if (httpConn != null) { - httpConn.disconnect(); - } - } - } - - private String getString(@StringRes final int stringResId) { - return context.getString(stringResId); - } - - private static boolean hasFlag(int flags, int flag) { - return (flags & flag) == flag; - } - - // The log tag can have at most 23 chars or Log will throw an IllegalArgumentException - private String getLogtagFromParentName(@NonNull final Context context) { - final String parentName = "Gecko" + context.getClass().getSimpleName(); - if (parentName.length() > 23) { - return parentName.substring(0, 24); - } else { - return parentName; - } - } - - /** - * Receiver only used in local notifications that allow for actions to modify current running state. - * As such it is an inner class of current JobIntentService.
- * For any notifications that could allow for actions after the service completed it's work - * use {@link UpdateServiceReceiver} - */ - private class UserUpdatesReceiver extends BroadcastReceiver { - @Override - public void onReceive(Context context, Intent intent) { - final String action = intent.getAction(); - - switch (action) { - case UpdateServiceHelper.ACTION_APPLY_UPDATE: - // User can only press a notification button for this while a download is in progress. - // If download finished the notification will be update to allow starting - // a new JobIntentService to apply the update - if (DEBUG) { - Log.i(logtag, "will apply update when download finished"); - } - shouldApplyImmediately = true; - showDownloadNotification(); - break; - case UpdateServiceHelper.ACTION_CANCEL_DOWNLOAD: - shouldCancelDownload = true; - break; - default: - // no-op, we only listen for the above - } - } - } - - private void registerForLocalBroadcasts(@NonNull final Context context) { - innerBroadcastReceiver = new UserUpdatesReceiver(); - final IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(UpdateServiceHelper.ACTION_APPLY_UPDATE); - intentFilter.addAction(UpdateServiceHelper.ACTION_CANCEL_DOWNLOAD); - - context.registerReceiver(innerBroadcastReceiver, intentFilter); - } - - private void unregisterFromLocalBroadcasts() { - context.unregisterReceiver(innerBroadcastReceiver); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdaterService.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdaterService.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdaterService.java 2020-02-07 00:27:17.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdaterService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Context; -import android.content.Intent; -import android.support.annotation.NonNull; -import android.support.v4.app.JobIntentService; - -import org.mozilla.gecko.CrashHandler; - -public abstract class UpdaterService extends JobIntentService { - private static CrashHandler crashHandler; - protected Updater updater; - protected UpdatesPrefs prefs; - - @Override - public void onCreate() { - initCrashHandler(getApplicationContext()); - - super.onCreate(); - - prefs = new UpdatesPrefs(this); - updater = new Updater(this, prefs, UpdateServiceHelper.BUFSIZE, UpdateServiceHelper.NOTIFICATION_ID); - } - - @Override - protected abstract void onHandleWork(@NonNull Intent intent); - - @Override - public void onDestroy() { - super.onDestroy(); - updater.finish(); - crashHandler.unregister(); - } - - private void initCrashHandler(@NonNull final Context appContext) { - // Will only need one - if (crashHandler == null) { - synchronized (this) { - if (crashHandler == null) { - crashHandler = CrashHandler.createDefaultCrashHandler(appContext); - } - } - } - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesApplyService.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesApplyService.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesApplyService.java 2020-02-07 00:27:23.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesApplyService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Intent; -import android.support.annotation.NonNull; - -public class UpdatesApplyService extends UpdaterService { - @Override - protected void onHandleWork(@NonNull Intent intent) { - // The apply action from the notification while the download is in progress is - // treated in the inner BroadcastReceiver of the service which posted the notification - updater.applyUpdate(intent.getStringExtra(UpdateServiceHelper.EXTRA_PACKAGE_PATH_NAME)); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesCheckService.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesCheckService.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesCheckService.java 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesCheckService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Intent; -import android.support.annotation.NonNull; - -public class UpdatesCheckService extends UpdaterService { - @Override - protected void onHandleWork(@NonNull Intent intent) { - updater.startUpdate(intent.getIntExtra(UpdateServiceHelper.EXTRA_UPDATE_FLAGS_NAME, 0)); - - // Use this instead for forcing a download from about:fennec - // startUpdate(UpdateServiceHelper.FLAG_FORCE_DOWNLOAD | UpdateServiceHelper.FLAG_REINSTALL); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesDownloadService.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesDownloadService.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesDownloadService.java 2020-02-07 00:27:23.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesDownloadService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Intent; -import android.support.annotation.NonNull; - -public class UpdatesDownloadService extends UpdaterService { - @Override - protected void onHandleWork(@NonNull Intent intent) { - updater.setIfShouldApplyUpdateImmediately(true); - updater.startUpdate(Updater.FLAG_FORCE_DOWNLOAD); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesPrefs.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesPrefs.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesPrefs.java 2020-02-07 00:27:31.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesPrefs.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Context; -import android.content.SharedPreferences; -import android.support.annotation.NonNull; - -import org.mozilla.gecko.GeckoAppShell; -import org.mozilla.gecko.updater.UpdateServiceHelper.AutoDownloadPolicy; -import org.mozilla.gecko.updater.UpdateServiceHelper.UpdateInfo; - -import java.io.File; -import java.net.URI; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -public final class UpdatesPrefs { - private static final String PREFS_NAME = "UpdateService"; - private static final String KEY_LAST_BUILDID = "UpdateService.lastBuildID"; - private static final String KEY_LAST_HASH_FUNCTION = "UpdateService.lastHashFunction"; - private static final String KEY_LAST_HASH_VALUE = "UpdateService.lastHashValue"; - private static final String KEY_LAST_FILE_NAME = "UpdateService.lastFileName"; - private static final String KEY_LAST_ATTEMPT_DATE = "UpdateService.lastAttemptDate"; - private static final String KEY_AUTODOWNLOAD_POLICY = "UpdateService.autoDownloadPolicy"; - private static final String KEY_UPDATE_URL = "UpdateService.updateUrl"; - - private SharedPreferences sharedPrefs; - - UpdatesPrefs(@NonNull final Context context) { - sharedPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); - } - - String getPreferenceName() { - return PREFS_NAME; - } - - String getLastBuildID() { - return sharedPrefs.getString(KEY_LAST_BUILDID, null); - } - - String getLastHashFunction() { - return sharedPrefs.getString(KEY_LAST_HASH_FUNCTION, null); - } - - String getLastHashValue() { - return sharedPrefs.getString(KEY_LAST_HASH_VALUE, null); - } - - String getLastFileName() { - return sharedPrefs.getString(KEY_LAST_FILE_NAME, null); - } - - Calendar getLastAttemptDate() { - long lastAttempt = sharedPrefs.getLong(KEY_LAST_ATTEMPT_DATE, -1); - if (lastAttempt < 0) - return null; - - GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - cal.setTimeInMillis(lastAttempt); - return cal; - } - - void setLastAttemptDate() { - SharedPreferences.Editor editor = sharedPrefs.edit(); - editor.putLong(KEY_LAST_ATTEMPT_DATE, System.currentTimeMillis()); - editor.commit(); - } - - AutoDownloadPolicy getAutoDownloadPolicy() { - return AutoDownloadPolicy.get(sharedPrefs.getInt(KEY_AUTODOWNLOAD_POLICY, AutoDownloadPolicy.WIFI.value)); - } - - void setAutoDownloadPolicy(AutoDownloadPolicy policy) { - SharedPreferences.Editor editor = sharedPrefs.edit(); - editor.putInt(KEY_AUTODOWNLOAD_POLICY, policy.value); - editor.commit(); - } - - URI getUpdateURI(boolean force) { - return UpdateServiceHelper.expandUpdateURI(GeckoAppShell.getApplicationContext(), - sharedPrefs.getString(KEY_UPDATE_URL, null), force); - } - - void setUpdateUrl(String url) { - SharedPreferences.Editor editor = sharedPrefs.edit(); - editor.putString(KEY_UPDATE_URL, url); - editor.commit(); - } - - void saveUpdateInfo(UpdateInfo info, File downloaded) { - SharedPreferences.Editor editor = sharedPrefs.edit(); - editor.putString(KEY_LAST_BUILDID, info.buildID); - editor.putString(KEY_LAST_HASH_FUNCTION, info.hashFunction); - editor.putString(KEY_LAST_HASH_VALUE, info.hashValue); - editor.putString(KEY_LAST_FILE_NAME, downloaded.toString()); - editor.commit(); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesRegisterService.java firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesRegisterService.java --- firefox-esr-68.5.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesRegisterService.java 2020-02-07 00:27:35.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/java/org/mozilla/gecko/updater/UpdatesRegisterService.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- - * 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/. */ - -package org.mozilla.gecko.updater; - -import android.content.Intent; -import android.support.annotation.NonNull; - -import org.mozilla.gecko.updater.UpdateServiceHelper.AutoDownloadPolicy; - -public class UpdatesRegisterService extends UpdaterService { - @Override - protected void onHandleWork(@NonNull Intent intent) { - AutoDownloadPolicy policy = AutoDownloadPolicy.get( - intent.getIntExtra(UpdateServiceHelper.EXTRA_AUTODOWNLOAD_NAME, - AutoDownloadPolicy.NONE.value)); - - if (policy != AutoDownloadPolicy.NONE) { - prefs.setAutoDownloadPolicy(policy); - } - - String url = intent.getStringExtra(UpdateServiceHelper.EXTRA_UPDATE_URL_NAME); - if (url != null) { - prefs.setUpdateUrl(url); - } - - updater.registerForUpdates(false); - } -} diff -Nru firefox-esr-68.5.0esr/mobile/android/base/locales/en-US/android_strings.dtd firefox-esr-68.6.0esr/mobile/android/base/locales/en-US/android_strings.dtd --- firefox-esr-68.5.0esr/mobile/android/base/locales/en-US/android_strings.dtd 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/locales/en-US/android_strings.dtd 2020-03-05 20:57:16.000000000 +0000 @@ -472,14 +472,6 @@ service is running. --> - - - - - - @@ -748,25 +740,6 @@ - - - - - - - - - - - - - - - - - @@ -951,7 +924,6 @@ - diff -Nru firefox-esr-68.5.0esr/mobile/android/base/strings.xml.in firefox-esr-68.6.0esr/mobile/android/base/strings.xml.in --- firefox-esr-68.5.0esr/mobile/android/base/strings.xml.in 2020-02-07 00:27:23.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/base/strings.xml.in 2020-03-05 20:57:05.000000000 +0000 @@ -292,10 +292,6 @@ &pref_private_data_syncedTabs; &pref_import_options; &pref_import_android_summary; - &pref_update_autodownload3; - &pref_update_autodownload_wifi; - &pref_update_autodownload_never; - &pref_update_autodownload_always; &pref_tab_queue_title3; &pref_tab_queue_summary4; @@ -544,22 +540,6 @@ &searchable_description; - - &updater_start_title2; - &updater_start_select2; - - &updater_downloading_title2; - &updater_downloading_title_failed2; - &updater_downloading_select2; - &updater_downloading_retry2; - - &updater_apply_title3; - &updater_apply_select3; - - &brandShortName; - &updater_permission_text; - &updater_permission_allow; - &suggestions_prompt3; &search_bar_item_desc; @@ -679,7 +659,6 @@ &media_notification_channel2; &download_notification_channel; &leanplum_default_notifications_channel2; - &updater_notification_channel; &synced_tabs_notification_channel; &site_notifications_channel; &crash_handler_notifications_channel; diff -Nru firefox-esr-68.5.0esr/mobile/android/chrome/content/about.xhtml firefox-esr-68.6.0esr/mobile/android/chrome/content/about.xhtml --- firefox-esr-68.5.0esr/mobile/android/chrome/content/about.xhtml 2020-02-07 00:27:24.000000000 +0000 +++ firefox-esr-68.6.0esr/mobile/android/chrome/content/about.xhtml 2020-03-05 20:57:16.000000000 +0000 @@ -29,16 +29,6 @@