From deea17a98ebab424d115083a0e331ae2939e57ac Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Sun, 9 Jun 2019 22:00:41 +0000 Subject: [PATCH] Bug 1557793 part 1. Fix incorrect template arguments in AnimationPerformanceWarning. r=birtles It looks like bug 1321412 changed the number of params but didn't update the template parameter, and then bug 1364221 followed its example of not matching the template parameter to the actual number of params. As a result we're passing an array with one garbage pointer to the callee, and it just happens that the callee doesn't examine that pointer. But that's about to change. Differential Revision: https://phabricator.services.mozilla.com/D34234 --HG-- extra : moz-landing-system : lando --- dom/animation/AnimationPerformanceWarning.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/animation/AnimationPerformanceWarning.cpp b/dom/animation/AnimationPerformanceWarning.cpp index f0e0fb0ae40a..5efad3758012 100644 --- a/dom/animation/AnimationPerformanceWarning.cpp +++ b/dom/animation/AnimationPerformanceWarning.cpp @@ -16,6 +16,7 @@ nsresult AnimationPerformanceWarning::ToLocalizedStringWithIntParams( nsAutoString strings[N]; const char16_t* charParams[N]; + MOZ_DIAGNOSTIC_ASSERT(mParams->Length() == N); for (size_t i = 0, n = mParams->Length(); i < n; i++) { strings[i].AppendInt((*mParams)[i]); charParams[i] = strings[i].get(); @@ -34,13 +35,13 @@ bool AnimationPerformanceWarning::ToLocalizedString( MOZ_ASSERT(mParams && mParams->Length() == 6, "Parameter's length should be 6 for ContentTooLarge2"); - return NS_SUCCEEDED(ToLocalizedStringWithIntParams<7>( + return NS_SUCCEEDED(ToLocalizedStringWithIntParams<6>( "CompositorAnimationWarningContentTooLarge2", aLocalizedString)); case Type::ContentTooLargeArea: MOZ_ASSERT(mParams && mParams->Length() == 2, "Parameter's length should be 2 for ContentTooLargeArea"); - return NS_SUCCEEDED(ToLocalizedStringWithIntParams<3>( + return NS_SUCCEEDED(ToLocalizedStringWithIntParams<2>( "CompositorAnimationWarningContentTooLargeArea", aLocalizedString)); case Type::TransformBackfaceVisibilityHidden: key = "CompositorAnimationWarningTransformBackfaceVisibilityHidden";