From d8d092b0c308b4ce6be2cc9cccbb58addee27d7b Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Thu, 18 Aug 2016 14:46:12 +0300 Subject: [PATCH 01/16] Bug 1296258 - prevent memory leak in ScaledFontBase::GetGlyphDesignMetrics. r=jrmuizel MozReview-Commit-ID: J3iaMWeVAQ7 --HG-- extra : rebase_source : cdefcb9a1c774bb8fa8f543f7180469de9da952a --- gfx/2d/ScaledFontBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/2d/ScaledFontBase.cpp b/gfx/2d/ScaledFontBase.cpp index d5c991327a57..50418f3ca5e7 100644 --- a/gfx/2d/ScaledFontBase.cpp +++ b/gfx/2d/ScaledFontBase.cpp @@ -235,6 +235,7 @@ ScaledFontBase::GetGlyphDesignMetrics(const uint16_t* aGlyphs, uint32_t aNumGlyp } #endif } + cairo_font_options_destroy(options); } } From 4fe6991de257a9a620658f4db6b20ed23c382c2b Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 22 Aug 2016 22:52:26 +0100 Subject: [PATCH 02/16] Bug 1296907 - fix 1px offset of private browsing to 'normal' browsing window, r=mstange MozReview-Commit-ID: 2TkYag9o9Na --HG-- extra : rebase_source : e97ad441eedef13c29c5afc5a4d6c099188a2a04 --- browser/base/content/browser.css | 11 +++++++++++ browser/themes/osx/devedition.css | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 824803930a93..7eea48196975 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -266,6 +266,17 @@ toolbar[customizing] > .overflow-button { .titlebar-placeholder[type="fullscreen-button"]:-moz-locale-dir(rtl) { -moz-box-ordinal-group: 0; } + +/* In private windows, the #titlebar-content is higher because of the + * private browsing indicator. With the margin-top the titlebar buttons + * align to the top correctly in that case, but only if we don't stretch + * the box they're in because the container is too high, so we override + * the default alignment value (stretch). + */ +#main-window[tabsintitlebar] > #titlebar > #titlebar-content > #titlebar-buttonbox-container { + -moz-box-align: start; +} + %else /* On non-OSX, these should be start-aligned */ #titlebar-buttonbox-container { diff --git a/browser/themes/osx/devedition.css b/browser/themes/osx/devedition.css index 437252834e0b..97fabdc8e574 100644 --- a/browser/themes/osx/devedition.css +++ b/browser/themes/osx/devedition.css @@ -32,16 +32,6 @@ margin-top: 6px; } -/* In private windows, the #titlebar-content is higher because of the - * private browsing indicator. With the margin-top the titlebar buttons - * align to the top correctly in that case, but only if we don't stretch - * the box they're in because the container is too high, so we override - * the default alignment value (stretch). - */ -#main-window[tabsintitlebar] > #titlebar > #titlebar-content > #titlebar-buttonbox-container { - -moz-box-align: start; -} - /* Square back and forward buttons. Need !important on these because there are a lot of more specific selectors sprinkled around elsewhere for changing background / shadows for different states */ From f07a85fa016130c6a6df3d5b44728308e95d7115 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Mon, 22 Aug 2016 20:34:49 -0400 Subject: [PATCH 03/16] Bug 1286627 - Check for undefined shell service before dereferencing it in the ShellService proxy. Linux builds that disable gio do not have the shell service defined and the proxy was throwing. r=Gijs MozReview-Commit-ID: 1wWcEfWFP2c --HG-- extra : rebase_source : cc28bf9c83797111e24ad76033ff23a0e812d4fc --- browser/components/nsBrowserContentHandler.js | 10 +++++----- browser/components/shell/ShellService.jsm | 10 ++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index 4e09594af380..a456f9c407a3 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -715,12 +715,12 @@ nsDefaultCommandLineHandler.prototype = { // instances where users explicitly decide to "open with" the browser. // Note that users who launch firefox manually with the -url flag will // get erroneously counted. - if (cmdLine.findFlag("url", false) && - ShellService.isDefaultBrowser(false, false)) { - try { + try { + if (cmdLine.findFlag("url", false) && + ShellService.isDefaultBrowser(false, false)) { Services.telemetry.getHistogramById("FX_STARTUP_EXTERNAL_CONTENT_HANDLER").add(); - } catch (e) {} - } + } + } catch (e) {} var urilist = []; diff --git a/browser/components/shell/ShellService.jsm b/browser/components/shell/ShellService.jsm index 2fd05d3f4c8f..ecf206efd507 100644 --- a/browser/components/shell/ShellService.jsm +++ b/browser/components/shell/ShellService.jsm @@ -101,7 +101,13 @@ XPCOMUtils.defineLazyServiceGetter(ShellServiceInternal, "shellService", */ this.ShellService = new Proxy(ShellServiceInternal, { get(target, name) { - return name in target ? target[name] : - target.shellService[name]; + if (name in target) { + return target[name]; + } + if (target.shellService) { + return target.shellService[name]; + } + Services.console.logStringMessage(`${name} not found in ShellService: ${target.shellService}`); + return undefined; } }); From 0f151aa2e6f53f4c8b047566db7c9b2217a8c9f3 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Mon, 22 Aug 2016 16:59:33 +1200 Subject: [PATCH 04/16] Bug 1296449, statically link mbsdiff.exe, like we do for mar.exe r=glandium MozReview-Commit-ID: 8oedeUVoQr4 --HG-- extra : rebase_source : c3bb6b6c00b4e787cd108af55254235eed6f50ab --- other-licenses/bsdiff/moz.build | 1 + 1 file changed, 1 insertion(+) diff --git a/other-licenses/bsdiff/moz.build b/other-licenses/bsdiff/moz.build index 1eef8d43d250..a865baf11a9d 100644 --- a/other-licenses/bsdiff/moz.build +++ b/other-licenses/bsdiff/moz.build @@ -21,6 +21,7 @@ if CONFIG['HOST_OS_ARCH'] == 'WINNT': HOST_OS_LIBS += [ 'ws2_32', ] + USE_STATIC_LIBS = True LOCAL_INCLUDES += [ '/toolkit/mozapps/update/updater', From 4a85c13154e85b4d58cb91f3cdf12fa28acfe193 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:15:23 +0800 Subject: [PATCH 05/16] Bug 1295103 - Check OriginAttributes::PopulateFromSuffix return value in SerializedLoadContext.. r=allstars MozReview-Commit-ID: 8zIApW9e5q0 --HG-- extra : rebase_source : c03e073329ada836ff6af481b621be7d0eb875a0 --- docshell/base/SerializedLoadContext.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docshell/base/SerializedLoadContext.h b/docshell/base/SerializedLoadContext.h index 00e251a719ef..99d68b30aa06 100644 --- a/docshell/base/SerializedLoadContext.h +++ b/docshell/base/SerializedLoadContext.h @@ -87,9 +87,7 @@ struct ParamTraits !ReadParam(aMsg, aIter, &suffix)) { return false; } - aResult->mOriginAttributes.PopulateFromSuffix(suffix); - - return true; + return aResult->mOriginAttributes.PopulateFromSuffix(suffix); } }; From 1594b39727939bbbefda35fe8bda48042c0b885e Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:17:08 +0800 Subject: [PATCH 06/16] Bug 1295103 - Check OriginAttributes::PopulateFromSuffix return value in DOMStorageDBThread r=mayhemer MozReview-Commit-ID: FSIgxWNf9s4 --HG-- extra : rebase_source : bf9f04d2ddd33782046594c9c3632a5d59a8be5c --- dom/storage/DOMStorageDBThread.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dom/storage/DOMStorageDBThread.cpp b/dom/storage/DOMStorageDBThread.cpp index 16a4bd0f344b..66790011f622 100644 --- a/dom/storage/DOMStorageDBThread.cpp +++ b/dom/storage/DOMStorageDBThread.cpp @@ -55,7 +55,8 @@ Scheme0Scope(DOMStorageCacheBridge* aCache) PrincipalOriginAttributes oa; if (!suffix.IsEmpty()) { - oa.PopulateFromSuffix(suffix); + DebugOnly success = oa.PopulateFromSuffix(suffix); + MOZ_ASSERT(success); } if (oa.mAppId != nsIScriptSecurityManager::NO_APP_ID || oa.mInIsolatedMozBrowser) { @@ -763,7 +764,8 @@ OriginAttrsPatternMatchSQLFunction::OnFunctionCall( NS_ENSURE_SUCCESS(rv, rv); PrincipalOriginAttributes oa; - oa.PopulateFromSuffix(suffix); + bool success = oa.PopulateFromSuffix(suffix); + NS_ENSURE_TRUE(success, NS_ERROR_FAILURE); bool result = mPattern.Matches(oa); RefPtr outVar(new nsVariant()); From 429b0cc56b271ad70eab56cac2e93cf105672a03 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:18:19 +0800 Subject: [PATCH 07/16] Bug 1295103 - Check OriginAttributes::PopulateFromSuffix return value in nsCookieService. r=mayhemer MozReview-Commit-ID: 8aN6faugiqq --HG-- extra : rebase_source : 6a779feec1845f1b1f0154641136368c494dc42a --- netwerk/cookie/nsCookieService.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 7e5c6c4beb1c..f89ff23fe3fc 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -7,6 +7,7 @@ #include "mozilla/Attributes.h" #include "mozilla/DebugOnly.h" #include "mozilla/Likely.h" +#include "mozilla/unused.h" #include "mozilla/net/CookieServiceChild.h" #include "mozilla/net/NeckoCommon.h" @@ -491,7 +492,8 @@ public: nsAutoCString suffix; row->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix); - tuple->key.mOriginAttributes.PopulateFromSuffix(suffix); + DebugOnly success = tuple->key.mOriginAttributes.PopulateFromSuffix(suffix); + MOZ_ASSERT(success); tuple->cookie = gCookieService->GetCookieFromRow(row, tuple->key.mOriginAttributes); @@ -864,7 +866,8 @@ SetAppIdFromOriginAttributesSQLFunction::OnFunctionCall( rv = aFunctionArguments->GetUTF8String(0, suffix); NS_ENSURE_SUCCESS(rv, rv); - attrs.PopulateFromSuffix(suffix); + bool success = attrs.PopulateFromSuffix(suffix); + NS_ENSURE_TRUE(success, NS_ERROR_FAILURE); RefPtr outVar(new nsVariant()); rv = outVar->SetAsInt32(attrs.mAppId); @@ -896,7 +899,8 @@ SetInBrowserFromOriginAttributesSQLFunction::OnFunctionCall( rv = aFunctionArguments->GetUTF8String(0, suffix); NS_ENSURE_SUCCESS(rv, rv); - attrs.PopulateFromSuffix(suffix); + bool success = attrs.PopulateFromSuffix(suffix); + NS_ENSURE_TRUE(success, NS_ERROR_FAILURE); RefPtr outVar(new nsVariant()); rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser); @@ -2798,7 +2802,9 @@ nsCookieService::EnsureReadComplete() nsAutoCString suffix; NeckoOriginAttributes attrs; stmt->GetUTF8String(IDX_ORIGIN_ATTRIBUTES, suffix); - attrs.PopulateFromSuffix(suffix); + // If PopulateFromSuffix failed we just ignore the OA attributes + // that we don't support + Unused << attrs.PopulateFromSuffix(suffix); nsCookieKey key(baseDomain, attrs); if (mDefaultDBState->readSet.GetEntry(key)) From d137b49d3bd6b74c49aa3f23c80e44ace9fb9a10 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:19:44 +0800 Subject: [PATCH 08/16] Bug 1295103 - Check OriginAttributes::PopulateFromSuffix return value in PackagedAppVerifier. r=mayhemer MozReview-Commit-ID: 7V4vEZKWYHw --HG-- extra : rebase_source : 2f5cea9a361072fbd1955ffc349f74f1e53d9a1c --- netwerk/protocol/http/PackagedAppVerifier.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/PackagedAppVerifier.cpp b/netwerk/protocol/http/PackagedAppVerifier.cpp index 76bc74af25f6..b27e5ec8253c 100644 --- a/netwerk/protocol/http/PackagedAppVerifier.cpp +++ b/netwerk/protocol/http/PackagedAppVerifier.cpp @@ -82,7 +82,8 @@ NS_IMETHODIMP PackagedAppVerifier::Init(nsIPackagedAppVerifierListener* aListene mIsFirstResource = true; mManifest = EmptyCString(); - NeckoOriginAttributes().PopulateFromOrigin(aPackageOrigin, mPackageOrigin); + bool success = NeckoOriginAttributes().PopulateFromOrigin(aPackageOrigin, mPackageOrigin); + NS_ENSURE_TRUE(success, NS_ERROR_FAILURE); mBypassVerification = (mPackageOrigin == Preferences::GetCString("network.http.signed-packages.trusted-origin")); From f221acffb2c5d44e4d981b633b71a0358f79d30b Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:21:53 +0800 Subject: [PATCH 09/16] Bug 1295103 - Check OriginAttributes::PopulateFromSuffix return value in TabContext and ContentChild. r=smaug MozReview-Commit-ID: JWtO5rqJGBF --HG-- extra : rebase_source : d5309aa211f4c85d9e25bc7a912cdfe48f35ca27 --- dom/ipc/ContentChild.cpp | 3 ++- dom/ipc/TabContext.cpp | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 7caea90a1e50..db81c267c64b 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2436,7 +2436,8 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission) // the permission manager does that internally. nsAutoCString originNoSuffix; PrincipalOriginAttributes attrs; - attrs.PopulateFromOrigin(permission.origin, originNoSuffix); + bool success = attrs.PopulateFromOrigin(permission.origin, originNoSuffix); + NS_ENSURE_TRUE(success, false); nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix); diff --git a/dom/ipc/TabContext.cpp b/dom/ipc/TabContext.cpp index f50ab71875a1..351770db6ce3 100644 --- a/dom/ipc/TabContext.cpp +++ b/dom/ipc/TabContext.cpp @@ -369,7 +369,10 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams) showAccelerators = ipcContext.showAccelerators(); showFocusRings = ipcContext.showFocusRings(); originSuffix = ipcContext.originSuffix(); - originAttributes.PopulateFromSuffix(originSuffix); + if (!originAttributes.PopulateFromSuffix(originSuffix)) { + mInvalidReason = "Populate originAttributes from originSuffix failed."; + return; + } break; } case IPCTabContext::TUnsafeIPCTabContext: { From 29b9a17a92cb4f31da0467d16a260a2cf718f018 Mon Sep 17 00:00:00 2001 From: Kan-Ru Chen Date: Mon, 15 Aug 2016 18:22:44 +0800 Subject: [PATCH 10/16] Bug 1295103 - Use MOZ_MUST_USE in OriginAttributes. r=allstars MozReview-Commit-ID: PWUb81L8ya --HG-- extra : rebase_source : 2bdc7adc7a6b5fd121a4621086fab6f87834dd20 --- caps/BasePrincipal.h | 5 +++-- caps/nsJSPrincipals.cpp | 4 +++- caps/tests/gtest/TestOriginAttributes.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/caps/BasePrincipal.h b/caps/BasePrincipal.h index ec34323f726b..5f25665e442a 100644 --- a/caps/BasePrincipal.h +++ b/caps/BasePrincipal.h @@ -11,6 +11,7 @@ #include "nsIScriptSecurityManager.h" #include "nsJSPrincipals.h" +#include "mozilla/Attributes.h" #include "mozilla/dom/ChromeUtilsBinding.h" class nsIContentSecurityPolicy; @@ -45,11 +46,11 @@ public: // |!key1=value1&key2=value2|. If there are no non-default attributes, this // returns an empty string. void CreateSuffix(nsACString& aStr) const; - bool PopulateFromSuffix(const nsACString& aStr); + MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr); // Populates the attributes from a string like // |uri!key1=value1&key2=value2| and returns the uri without the suffix. - bool PopulateFromOrigin(const nsACString& aOrigin, + MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin, nsACString& aOriginNoSuffix); // Helper function to match mIsPrivateBrowsing to existing private browsing diff --git a/caps/nsJSPrincipals.cpp b/caps/nsJSPrincipals.cpp index c21dfa933c54..677cd6da5e59 100644 --- a/caps/nsJSPrincipals.cpp +++ b/caps/nsJSPrincipals.cpp @@ -139,7 +139,9 @@ ReadSuffixAndSpec(JSStructuredCloneReader* aReader, return false; } - aAttrs.PopulateFromSuffix(suffix); + if (!aAttrs.PopulateFromSuffix(suffix)) { + return false; + } aSpec.SetLength(specLength); if (!JS_ReadBytes(aReader, aSpec.BeginWriting(), specLength)) { diff --git a/caps/tests/gtest/TestOriginAttributes.cpp b/caps/tests/gtest/TestOriginAttributes.cpp index 3c2c45427172..e11bf28eb098 100644 --- a/caps/tests/gtest/TestOriginAttributes.cpp +++ b/caps/tests/gtest/TestOriginAttributes.cpp @@ -13,7 +13,8 @@ TestSuffix(const PrincipalOriginAttributes& attrs) attrs.CreateSuffix(suffix); PrincipalOriginAttributes attrsFromSuffix; - attrsFromSuffix.PopulateFromSuffix(suffix); + bool success = attrsFromSuffix.PopulateFromSuffix(suffix); + EXPECT_TRUE(success); EXPECT_EQ(attrs, attrsFromSuffix); } From 9afd64fd9016faf7517e54a29b7afdf548f63fc1 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Tue, 23 Aug 2016 12:36:17 +0200 Subject: [PATCH 11/16] Bug 1292500 - Notify WebrtcUI when video capturing is paused/resumed. r=gcp MozReview-Commit-ID: UkJVR7zCbI --HG-- extra : rebase_source : cf18e6d233d3cdda42d363d240f5375e79ef356d --- .../src/org/webrtc/videoengine/VideoCaptureAndroid.java | 2 ++ mobile/android/chrome/content/WebrtcUI.js | 7 +++++++ mobile/android/chrome/content/browser.js | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java index fad1b9326b1c..64fdd67bb842 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java +++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java @@ -106,6 +106,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL if (camera != null) { mResumeCapture = true; stopCapture(); + GeckoAppShell.notifyObservers("VideoCapture:Paused", null); } } @@ -114,6 +115,7 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback, AppStateL if (mResumeCapture) { startCapture(mCaptureWidth, mCaptureHeight, mCaptureMinFPS, mCaptureMaxFPS); mResumeCapture = false; + GeckoAppShell.notifyObservers("VideoCapture:Resumed", null); } } diff --git a/mobile/android/chrome/content/WebrtcUI.js b/mobile/android/chrome/content/WebrtcUI.js index 7adbe9394b93..9c3a398edc9b 100644 --- a/mobile/android/chrome/content/WebrtcUI.js +++ b/mobile/android/chrome/content/WebrtcUI.js @@ -46,6 +46,13 @@ var WebrtcUI = { this.notify(); break; } + } else if (aTopic === "VideoCapture:Paused") { + if (this._notificationId) { + Notifications.cancel(this._notificationId); + this._notificationId = null; + } + } else if (aTopic === "VideoCapture:Resumed") { + this.notify(); } }, diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 636e54f87782..ba414558bb07 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -166,7 +166,9 @@ if (AppConstants.MOZ_WEBRTC) { lazilyLoadedObserverScripts.push( ["WebrtcUI", ["getUserMedia:request", "PeerConnection:request", - "recording-device-events"], "chrome://browser/content/WebrtcUI.js"]) + "recording-device-events", + "VideoCapture:Paused", + "VideoCapture:Resumed"], "chrome://browser/content/WebrtcUI.js"]) } lazilyLoadedObserverScripts.forEach(function (aScript) { From d301b5abee99614f4c8105849497357a7ede0589 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 19 Aug 2016 14:36:27 -0600 Subject: [PATCH 12/16] Bug 1272098 - load default prefs into Services shim; r=bgrins MozReview-Commit-ID: InZRrl47YWS --HG-- extra : rebase_source : 60a47356f0194157e061bcd135d300f95e025fc6 --- devtools/client/shared/shim/Services.js | 31 ++++++++++++++----- .../shared/shim/test/test_service_prefs.html | 3 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/devtools/client/shared/shim/Services.js b/devtools/client/shared/shim/Services.js index 9bcaaaeb1fb5..2257b3ee88a2 100644 --- a/devtools/client/shared/shim/Services.js +++ b/devtools/client/shared/shim/Services.js @@ -426,9 +426,13 @@ PrefBranch.prototype = { * Helper function to initialize the root PrefBranch. */ _initializeRoot: function () { - if (localStorage.length === 0) { - // FIXME - this is where we'll load devtools.js to install the - // default prefs. + if (localStorage.length === 0 && Services._defaultPrefsEnabled) { + /* eslint-disable no-eval */ + let devtools = require("raw!prefs!devtools/client/preferences/devtools"); + eval(devtools); + let all = require("raw!prefs!modules/libpref/init/all"); + eval(all); + /* eslint-enable no-eval */ } // Read the prefs from local storage and create the local @@ -449,12 +453,25 @@ PrefBranch.prototype = { }; const Services = { + _prefs: null, + + // For use by tests. If set to false before Services.prefs is used, + // this will disable the reading of the default prefs. + _defaultPrefsEnabled: true, + /** * An implementation of nsIPrefService that is based on local * storage. Only the subset of nsIPrefService that is actually used - * by devtools is implemented here. + * by devtools is implemented here. This is lazily instantiated so + * that the tests have a chance to disable the loading of default + * prefs. */ - prefs: new PrefBranch(null, "", ""), + get prefs() { + if (!this._prefs) { + this._prefs = new PrefBranch(null, "", ""); + } + return this._prefs; + }, /** * An implementation of Services.appinfo that holds just the @@ -582,7 +599,5 @@ function pref(name, value) { } module.exports = Services; -// This is exported to silence eslint and, at some point, perhaps to -// provide it when loading devtools.js in order to install the default -// preferences. +// This is exported to silence eslint. exports.pref = pref; diff --git a/devtools/client/shared/shim/test/test_service_prefs.html b/devtools/client/shared/shim/test/test_service_prefs.html index fbf64451f21a..99e827dfde21 100644 --- a/devtools/client/shared/shim/test/test_service_prefs.html +++ b/devtools/client/shared/shim/test/test_service_prefs.html @@ -52,6 +52,9 @@ localStorage.setItem("Services.prefs:devtools.branch2.someint", JSON.stringify({ "use strict"; function do_tests() { + // We can't load the defaults in this context. + Services._defaultPrefsEnabled = false; + is(Services.prefs.getBoolPref("devtools.branch1.somebool"), false, "bool pref value"); Services.prefs.setBoolPref("devtools.branch1.somebool", true); From 0cdf5dddc29671bf23b621091c26d634317448da Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Tue, 23 Aug 2016 09:11:36 -0400 Subject: [PATCH 13/16] Bug 1297377 - Reftests on OSX should generate and upload a structured log artifact, r=jgraham MozReview-Commit-ID: 2QdsnWBmoey --HG-- extra : rebase_source : 8f504d6b5b262ae405b193fe24c65a9cc5c1a836 --- testing/mozharness/configs/unittests/mac_unittest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/mozharness/configs/unittests/mac_unittest.py b/testing/mozharness/configs/unittests/mac_unittest.py index 23c4bd07f20d..693f76fda383 100644 --- a/testing/mozharness/configs/unittests/mac_unittest.py +++ b/testing/mozharness/configs/unittests/mac_unittest.py @@ -114,7 +114,9 @@ config = { "--appname=%(binary_path)s", "--utility-path=tests/bin", "--extra-profile-file=tests/bin/plugins", - "--symbols-path=%(symbols_path)s" + "--symbols-path=%(symbols_path)s", + "--log-raw=%(raw_log_file)s", + "--log-errorsummary=%(error_summary_file)s", "--cleanup-crashes", ], "run_filename": "runreftest.py", From fa4f868ca7674c6c65460d581252f9ae6838c9bc Mon Sep 17 00:00:00 2001 From: Gregory Arndt Date: Wed, 6 Jul 2016 09:06:58 -0500 Subject: [PATCH 14/16] Bug 1263815 - retry xvfb startup. r=dustin Sometimes xvfb will not start up with the current retry/delay settings. This will attempt to retry more and delay for longer to ensure xvfb has started up. Common pieces of this have been factored out into a recipe that all docker images can schare that need this functionality. MozReview-Commit-ID: BTXkJkBWLZX --HG-- extra : rebase_source : 7554d7784768a65deb2c9ccb89586e5f77550e9f --- taskcluster/scripts/builder/build-l10n.sh | 31 ++------ taskcluster/scripts/builder/build-linux.sh | 31 ++------ taskcluster/scripts/tester/test-ubuntu1204.sh | 34 ++------- taskcluster/scripts/tester/test-ubuntu1604.sh | 35 ++------- testing/docker/desktop-build/Dockerfile | 8 ++ testing/docker/desktop-test/Dockerfile | 4 + testing/docker/desktop1604-test/Dockerfile | 4 + testing/docker/recipes/xvfb.sh | 75 +++++++++++++++++++ 8 files changed, 111 insertions(+), 111 deletions(-) create mode 100644 testing/docker/recipes/xvfb.sh diff --git a/taskcluster/scripts/builder/build-l10n.sh b/taskcluster/scripts/builder/build-l10n.sh index 1b2412b6da08..c711b299476f 100644 --- a/taskcluster/scripts/builder/build-l10n.sh +++ b/taskcluster/scripts/builder/build-l10n.sh @@ -4,6 +4,8 @@ set -x -e echo "running as" $(id) +. /home/worker/scripts/xvfb.sh + #### # Taskcluster friendly wrapper for performing fx desktop l10n repacks via mozharness. # Based on ./build-linux.sh @@ -43,37 +45,14 @@ if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi cleanup() { local rv=$? - if [ -n "$xvfb_pid" ]; then - kill $xvfb_pid || true - fi + cleanup_xvfb exit $rv } trap cleanup EXIT INT -# run mozharness in XVfb, if necessary; this is an array to maintain the quoting in the -s argument +# run XVfb in the background, if necessary if $NEED_XVFB; then - # Some mozharness scripts set DISPLAY=:2 - Xvfb :2 -screen 0 1024x768x24 & - export DISPLAY=:2 - xvfb_pid=$! - # Only error code 255 matters, because it signifies that no - # display could be opened. As long as we can open the display - # tests should work. We'll retry a few times with a sleep before - # failing. - retry_count=0 - max_retries=2 - xvfb_test=0 - until [ $retry_count -gt $max_retries ]; do - xvinfo || xvfb_test=$? - if [ $xvfb_test != 255 ]; then - retry_count=$(($max_retries + 1)) - else - retry_count=$(($retry_count + 1)) - echo "Failed to start Xvfb, retry: $retry_count" - sleep 2 - fi - done - if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi + start_xvfb '1024x768x24' 2 fi # set up mozharness configuration, via command line, env, etc. diff --git a/taskcluster/scripts/builder/build-linux.sh b/taskcluster/scripts/builder/build-linux.sh index 922582365e76..f84f4e479cdc 100644 --- a/taskcluster/scripts/builder/build-linux.sh +++ b/taskcluster/scripts/builder/build-linux.sh @@ -4,6 +4,8 @@ set -x -e echo "running as" $(id) +. /home/worker/scripts/xvfb.sh + #### # Taskcluster friendly wrapper for performing fx desktop builds via mozharness. #### @@ -54,37 +56,14 @@ if [[ -z ${MOZHARNESS_CONFIG} ]]; then fail "MOZHARNESS_CONFIG is not set"; fi cleanup() { local rv=$? - if [ -n "$xvfb_pid" ]; then - kill $xvfb_pid || true - fi + cleanup_xvfb exit $rv } trap cleanup EXIT INT -# run mozharness in XVfb, if necessary; this is an array to maintain the quoting in the -s argument +# run XVfb in the background, if necessary if $NEED_XVFB; then - # Some mozharness scripts set DISPLAY=:2 - Xvfb :2 -screen 0 1024x768x24 & - export DISPLAY=:2 - xvfb_pid=$! - # Only error code 255 matters, because it signifies that no - # display could be opened. As long as we can open the display - # tests should work. We'll retry a few times with a sleep before - # failing. - retry_count=0 - max_retries=2 - xvfb_test=0 - until [ $retry_count -gt $max_retries ]; do - xvinfo || xvfb_test=$? - if [ $xvfb_test != 255 ]; then - retry_count=$(($max_retries + 1)) - else - retry_count=$(($retry_count + 1)) - echo "Failed to start Xvfb, retry: $retry_count" - sleep 2 - fi - done - if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi + start_xvfb '1024x768x24' 2 fi # set up mozharness configuration, via command line, env, etc. diff --git a/taskcluster/scripts/tester/test-ubuntu1204.sh b/taskcluster/scripts/tester/test-ubuntu1204.sh index 75cc20e4b640..bc1f9ed43959 100644 --- a/taskcluster/scripts/tester/test-ubuntu1204.sh +++ b/taskcluster/scripts/tester/test-ubuntu1204.sh @@ -4,6 +4,8 @@ set -x -e echo "running as" $(id) +. /home/worker/scripts/xvfb.sh + #### # Taskcluster friendly wrapper for performing fx desktop tests via mozharness. #### @@ -43,13 +45,7 @@ cleanup() { # To share X issues cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log fi - # When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE - # we make sure we do not kill xvfb so you do not lose your connection - xvfb_pid=`pidof Xvfb` - if [ -n "$xvfb_pid" ] && [ $START_VNC == false ] && [ $TASKCLUSTER_INTERACTIVE == false ] ; then - kill $xvfb_pid || true - screen -XS xvfb quit || true - fi + cleanup_xvfb exit $rv } trap cleanup EXIT INT @@ -73,29 +69,9 @@ if $NEED_PULSEAUDIO; then pactl load-module module-null-sink fi -# run Xvfb in the background, if necessary +# run XVfb in the background, if necessary if $NEED_XVFB; then - screen -dmS xvfb Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 \ - > ~/artifacts/public/xvfb.log 2>&1 - export DISPLAY=:0 - # Only error code 255 matters, because it signifies that no - # display could be opened. As long as we can open the display - # tests should work. We'll retry a few times with a sleep before - # failing. - retry_count=0 - max_retries=2 - xvfb_test=0 - until [ $retry_count -gt $max_retries ]; do - xvinfo || xvfb_test=$? - if [ $xvfb_test != 255 ]; then - retry_count=$(($max_retries + 1)) - else - retry_count=$(($retry_count + 1)) - echo "Failed to start Xvfb, retry: $retry_count" - sleep 2 - fi - done - if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi + start_xvfb '1600x1200x24' 0 fi if $START_VNC; then diff --git a/taskcluster/scripts/tester/test-ubuntu1604.sh b/taskcluster/scripts/tester/test-ubuntu1604.sh index 42dae070b7a5..bdf22df35aa1 100644 --- a/taskcluster/scripts/tester/test-ubuntu1604.sh +++ b/taskcluster/scripts/tester/test-ubuntu1604.sh @@ -4,6 +4,8 @@ set -x -e echo "running as" $(id) +. /home/worker/scripts/xvfb.sh + #### # Taskcluster friendly wrapper for performing fx desktop tests via mozharness. #### @@ -43,13 +45,7 @@ cleanup() { # To share X issues cp /home/worker/.xsession-errors ~/artifacts/public/xsession-errors.log fi - # When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE - # we make sure we do not kill xvfb so you do not lose your connection - xvfb_pid=`pidof Xvfb` - if [ -n "$xvfb_pid" ] && [ $START_VNC == false ] && [ $TASKCLUSTER_INTERACTIVE == false ] ; then - kill $xvfb_pid || true - screen -XS xvfb quit || true - fi + cleanup_xvfb exit $rv } trap cleanup EXIT INT @@ -66,30 +62,9 @@ if ! [ -d mozharness ]; then fail "mozharness zip did not contain mozharness/" fi -# run Xvfb in the background, if necessary +# run XVfb in the background, if necessary if $NEED_XVFB; then - screen -dmS xvfb Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 \ - > ~/artifacts/public/xvfb.log 2>&1 - export DISPLAY=:0 - - # Only error code 255 matters, because it signifies that no - # display could be opened. As long as we can open the display - # tests should work. We'll retry a few times with a sleep before - # failing. - retry_count=0 - max_retries=2 - xvfb_test=0 - until [ $retry_count -gt $max_retries ]; do - xvinfo || xvfb_test=$? - if [ $xvfb_test != 255 ]; then - retry_count=$(($max_retries + 1)) - else - retry_count=$(($retry_count + 1)) - echo "Failed to start Xvfb, retry: $retry_count" - sleep 2 - fi - done - if [ $xvfb_test == 255 ]; then fail "xvfb did not start properly"; fi + start_xvfb '1600x1200x24' 0 fi if $START_VNC; then diff --git a/testing/docker/desktop-build/Dockerfile b/testing/docker/desktop-build/Dockerfile index 96c1b66a79df..a4917bdd55aa 100644 --- a/testing/docker/desktop-build/Dockerfile +++ b/testing/docker/desktop-build/Dockerfile @@ -11,6 +11,10 @@ VOLUME /home/worker/tooltool-cache ADD bin /home/worker/bin RUN chmod +x /home/worker/bin/* +# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb +# %include testing/docker/recipes/xvfb.sh +ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh + # Add configuration COPY dot-config /home/worker/.config @@ -33,5 +37,9 @@ ADD buildprops.json /home/worker/ RUN wget -O /builds/tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py RUN chmod +x /builds/tooltool.py +# Move installation to base centos6-build image once Bug 1272629 is fixed +# Install the screen package here to use with xvfb. +RUN yum install -y screen + # Set a default command useful for debugging CMD ["/bin/bash", "--login"] diff --git a/testing/docker/desktop-test/Dockerfile b/testing/docker/desktop-test/Dockerfile index b5e091117173..3bc64ba48f02 100644 --- a/testing/docker/desktop-test/Dockerfile +++ b/testing/docker/desktop-test/Dockerfile @@ -10,6 +10,10 @@ ADD topsrcdir/testing/docker/recipes/tooltool.py /setup/tooltool.py # %include testing/docker/recipes/install-mercurial.sh ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /tmp/install-mercurial.sh +# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb +# %include testing/docker/recipes/xvfb.sh +ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh + # %include testing/docker/recipes/ubuntu1204-test-system-setup.sh ADD topsrcdir/testing/docker/recipes/ubuntu1204-test-system-setup.sh /setup/system-setup.sh RUN bash /setup/system-setup.sh diff --git a/testing/docker/desktop1604-test/Dockerfile b/testing/docker/desktop1604-test/Dockerfile index dbcd13e9e23c..ccfea93f248d 100644 --- a/testing/docker/desktop1604-test/Dockerfile +++ b/testing/docker/desktop1604-test/Dockerfile @@ -14,6 +14,10 @@ ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /setup/install-mercuri ADD topsrcdir/testing/docker/recipes/ubuntu1604-test-system-setup.sh /setup/system-setup.sh RUN bash /setup/system-setup.sh +# Add wrapper scripts for xvfb allowing tasks to easily retry starting up xvfb +# %include testing/docker/recipes/xvfb.sh +ADD topsrcdir/testing/docker/recipes/xvfb.sh /home/worker/scripts/xvfb.sh + # %include testing/docker/recipes/run-task ADD topsrcdir/testing/docker/recipes/run-task /home/worker/bin/run-task diff --git a/testing/docker/recipes/xvfb.sh b/testing/docker/recipes/xvfb.sh new file mode 100644 index 000000000000..6e0e79f7d481 --- /dev/null +++ b/testing/docker/recipes/xvfb.sh @@ -0,0 +1,75 @@ +#! /bin/bash -x + +set -x + +fail() { + echo # make sure error message is on a new line + echo "[xvfb.sh:error]" "${@}" + exit 1 +} + +cleanup_xvfb() { + # When you call this script with START_VNC or TASKCLUSTER_INTERACTIVE + # we make sure we do not kill xvfb so you do not lose your connection + local xvfb_pid=`pidof Xvfb` + local vnc=${START_VNC:-false} + local interactive=${TASKCLUSTER_INTERACTIVE:-false} + if [ -n "$xvfb_pid" ] && [[ $vnc == false ]] && [[ $interactive == false ]] ; then + kill $xvfb_pid || true + screen -XS xvfb quit || true + fi +} + +# Attempt to start xvfb in a screen session with the given resolution and display +# number. Up to 5 attempts will be made to start xvfb with a short delay +# between retries +try_xvfb() { + screen -dmS xvfb Xvfb :$2 -nolisten tcp -screen 0 $1 \ + > ~/artifacts/xvfb/xvfb.log 2>&1 + export DISPLAY=:$2 + + # Only error code 255 matters, because it signifies that no + # display could be opened. As long as we can open the display + # tests should work. We'll retry a few times with a sleep before + # failing. + local retry_count=0 + local max_retries=5 + xvfb_test=0 + until [ $retry_count -gt $max_retries ]; do + xvinfo || xvfb_test=$? + if [ $xvfb_test != 255 ]; then + retry_count=$(($max_retries + 1)) + else + retry_count=$(($retry_count + 1)) + echo "Failed to start Xvfb, retry: $retry_count" + sleep 2 + fi + done + if [ $xvfb_test == 255 ]; then + return 1 + else + return 0 + fi +} + +start_xvfb() { + set +e + mkdir -p ~/artifacts/xvfb + local retry_count=0 + local max_retries=2 + local success=1 + until [ $retry_count -gt $max_retries ]; do + try_xvfb $1 $2 + success=$? + if [ $success -eq 0 ]; then + retry_count=$(($max_retries + 1)) + else + retry_count=$(($retry_count + 1)) + sleep 10 + fi + done + set -e + if [ $success -eq 1 ]; then + fail "Could not start xvfb after ${max_retries} attempts" + fi +} From 6b5d20418045b3270a5d292c4a5abad3aee04b45 Mon Sep 17 00:00:00 2001 From: Tom Klein Date: Fri, 19 Aug 2016 22:10:26 -0500 Subject: [PATCH 15/16] Bug 1291756 - Update "Help" and about:firefox "Support" links. r=ahunt MozReview-Commit-ID: EfgLv8Ohh9z --HG-- extra : rebase_source : fcd7a7650de3ddf15b98eac0e41addff6907d763 --- mobile/android/app/mobile.js | 5 +++-- mobile/android/base/strings.xml.in | 4 ++-- mobile/android/chrome/content/about.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index cf17de421698..a276902c7b89 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -472,7 +472,10 @@ pref("plugin.default.state", 1); // product URLs // The breakpad report server to link to in about:crashes pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/"); + pref("app.support.baseURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/"); +pref("app.supportURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/mobile-help"); +pref("app.faqURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/faq"); // URL for feedback page // This should be kept in sync with the "feedback_link" string defined in strings.xml.in @@ -489,8 +492,6 @@ pref("app.releaseNotesURL", "https://www.mozilla.com/%LOCALE%/mobile/%VERSION%be pref("app.releaseNotesURL", "https://www.mozilla.com/%LOCALE%/mobile/%VERSION%/releasenotes/"); #endif -pref("app.faqURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/faq"); - // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror) pref("security.alternate_certificate_error_page", "certerror"); diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index 12ec91938b29..3a7d611c4bdb 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -85,8 +85,8 @@ &url_bar_default_text2; - - https://support.mozilla.org/1/mobile/&formatS1;/&formatS2;/&formatS3;/ + + https://support.mozilla.org/1/mobile/&formatS1;/&formatS2;/&formatS3;/mobile-help &help_menu; &quit; diff --git a/mobile/android/chrome/content/about.js b/mobile/android/chrome/content/about.js index b78517a7c091..8c9acdf8ae13 100644 --- a/mobile/android/chrome/content/about.js +++ b/mobile/android/chrome/content/about.js @@ -45,7 +45,7 @@ function init() { let links = [ {id: "releaseNotesURL", pref: "app.releaseNotesURL"}, - {id: "supportURL", pref: "app.support.baseURL"}, + {id: "supportURL", pref: "app.supportURL"}, {id: "faqURL", pref: "app.faqURL"}, {id: "privacyURL", pref: "app.privacyURL"}, {id: "creditsURL", pref: "app.creditsURL"}, From 3de1ea925a30cd79bce9b0cb0fd2fec85ce8a12d Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Tue, 23 Aug 2016 13:50:14 -0700 Subject: [PATCH 16/16] Backed out changeset 54933b5b96f1 (bug 1260324) for frequent windows reftest failures a=backout CLOSED TREE --- image/DynamicImage.cpp | 4 +++- image/ImageWrapper.cpp | 4 ++-- image/OrientedImage.cpp | 2 +- image/RasterImage.cpp | 35 +-------------------------------- image/RasterImage.h | 2 -- image/VectorImage.cpp | 2 +- image/VectorImage.h | 2 +- image/imgIContainer.idl | 7 ++----- layout/generic/nsImageFrame.cpp | 2 +- layout/style/nsStyleStruct.cpp | 2 +- 10 files changed, 13 insertions(+), 49 deletions(-) diff --git a/image/DynamicImage.cpp b/image/DynamicImage.cpp index 670595aecbbb..a877a6d83882 100644 --- a/image/DynamicImage.cpp +++ b/image/DynamicImage.cpp @@ -195,8 +195,10 @@ DynamicImage::GetFrameAtSize(const IntSize& aSize, } NS_IMETHODIMP_(bool) -DynamicImage::WillDrawOpaqueNow() +DynamicImage::IsOpaque() { + // XXX(seth): For performance reasons it'd be better to return true here, but + // I'm not sure how we can guarantee it for an arbitrary gfxDrawable. return false; } diff --git a/image/ImageWrapper.cpp b/image/ImageWrapper.cpp index f7068dfc5890..9a485d0a589f 100644 --- a/image/ImageWrapper.cpp +++ b/image/ImageWrapper.cpp @@ -185,9 +185,9 @@ ImageWrapper::GetFrameAtSize(const IntSize& aSize, } NS_IMETHODIMP_(bool) -ImageWrapper::WillDrawOpaqueNow() +ImageWrapper::IsOpaque() { - return mInnerImage->WillDrawOpaqueNow(); + return mInnerImage->IsOpaque(); } NS_IMETHODIMP_(bool) diff --git a/image/OrientedImage.cpp b/image/OrientedImage.cpp index 8ad3360d6963..bba850ec8045 100644 --- a/image/OrientedImage.cpp +++ b/image/OrientedImage.cpp @@ -89,7 +89,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame, // Determine an appropriate format for the surface. gfx::SurfaceFormat surfaceFormat; - if (InnerImage()->WillDrawOpaqueNow()) { + if (InnerImage()->IsOpaque()) { surfaceFormat = gfx::SurfaceFormat::B8G8R8X8; } else { surfaceFormat = gfx::SurfaceFormat::B8G8R8A8; diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 39eb40abd91d..b2f7116de3f1 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -377,7 +377,7 @@ RasterImage::LookupFrame(const IntSize& aSize, return Move(result.Surface()); } -bool +NS_IMETHODIMP_(bool) RasterImage::IsOpaque() { if (mError) { @@ -395,39 +395,6 @@ RasterImage::IsOpaque() return !(progress & FLAG_HAS_TRANSPARENCY); } -NS_IMETHODIMP_(bool) -RasterImage::WillDrawOpaqueNow() -{ - if (!IsOpaque()) { - return false; - } - - if (mAnimationState) { - // We never discard frames of animated images. - return true; - } - - // If we are not locked our decoded data could get discard at any time (ie - // between the call to this function and when we are asked to draw), so we - // have to return false if we are unlocked. - if (IsUnlocked()) { - return false; - } - - LookupResult result = - SurfaceCache::LookupBestMatch(ImageKey(this), - RasterSurfaceKey(mSize, - DefaultSurfaceFlags(), - PlaybackType::eStatic)); - MatchType matchType = result.Type(); - if (matchType == MatchType::NOT_FOUND || matchType == MatchType::PENDING || - !result.Surface()->IsFinished()) { - return false; - } - - return true; -} - void RasterImage::OnSurfaceDiscarded() { diff --git a/image/RasterImage.h b/image/RasterImage.h index d664471ddcde..62ff2ed6a51c 100644 --- a/image/RasterImage.h +++ b/image/RasterImage.h @@ -484,8 +484,6 @@ private: // data // Helpers bool CanDiscard(); - bool IsOpaque(); - protected: explicit RasterImage(ImageURL* aURI = nullptr); diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index 5a2efbeff694..375f557d6cfa 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -678,7 +678,7 @@ VectorImage::GetFirstFrameDelay() } NS_IMETHODIMP_(bool) -VectorImage::WillDrawOpaqueNow() +VectorImage::IsOpaque() { return false; // In general, SVG content is not opaque. } diff --git a/image/VectorImage.h b/image/VectorImage.h index 7a1d60ed7224..3753785975c5 100644 --- a/image/VectorImage.h +++ b/image/VectorImage.h @@ -49,7 +49,7 @@ public: nsresult aResult, bool aLastPart) override; - virtual void OnSurfaceDiscarded() override; + void OnSurfaceDiscarded() override; /** * Callback for SVGRootRenderingObserver. diff --git a/image/imgIContainer.idl b/image/imgIContainer.idl index b35f1935a108..107d5fe2c912 100644 --- a/image/imgIContainer.idl +++ b/image/imgIContainer.idl @@ -255,12 +255,9 @@ interface imgIContainer : nsISupports in uint32_t aFlags); /** - * Returns true if this image will draw opaquely right now if asked to draw - * with FLAG_HIGH_QUALITY_SCALING and otherwise default flags. If this image - * (when decoded) is opaque but no decoded frames are available then - * willDrawOpaqueNow will return false. + * Whether this image is opaque (i.e., needs a background painted behind it). */ - [noscript, notxpcom] boolean willDrawOpaqueNow(); + [notxpcom] boolean isOpaque(); /** * @return true if getImageContainer() is expected to return a valid diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index b5af60d087f8..0438fdabd0e7 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1634,7 +1634,7 @@ nsDisplayImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, bool* aSnap) { *aSnap = false; - if (mImage && mImage->WillDrawOpaqueNow()) { + if (mImage && mImage->IsOpaque()) { const nsRect frameContentBox = GetBounds(aSnap); return GetDestRect().Intersect(frameContentBox); } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 2852b0c7dee9..62496d53d276 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -2218,7 +2218,7 @@ nsStyleImage::IsOpaque() const MOZ_ASSERT(imageContainer, "IsComplete() said image container is ready"); // Check if the crop region of the image is opaque. - if (imageContainer->WillDrawOpaqueNow()) { + if (imageContainer->IsOpaque()) { if (!mCropRect) { return true; }