diff --git a/caps/ContentPrincipal.cpp b/caps/ContentPrincipal.cpp index b5423f70cf79..e21f6e0a5f94 100644 --- a/caps/ContentPrincipal.cpp +++ b/caps/ContentPrincipal.cpp @@ -391,17 +391,18 @@ ContentPrincipal::SetDomain(nsIURI* aDomain) } static nsresult -GetBaseDomainHelper(const nsCOMPtr& aCodebase, - bool* aHasBaseDomain, - nsACString& aBaseDomain) +GetSpecialBaseDomain(const nsCOMPtr& aCodebase, + bool* aHandled, + nsACString& aBaseDomain) { - *aHasBaseDomain = false; + *aHandled = false; // For a file URI, we return the file path. if (NS_URIIsLocalFile(aCodebase)) { nsCOMPtr url = do_QueryInterface(aCodebase); if (url) { + *aHandled = true; return url->GetFilePath(aBaseDomain); } } @@ -415,52 +416,84 @@ GetBaseDomainHelper(const nsCOMPtr& aCodebase, } if (hasNoRelativeFlag) { + *aHandled = true; return aCodebase->GetSpec(aBaseDomain); } - *aHasBaseDomain = true; - - // For everything else, we ask the TLD service via - // the ThirdPartyUtil. - nsCOMPtr thirdPartyUtil = - do_GetService(THIRDPARTYUTIL_CONTRACTID); - if (thirdPartyUtil) { - return thirdPartyUtil->GetBaseDomain(aCodebase, aBaseDomain); - } - return NS_OK; } NS_IMETHODIMP ContentPrincipal::GetBaseDomain(nsACString& aBaseDomain) { - bool hasBaseDomain; - return GetBaseDomainHelper(mCodebase, &hasBaseDomain, aBaseDomain); + // Handle some special URIs first. + bool handled; + nsresult rv = GetSpecialBaseDomain(mCodebase, &handled, aBaseDomain); + NS_ENSURE_SUCCESS(rv, rv); + + if (handled) { + return NS_OK; + } + + // For everything else, we ask the TLD service via the ThirdPartyUtil. + nsCOMPtr thirdPartyUtil = + do_GetService(THIRDPARTYUTIL_CONTRACTID); + if (!thirdPartyUtil) { + return NS_ERROR_FAILURE; + } + + return thirdPartyUtil->GetBaseDomain(mCodebase, aBaseDomain); } NS_IMETHODIMP ContentPrincipal::GetSiteOrigin(nsACString& aSiteOrigin) { - // Determine our base domain. - bool hasBaseDomain; + // Handle some special URIs first. nsAutoCString baseDomain; - nsresult rv = GetBaseDomainHelper(mCodebase, &hasBaseDomain, baseDomain); + bool handled; + nsresult rv = GetSpecialBaseDomain(mCodebase, &handled, baseDomain); NS_ENSURE_SUCCESS(rv, rv); - if (!hasBaseDomain) { + if (handled) { // This is a special URI ("file:", "about:", "view-source:", etc). Just // return the origin. return GetOrigin(aSiteOrigin); } + // For everything else, we ask the TLD service. Note that, unlike in + // GetBaseDomain, we don't use ThirdPartyUtil.getBaseDomain because if the + // host is an IP address that returns the raw address and we can't use it with + // SetHost below because SetHost expects '[' and ']' around IPv6 addresses. + // See bug 1491728. + nsCOMPtr tldService = + do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID); + if (!tldService) { + return NS_ERROR_FAILURE; + } + + bool gotBaseDomain = false; + rv = tldService->GetBaseDomain(mCodebase, 0, baseDomain); + if (NS_SUCCEEDED(rv)) { + gotBaseDomain = true; + } else { + // If this is an IP address or something like "localhost", we just continue + // with gotBaseDomain = false. + if (rv != NS_ERROR_HOST_IS_IP_ADDRESS && + rv != NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS) { + return rv; + } + } + // NOTE: Calling `SetHostPort` with a portless domain is insufficient to clear // the port, so an extra `SetPort` call has to be made. nsCOMPtr siteUri; - rv = NS_MutateURI(mCodebase) - .SetUserPass(EmptyCString()) - .SetPort(-1) - .SetHostPort(baseDomain) - .Finalize(siteUri); + NS_MutateURI mutator(mCodebase); + mutator.SetUserPass(EmptyCString()) + .SetPort(-1); + if (gotBaseDomain) { + mutator.SetHost(baseDomain); + } + rv = mutator.Finalize(siteUri); MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to create siteUri"); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index 0eb87ff6b1f4..c3f592118c8a 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -374,6 +374,11 @@ Animation::UpdatePlaybackRate(double aPlaybackRate) return; } + // Calculate the play state using the existing playback rate since below we + // want to know if the animation is _currently_ finished or not, not whether + // it _will_ be finished. + AnimationPlayState playState = PlayState(); + mPendingPlaybackRate = Some(aPlaybackRate); // If we already have a pending task, there is nothing more to do since the @@ -384,7 +389,6 @@ Animation::UpdatePlaybackRate(double aPlaybackRate) AutoMutationBatchForAnimation mb(*this); - AnimationPlayState playState = PlayState(); if (playState == AnimationPlayState::Idle || playState == AnimationPlayState::Paused) { // We are either idle or paused. In either case we can apply the pending @@ -457,9 +461,10 @@ Animation::PlayState() const return AnimationPlayState::Paused; } + double playbackRate = CurrentOrPendingPlaybackRate(); if (!currentTime.IsNull() && - ((mPlaybackRate > 0.0 && currentTime.Value() >= EffectEnd()) || - (mPlaybackRate < 0.0 && currentTime.Value() <= TimeDuration()))) { + ((playbackRate > 0.0 && currentTime.Value() >= EffectEnd()) || + (playbackRate < 0.0 && currentTime.Value() <= TimeDuration()))) { return AnimationPlayState::Finished; } diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 7213cbc90144..53bbb35ba14d 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -1564,7 +1564,7 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In MOZ_ASSERT(aTarget == nullptr); MOZ_ASSERT(aRect == nullptr); - AUTO_PROFILER_TRACING("Paint", "CompositeToTraget"); + AUTO_PROFILER_TRACING("Paint", "CompositeToTarget"); if (mPaused || !mReceivedDisplayList) { mPreviousFrameTimeStamp = TimeStamp(); return; diff --git a/testing/web-platform/tests/web-animations/timing-model/animations/play-states.html b/testing/web-platform/tests/web-animations/timing-model/animations/play-states.html index 5d8fdeac6ecc..ec7d8c842fc9 100644 --- a/testing/web-platform/tests/web-animations/timing-model/animations/play-states.html +++ b/testing/web-platform/tests/web-animations/timing-model/animations/play-states.html @@ -22,8 +22,7 @@ test(t => { + ' and no pending tasks') test(t => { - const div = createDiv(t); - const animation = div.animate({}, 100 * MS_PER_SEC); + const animation = createDiv(t).animate({}, 100 * MS_PER_SEC); animation.pause(); @@ -134,8 +133,7 @@ test(t => { + ' current time = 0'); test(t => { - const div = createDiv(t); - const animation = div.animate({}, 0); + const animation = createDiv(t).animate({}, 0); assert_equals(animation.startTime, null, 'Sanity check: start time should be unresolved'); @@ -144,8 +142,7 @@ test(t => { + ' current time = target effect end and there is a pending play task'); test(t => { - const div = createDiv(t); - const animation = div.animate({}, 100 * MS_PER_SEC); + const animation = createDiv(t).animate({}, 100 * MS_PER_SEC); assert_equals(animation.startTime, null, 'Sanity check: start time should be unresolved'); @@ -153,5 +150,36 @@ test(t => { }, 'reports \'running\' when playback rate > 0 and' + ' current time < target effect end and there is a pending play task'); +test(t => { + const animation = createDiv(t).animate({}, 100 * MS_PER_SEC); + assert_equals(animation.playState, 'running'); + assert_true(animation.pending); +}, 'reports \'running\' for a play-pending animation'); + +test(t => { + const animation = createDiv(t).animate({}, 100 * MS_PER_SEC); + animation.pause(); + assert_equals(animation.playState, 'paused'); + assert_true(animation.pending); +}, 'reports \'paused\' for a pause-pending animation'); + +test(t => { + const animation = createDiv(t).animate({}, 0); + assert_equals(animation.playState, 'finished'); + assert_true(animation.pending); +}, 'reports \'finished\' for a finished-pending animation'); + +test(t => { + const animation = createDiv(t).animate({}, 100 * MS_PER_SEC); + // Set up the pending playback rate + animation.updatePlaybackRate(-1); + // Call play again so that we seek to the end while remaining play-pending + animation.play(); + // For a pending animation, the play state should always report what the + // play state _will_ be once we finish pending. + assert_equals(animation.playState, 'running'); + assert_true(animation.pending); +}, 'reports the play state based on the pending playback rate'); + diff --git a/toolkit/components/places/tests/unit/test_origins.js b/toolkit/components/places/tests/unit/test_origins.js index 11dd977a880b..25a43341c461 100644 --- a/toolkit/components/places/tests/unit/test_origins.js +++ b/toolkit/components/places/tests/unit/test_origins.js @@ -1243,6 +1243,10 @@ function expectedOriginFrecency(urls) { * this element can be `undefined`. */ async function checkDB(expectedOrigins) { + // Frencencies for bookmarks are generated asynchronously but not within the + // await cycle for bookmarks.insert() etc, so wait for them to happen. + await PlacesTestUtils.promiseAsyncUpdates(); + let db = await PlacesUtils.promiseDBConnection(); let rows = await db.execute(` SELECT prefix, host, frecency diff --git a/toolkit/content/widgets/videocontrols.js b/toolkit/content/widgets/videocontrols.js index 5ffdfe04404f..d771d9a6d464 100644 --- a/toolkit/content/widgets/videocontrols.js +++ b/toolkit/content/widgets/videocontrols.js @@ -1773,11 +1773,20 @@ this.VideoControlsImplPageWidget = class { return new Proxy(element, this.reflowTriggeringCallValidator); }, - // Set the values to intrinsic dimensions before the first update. reflowedDimensions: { + // Set the dimensions to intrinsic