diff --git a/dom/chrome-webidl/PrioEncoder.webidl b/dom/chrome-webidl/PrioEncoder.webidl index 58ff5a21157f..1dd00920cc9c 100644 --- a/dom/chrome-webidl/PrioEncoder.webidl +++ b/dom/chrome-webidl/PrioEncoder.webidl @@ -11,9 +11,7 @@ namespace PrioEncoder { }; dictionary PrioParams { - required boolean browserIsUserDefault; - required boolean newTabPageEnabled; - required boolean pdfViewerUsed; + required sequence booleans; }; dictionary PrioEncodedData { diff --git a/dom/prio/PrioEncoder.cpp b/dom/prio/PrioEncoder.cpp index a700628d4a8c..bd4038b70ac2 100644 --- a/dom/prio/PrioEncoder.cpp +++ b/dom/prio/PrioEncoder.cpp @@ -105,13 +105,9 @@ PrioEncoder::Encode(GlobalObject& aGlobal, ClearOnShutdown(&sSingleton); } - bool dataItems[] = { - aPrioParams.mBrowserIsUserDefault, - aPrioParams.mNewTabPageEnabled, - aPrioParams.mPdfViewerUsed, - }; + nsTArray dataItems = aPrioParams.mBooleans; - PrioConfig prioConfig = PrioConfig_new(mozilla::ArrayLength(dataItems), + PrioConfig prioConfig = PrioConfig_new(dataItems.Length(), sPublicKeyA, sPublicKeyB, reinterpret_cast(aBatchID.BeginReading()), @@ -132,7 +128,7 @@ PrioEncoder::Encode(GlobalObject& aGlobal, unsigned int lenB = 0; prio_rv = PrioClient_encode(prioConfig, - dataItems, + dataItems.Elements(), &forServerA, &lenA, &forServerB, diff --git a/dom/prio/test/gtest/TestPrioEncoder.cpp b/dom/prio/test/gtest/TestPrioEncoder.cpp index d174afac2cc0..304a03da5e4c 100644 --- a/dom/prio/test/gtest/TestPrioEncoder.cpp +++ b/dom/prio/test/gtest/TestPrioEncoder.cpp @@ -28,10 +28,6 @@ TEST(PrioEncoder, BadPublicKeys) nsCString batchID = NS_LITERAL_CSTRING("abc123"); mozilla::dom::PrioParams prioParams; - prioParams.mBrowserIsUserDefault = true; - prioParams.mNewTabPageEnabled = true; - prioParams.mPdfViewerUsed = false; - mozilla::dom::RootedDictionary prioEncodedData(cx); mozilla::ErrorResult rv; @@ -172,9 +168,11 @@ TEST(PrioEncoder, VerifyFull) batchID = (char*)(batchIDStr); mozilla::dom::PrioParams prioParams; - prioParams.mBrowserIsUserDefault = dataItems[0]; - prioParams.mNewTabPageEnabled = dataItems[1]; - prioParams.mPdfViewerUsed = dataItems[2]; + FallibleTArray sequence; + *(sequence.AppendElement(mozilla::fallible)) = dataItems[0]; + *(sequence.AppendElement(mozilla::fallible)) = dataItems[1]; + *(sequence.AppendElement(mozilla::fallible)) = dataItems[2]; + prioParams.mBooleans.Assign(sequence); mozilla::dom::RootedDictionary prioEncodedData(cx); mozilla::ErrorResult rv;