Browse Source

backports

Frank-Rainer Grahl 2 months ago
parent
commit
92c8aedf37

+ 93 - 0
mozilla-release/patches/1437360-68a1.patch

@@ -0,0 +1,93 @@
+# HG changeset patch
+# User Thomas Wisniewski <twisniewski@mozilla.com>
+# Date 1553096611 0
+# Node ID 6b9aee567032057ad7d598798362287297f85351
+# Parent  1ac6a585937779eb00a89289822286600c3e8d51
+Bug 1437360 - do not attempt to parse XHRs as XML if content-length=0, to prevent logging "no root element found" errors; r=smaug
+
+do not attempt to parse XHRs as XML if content-length=0, to prevent logging "no root element found" errors
+
+Differential Revision: https://phabricator.services.mozilla.com/D23444
+
+diff --git a/dom/base/test/chrome/bug884693.sjs b/dom/base/test/chrome/bug884693.sjs
+--- a/dom/base/test/chrome/bug884693.sjs
++++ b/dom/base/test/chrome/bug884693.sjs
+@@ -1,8 +1,9 @@
+ function handleRequest(request, response)
+ {
+-  let [status, statusText, body] = request.queryString.split("&");
++  let [status, statusText, encodedBody] = request.queryString.split("&");
++  let body = decodeURIComponent(encodedBody);
+   response.setStatusLine(request.httpVersion, status, statusText);
+   response.setHeader("Content-Type", "text/xml", false);
+   response.setHeader("Content-Length", "" + body.length, false);
+   response.write(body);
+ }
+diff --git a/dom/base/test/chrome/test_bug884693.xul b/dom/base/test/chrome/test_bug884693.xul
+--- a/dom/base/test/chrome/test_bug884693.xul
++++ b/dom/base/test/chrome/test_bug884693.xul
+@@ -14,16 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
+      target="_blank">Mozilla Bug 884693</a>
+   </body>
+ 
+   <!-- test code goes here -->
+   <script type="application/javascript"><![CDATA[
+ 
+     const SERVER_URL = "http://mochi.test:8888/tests/dom/base/test/chrome/bug884693.sjs";
+     const INVALID_XML = "InvalidXML";
++    const XML_WITHOUT_ROOT = "<?xml version='1.0'?>";
+ 
+     let consoleService = Cc["@mozilla.org/consoleservice;1"].
+                          getService(Ci.nsIConsoleService)
+ 
+     function runTest(status, statusText, body, expectedResponse, expectedMessages)
+     {
+       return new Promise((resolve, reject) => {
+         consoleService.reset();
+@@ -58,14 +59,15 @@ https://bugzilla.mozilla.org/show_bug.cg
+       then(() => { return runTest(202, "Accepted", "", "", []); }).
+       then(() => { return runTest(202, "Accepted", INVALID_XML, INVALID_XML, []); }).
+       then(() => { return runTest(204, "No Content", "", "", []); }).
+       then(() => { return runTest(204, "No Content", INVALID_XML, "", []); }).
+       then(() => { return runTest(205, "Reset Content", "", "", []); }).
+       then(() => { return runTest(205, "Reset Content", INVALID_XML, "", []); }).
+       then(() => { return runTest(304, "Not modified", "", "", []); }).
+       then(() => { return runTest(304, "Not modified", INVALID_XML, "", []); }).
+-      then(() => { return runTest(200, "OK", "", "", ["no root element found"]); }).
++      then(() => { return runTest(200, "OK", "", "", []); }).
++      then(() => { return runTest(200, "OK", XML_WITHOUT_ROOT, XML_WITHOUT_ROOT, ["no root element found"]); }).
+       then(() => { return runTest(200, "OK", INVALID_XML, INVALID_XML, ["syntax error"]); }).
+       then(SimpleTest.finish);
+ 
+   ]]></script>
+ </window>
+diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp
+--- a/dom/xhr/XMLHttpRequestMainThread.cpp
++++ b/dom/xhr/XMLHttpRequestMainThread.cpp
+@@ -1883,16 +1883,25 @@ XMLHttpRequestMainThread::OnStartRequest
+ 
+   // Set up responseXML
+   // Note: Main Fetch step 18 requires to ignore body for head/connect methods.
+   bool parseBody = (mResponseType == XMLHttpRequestResponseType::_empty ||
+                     mResponseType == XMLHttpRequestResponseType::Document) &&
+                    !(mRequestMethod.EqualsLiteral("HEAD") ||
+                      mRequestMethod.EqualsLiteral("CONNECT"));
+ 
++  if (parseBody) {
++    // Do not try to parse documents if content-length = 0
++    int64_t contentLength;
++    if (NS_SUCCEEDED(mChannel->GetContentLength(&contentLength)) &&
++        contentLength == 0) {
++      parseBody = false;
++    }
++  }
++
+   mIsHtml = false;
+   mWarnAboutSyncHtml = false;
+   if (parseBody && NS_SUCCEEDED(status)) {
+     // We can gain a huge performance win by not even trying to
+     // parse non-XML data. This also protects us from the situation
+     // where we have an XML document and sink, but HTML (or other)
+     // parser, which can produce unreliable results.
+     nsAutoCString type;
+

+ 161 - 0
mozilla-release/patches/TOP-1909714-NSS3904-11514.patch

@@ -0,0 +1,161 @@
+# HG changeset patch
+# User John Schanck <jschanck@mozilla.com>
+# Date 1721858565 0
+# Node ID bd4eca15906eafec82fbd13037012eaca985d8a0
+# Parent  ac053f4f561a993ccf839a39d00979ee2a627844
+Bug 1909714 - land NSS NSS_3_90_4_RTM UPGRADE_NSS_RELEASE, r=keeler a=dmeehan
+
+Differential Revision: https://phabricator.services.mozilla.com/D217594
+
+diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO
+--- a/security/nss/TAG-INFO
++++ b/security/nss/TAG-INFO
+@@ -1,1 +1,1 @@
+-NSS_3_90_3_RTM
+\ No newline at end of file
++NSS_3_90_4_RTM
+\ No newline at end of file
+diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep
+--- a/security/nss/coreconf/coreconf.dep
++++ b/security/nss/coreconf/coreconf.dep
+@@ -5,9 +5,8 @@
+ 
+ /*
+  * A dummy header file that is a dependency for all the object files.
+  * Used to force a full recompilation of NSS in Mozilla's Tinderbox
+  * depend builds.  See comments in rules.mk.
+  */
+ 
+ #error "Do not include this header file."
+-
+diff --git a/security/nss/doc/rst/releases/nss_3_90_4.rst b/security/nss/doc/rst/releases/nss_3_90_4.rst
+new file mode 100644
+--- /dev/null
++++ b/security/nss/doc/rst/releases/nss_3_90_4.rst
+@@ -0,0 +1,55 @@
++.. _mozilla_projects_nss_nss_3_90_4_release_notes:
++
++NSS 3.90.4 release notes
++========================
++
++`Introduction <#introduction>`__
++--------------------------------
++
++.. container::
++
++   Network Security Services (NSS) 3.90.4 was released on *24th July 2024**.
++
++
++`Distribution Information <#distribution_information>`__
++--------------------------------------------------------
++
++.. container::
++
++   The HG tag is NSS_3_90_4_RTM. NSS 3.90.4 requires NSPR 4.35 or newer.
++
++   NSS 3.90.4 source distributions are available on ftp.mozilla.org for secure HTTPS download:
++
++   -  Source tarballs:
++      https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_90_4_RTM/src/
++
++   Other releases are available :ref:`mozilla_projects_nss_releases`.
++
++.. _changes_in_nss_3.90.4:
++
++`Changes in NSS 3.90.4 <#changes_in_nss_3.90.4>`__
++--------------------------------------------------
++
++.. container::
++
++   - Bug 1905691 - ChaChaXor to return after the function
++
++`Compatibility <#compatibility>`__
++----------------------------------
++
++.. container::
++
++   NSS 3.90.4 shared libraries are backwards-compatible with all older NSS 3.x shared
++   libraries. A program linked with older NSS 3.x shared libraries will work with
++   this new version of the shared libraries without recompiling or
++   relinking. Furthermore, applications that restrict their use of NSS APIs to the
++   functions listed in NSS Public Functions will remain compatible with future
++   versions of the NSS shared libraries.
++
++`Feedback <#feedback>`__
++------------------------
++
++.. container::
++
++   Bugs discovered should be reported by filing a bug report on
++   `bugzilla.mozilla.org <https://bugzilla.mozilla.org/enter_bug.cgi?product=NSS>`__ (product NSS).
+diff --git a/security/nss/lib/freebl/chacha20poly1305.c b/security/nss/lib/freebl/chacha20poly1305.c
+--- a/security/nss/lib/freebl/chacha20poly1305.c
++++ b/security/nss/lib/freebl/chacha20poly1305.c
+@@ -205,33 +205,37 @@ ChaCha20Poly1305_DestroyContext(ChaCha20
+ void
+ ChaCha20Xor(uint8_t *output, uint8_t *block, uint32_t len, uint8_t *k,
+             uint8_t *nonce, uint32_t ctr)
+ {
+ #ifdef NSS_X64
+ #ifndef NSS_DISABLE_AVX2
+     if (avx2_support()) {
+         Hacl_Chacha20_Vec256_chacha20_encrypt_256(len, output, block, k, nonce, ctr);
++        return;
+     }
+ #endif
+ 
+ #ifndef NSS_DISABLE_SSE3
+     if (ssse3_support() && sse4_1_support() && avx_support()) {
+         Hacl_Chacha20_Vec128_chacha20_encrypt_128(len, output, block, k, nonce, ctr);
++        return;
+     }
+ #endif
+ 
+ #elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) && \
+     !defined(NSS_DISABLE_ALTIVEC) && !defined(NSS_DISABLE_CRYPTO_VSX)
+     if (ppc_crypto_support()) {
+         chacha20vsx(len, output, block, k, nonce, ctr);
+-    } else
++        return;
++    }
+ #endif
+     {
+         Hacl_Chacha20_chacha20_encrypt(len, output, block, k, nonce, ctr);
++        return;
+     }
+ }
+ #endif /* NSS_DISABLE_CHACHAPOLY */
+ 
+ SECStatus
+ ChaCha20_Xor(unsigned char *output, const unsigned char *block, unsigned int len,
+              const unsigned char *k, const unsigned char *nonce, PRUint32 ctr)
+ {
+@@ -441,26 +445,24 @@ ChaCha20Poly1305_Encrypt(const ChaCha20P
+ #ifndef NSS_DISABLE_SSE3
+     if (ssse3_support() && sse4_1_support() && avx_support()) {
+         Hacl_Chacha20Poly1305_128_aead_encrypt(
+             (uint8_t *)ctx->key, (uint8_t *)nonce, adLen, (uint8_t *)ad, inputLen,
+             (uint8_t *)input, output, outTag);
+         goto finish;
+     }
+ #endif
+-
+-    else
+ #elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) && \
+     !defined(NSS_DISABLE_ALTIVEC) && !defined(NSS_DISABLE_CRYPTO_VSX)
+     if (ppc_crypto_support()) {
+         Chacha20Poly1305_vsx_aead_encrypt(
+             (uint8_t *)ctx->key, (uint8_t *)nonce, adLen, (uint8_t *)ad, inputLen,
+             (uint8_t *)input, output, outTag);
+         goto finish;
+-    } else
++    }
+ #endif
+     {
+         Hacl_Chacha20Poly1305_32_aead_encrypt(
+             (uint8_t *)ctx->key, (uint8_t *)nonce, adLen, (uint8_t *)ad, inputLen,
+             (uint8_t *)input, output, outTag);
+         goto finish;
+     }
+ 
+

+ 1 - 1
mozilla-release/patches/TOP-1909743-nsstyle-prefers-color-scheme-25320.patch

@@ -3,7 +3,7 @@
 # Date 1721847757 18000
 # Date 1721847757 18000
 # Node ID 8af210a884c8c3c677dbd92defe767ad6a5b8fc4
 # Node ID 8af210a884c8c3c677dbd92defe767ad6a5b8fc4
 # Parent  781ba690d1c20d755331840f78c904d39362ef30
 # Parent  781ba690d1c20d755331840f78c904d39362ef30
-No Bug - Add support for CSS prefers-color-scheme media feature as a user preference.
+No Bug - Add support for CSS prefers-color-scheme media feature as a user preference. r=frg a=frg
 
 
 Based on an nsStyle port of Bug 1494034 to UXP by athenian200 <athenian200@outlook.com>
 Based on an nsStyle port of Bug 1494034 to UXP by athenian200 <athenian200@outlook.com>
 
 

+ 254 - 0
mozilla-release/patches/TOP-NOBUG-nsstyle-prefers-contrast.patch

@@ -0,0 +1,254 @@
+# HG changeset patch
+# User Matt A. Tobin <email@mattatobin.com>
+# Date 1722010988 18000
+# Node ID fbaa12c835063bf6bb02f78d6a447145bbf870de
+# Parent  8af210a884c8c3c677dbd92defe767ad6a5b8fc4
+No Bug - Add support for CSS prefers-contrast media feature as a user preference.
+
+diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h
+--- a/dom/base/nsGkAtomList.h
++++ b/dom/base/nsGkAtomList.h
+@@ -2262,16 +2262,17 @@ GK_ATOM(forcemessagemanager, "forcemessa
+ // Names for system metrics
+ GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
+ GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
+ GK_ATOM(scrollbar_end_backward, "scrollbar-end-backward")
+ GK_ATOM(scrollbar_end_forward, "scrollbar-end-forward")
+ GK_ATOM(scrollbar_thumb_proportional, "scrollbar-thumb-proportional")
+ GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
+ GK_ATOM(prefers_color_scheme, "prefers-color-scheme")
++GK_ATOM(prefers_contrast, "prefers-contrast")
+ GK_ATOM(windows_accent_color_in_titlebar, "windows-accent-color-in-titlebar")
+ GK_ATOM(windows_default_theme, "windows-default-theme")
+ GK_ATOM(mac_graphite_theme, "mac-graphite-theme")
+ GK_ATOM(mac_yosemite_theme, "mac-yosemite-theme")
+ GK_ATOM(windows_compositor, "windows-compositor")
+ GK_ATOM(windows_glass, "windows-glass")
+ GK_ATOM(touch_enabled, "touch-enabled")
+ GK_ATOM(menubar_drag, "menubar-drag")
+diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h
+--- a/layout/style/nsCSSKeywordList.h
++++ b/layout/style/nsCSSKeywordList.h
+@@ -219,16 +219,17 @@ CSS_KEY(contrast, contrast)
+ CSS_KEY(copy, copy)
+ CSS_KEY(contextual, contextual)
+ CSS_KEY(cover, cover)
+ CSS_KEY(crop, crop)
+ CSS_KEY(cross, cross)
+ CSS_KEY(crosshair, crosshair)
+ CSS_KEY(currentcolor, currentcolor)
+ CSS_KEY(cursive, cursive)
++CSS_KEY(custom, custom)
+ CSS_KEY(cyclic, cyclic)
+ CSS_KEY(dark, dark)
+ CSS_KEY(darken, darken)
+ CSS_KEY(dashed, dashed)
+ CSS_KEY(dense, dense)
+ CSS_KEY(decimal, decimal)
+ CSS_KEY(default, default)
+ CSS_KEY(deg, deg)
+@@ -356,16 +357,17 @@ CSS_KEY(khz, khz)
+ CSS_KEY(landscape, landscape)
+ CSS_KEY(large, large)
+ CSS_KEY(larger, larger)
+ CSS_KEY(last, last)
+ CSS_KEY(last baseline, last_baseline) // only used for DevTools auto-completion
+ CSS_KEY(layout, layout)
+ CSS_KEY(left, left)
+ CSS_KEY(legacy, legacy)
++CSS_KEY(less, less)
+ CSS_KEY(light, light)
+ CSS_KEY(lighten, lighten)
+ CSS_KEY(lighter, lighter)
+ CSS_KEY(line-through, line_through)
+ CSS_KEY(linear, linear)
+ CSS_KEY(lining-nums, lining_nums)
+ CSS_KEY(list-item, list_item)
+ CSS_KEY(local, local)
+@@ -393,16 +395,17 @@ CSS_KEY(menutext, menutext)
+ CSS_KEY(message-box, message_box)
+ CSS_KEY(middle, middle)
+ CSS_KEY(min-content, min_content)
+ CSS_KEY(minmax, minmax)
+ CSS_KEY(mix, mix)
+ CSS_KEY(mixed, mixed)
+ CSS_KEY(mm, mm)
+ CSS_KEY(monospace, monospace)
++CSS_KEY(more, more)
+ CSS_KEY(move, move)
+ CSS_KEY(ms, ms)
+ CSS_KEY(multiply, multiply)
+ CSS_KEY(n-resize, n_resize)
+ CSS_KEY(narrower, narrower)
+ CSS_KEY(ne-resize, ne_resize)
+ CSS_KEY(nesw-resize, nesw_resize)
+ CSS_KEY(no-clip, no_clip)
+@@ -410,16 +413,17 @@ CSS_KEY(no-close-quote, no_close_quote)
+ CSS_KEY(no-common-ligatures, no_common_ligatures)
+ CSS_KEY(no-contextual, no_contextual)
+ CSS_KEY(no-discretionary-ligatures, no_discretionary_ligatures)
+ CSS_KEY(no-drag, no_drag)
+ CSS_KEY(no-drop, no_drop)
+ CSS_KEY(no-historical-ligatures, no_historical_ligatures)
+ CSS_KEY(no-open-quote, no_open_quote)
+ CSS_KEY(no-repeat, no_repeat)
++CSS_KEY(no-preference, no_preference)
+ CSS_KEY(none, none)
+ CSS_KEY(normal, normal)
+ CSS_KEY(not-allowed, not_allowed)
+ CSS_KEY(nowrap, nowrap)
+ CSS_KEY(numeric, numeric)
+ CSS_KEY(ns-resize, ns_resize)
+ CSS_KEY(nw-resize, nw_resize)
+ CSS_KEY(nwse-resize, nwse_resize)
+diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
+--- a/layout/style/nsMediaFeatures.cpp
++++ b/layout/style/nsMediaFeatures.cpp
+@@ -51,16 +51,24 @@ static const nsCSSProps::KTableEntry kDi
+ };
+ 
+ static const nsCSSProps::KTableEntry kPrefersColorSchemeKeywords[] = {
+   { eCSSKeyword_light,                  NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT },
+   { eCSSKeyword_dark,                   NS_STYLE_PREFERS_COLOR_SCHEME_DARK },
+   { eCSSKeyword_UNKNOWN,                -1 },
+ };
+ 
++static const nsCSSProps::KTableEntry kPrefersContrastKeywords[] = {
++  { eCSSKeyword_no_preference,          NS_STYLE_PREFERS_CONTRAST_NO_PREFERENCE },
++  { eCSSKeyword_less,                   NS_STYLE_PREFERS_CONTRAST_LESS },
++  { eCSSKeyword_more,                   NS_STYLE_PREFERS_CONTRAST_MORE },
++  { eCSSKeyword_custom,                 NS_STYLE_PREFERS_CONTRAST_CUSTOM },
++  { eCSSKeyword_UNKNOWN,                -1 },
++};
++
+ #ifdef XP_WIN
+ struct WindowsThemeName {
+   LookAndFeel::WindowsTheme id;
+   const wchar_t* name;
+ };
+ 
+ // Windows theme identities used in the -moz-windows-theme media query.
+ const WindowsThemeName themeStrings[] = {
+@@ -526,16 +534,48 @@ GetPrefersColorScheme(nsIDocument* aDocu
+                           eCSSUnit_Enumerated);
+       break;
+     default:
+       aResult.Reset();
+   }
+ }
+ 
+ static void
++GetPrefersContrast(nsIDocument* aDocument, const nsMediaFeature* aFeature,
++                   nsCSSValue& aResult)
++{
++  if (Preferences::GetInt("browser.display.document_color_use", 0) == 2 ||
++      LookAndFeel::GetInt(LookAndFeel::eIntID_UseAccessibilityTheme, 0)) {
++    aResult.SetIntValue(NS_STYLE_PREFERS_CONTRAST_CUSTOM, eCSSUnit_Enumerated);
++  }
++  else {
++    switch(Preferences::GetInt("browser.display.prefers_contrast", 0)) {
++      case 0:
++        aResult.SetIntValue(NS_STYLE_PREFERS_CONTRAST_NO_PREFERENCE,
++                            eCSSUnit_Enumerated);
++        break;
++      case 1:
++        aResult.SetIntValue(NS_STYLE_PREFERS_CONTRAST_LESS,
++                            eCSSUnit_Enumerated);
++        break;
++      case 2:
++        aResult.SetIntValue(NS_STYLE_PREFERS_CONTRAST_MORE,
++                            eCSSUnit_Enumerated);
++        break;
++      case 3:
++        aResult.SetIntValue(NS_STYLE_PREFERS_CONTRAST_CUSTOM,
++                            eCSSUnit_Enumerated);
++        break;
++      default:
++        aResult.Reset();
++    }
++  }
++}
++
++static void
+ GetIsGlyph(nsIDocument* aDocument, const nsMediaFeature* aFeature,
+            nsCSSValue& aResult)
+ {
+   MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
+   aResult.SetIntValue(aDocument->IsSVGGlyphsDocument() ? 1 : 0, eCSSUnit_Integer);
+ }
+ 
+ /*
+@@ -633,16 +673,24 @@ nsMediaFeatures::features[] = {
+     &nsGkAtoms::prefers_color_scheme,
+     nsMediaFeature::eMinMaxNotAllowed,
+     nsMediaFeature::eEnumerated,
+     nsMediaFeature::eNoRequirements,
+     { kPrefersColorSchemeKeywords },
+     GetPrefersColorScheme
+   },
+   {
++    &nsGkAtoms::prefers_contrast,
++    nsMediaFeature::eMinMaxNotAllowed,
++    nsMediaFeature::eEnumerated,
++    nsMediaFeature::eNoRequirements,
++    { kPrefersContrastKeywords },
++    GetPrefersContrast
++  },
++  {
+     &nsGkAtoms::resolution,
+     nsMediaFeature::eMinMaxAllowed,
+     nsMediaFeature::eResolution,
+     nsMediaFeature::eNoRequirements,
+     { nullptr },
+     GetResolution
+   },
+   {
+diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h
+--- a/layout/style/nsStyleConsts.h
++++ b/layout/style/nsStyleConsts.h
+@@ -1220,11 +1220,17 @@ enum class StyleOverscrollBehavior : uin
+ #define NS_STYLE_DISPLAY_MODE_MINIMAL_UI        1
+ #define NS_STYLE_DISPLAY_MODE_STANDALONE        2
+ #define NS_STYLE_DISPLAY_MODE_FULLSCREEN        3
+ 
+ // prefers-color-scheme
+ #define NS_STYLE_PREFERS_COLOR_SCHEME_LIGHT     0
+ #define NS_STYLE_PREFERS_COLOR_SCHEME_DARK      1
+ 
++// prefers-contrast
++#define NS_STYLE_PREFERS_CONTRAST_NO_PREFERENCE 0
++#define NS_STYLE_PREFERS_CONTRAST_LESS          1
++#define NS_STYLE_PREFERS_CONTRAST_MORE          2
++#define NS_STYLE_PREFERS_CONTRAST_CUSTOM        3
++
+ } // namespace mozilla
+ 
+ #endif /* nsStyleConsts_h___ */
+diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
+--- a/modules/libpref/init/all.js
++++ b/modules/libpref/init/all.js
+@@ -402,16 +402,24 @@ pref("browser.display.use_document_fonts
+ // 0 = default: always, except in high contrast mode
+ // 1 = always
+ // 2 = never
+ pref("browser.display.document_color_use", 0);
+ // 0 = feature disabled
+ // 1 = default: light theme preferred
+ // 2 = dark theme preferred
+ pref("browser.display.prefers_color_scheme", 1);
++// 0 = default: no-preference
++// 1 = less
++// 2 = more
++// 3 = custom;
++// NOTE: If browser.display.document_color_use is 2 or
++// LookAndFeel::eIntID_UseAccessibilityTheme evaluates to true 'custom' will return
++// unconditionally.
++pref("browser.display.prefers_contrast", 0);
+ pref("browser.display.use_system_colors",   false);
+ pref("browser.display.foreground_color",    "#000000");
+ pref("browser.display.background_color",    "#FFFFFF");
+ pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
+ // 0 = no external leading,
+ // 1 = use external leading only when font provides,
+ // 2 = add extra leading both internal leading and external leading are zero
+ pref("browser.display.normal_lineheight_calc_control", 2);

+ 173 - 0
mozilla-release/patches/TOP-NOBUG-nsstyle-prefers-reduced-motion.patch

@@ -0,0 +1,173 @@
+# HG changeset patch
+# User Matt A. Tobin <email@mattatobin.com>
+# Date 1722040388 18000
+# Node ID 7b6db858e3d2729fc17560e9b82393a3430160be
+# Parent  fbaa12c835063bf6bb02f78d6a447145bbf870de
+No Bug - Add support for CSS prefers-reduced-motion media feature as a user preference. r=frg a=frg
+
+diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h
+--- a/dom/base/nsGkAtomList.h
++++ b/dom/base/nsGkAtomList.h
+@@ -2263,16 +2263,17 @@ GK_ATOM(forcemessagemanager, "forcemessa
+ GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
+ GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
+ GK_ATOM(scrollbar_end_backward, "scrollbar-end-backward")
+ GK_ATOM(scrollbar_end_forward, "scrollbar-end-forward")
+ GK_ATOM(scrollbar_thumb_proportional, "scrollbar-thumb-proportional")
+ GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
+ GK_ATOM(prefers_color_scheme, "prefers-color-scheme")
+ GK_ATOM(prefers_contrast, "prefers-contrast")
++GK_ATOM(prefers_reduced_motion, "prefers-reduced-motion")
+ GK_ATOM(windows_accent_color_in_titlebar, "windows-accent-color-in-titlebar")
+ GK_ATOM(windows_default_theme, "windows-default-theme")
+ GK_ATOM(mac_graphite_theme, "mac-graphite-theme")
+ GK_ATOM(mac_yosemite_theme, "mac-yosemite-theme")
+ GK_ATOM(windows_compositor, "windows-compositor")
+ GK_ATOM(windows_glass, "windows-glass")
+ GK_ATOM(touch_enabled, "touch-enabled")
+ GK_ATOM(menubar_drag, "menubar-drag")
+diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h
+--- a/layout/style/nsCSSKeywordList.h
++++ b/layout/style/nsCSSKeywordList.h
+@@ -463,16 +463,17 @@ CSS_KEY(progressive, progressive)
+ CSS_KEY(proportional-nums, proportional_nums)
+ CSS_KEY(proportional-width, proportional_width)
+ CSS_KEY(proximity, proximity)
+ CSS_KEY(pt, pt)
+ CSS_KEY(px, px)
+ CSS_KEY(rad, rad)
+ CSS_KEY(read-only, read_only)
+ CSS_KEY(read-write, read_write)
++CSS_KEY(reduce, reduce)
+ CSS_KEY(relative, relative)
+ CSS_KEY(repeat, repeat)
+ CSS_KEY(repeat-x, repeat_x)
+ CSS_KEY(repeat-y, repeat_y)
+ CSS_KEY(reverse, reverse)
+ CSS_KEY(ridge, ridge)
+ CSS_KEY(right, right)
+ CSS_KEY(rl, rl)
+diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
+--- a/layout/style/nsMediaFeatures.cpp
++++ b/layout/style/nsMediaFeatures.cpp
+@@ -59,16 +59,22 @@ static const nsCSSProps::KTableEntry kPr
+ static const nsCSSProps::KTableEntry kPrefersContrastKeywords[] = {
+   { eCSSKeyword_no_preference,          NS_STYLE_PREFERS_CONTRAST_NO_PREFERENCE },
+   { eCSSKeyword_less,                   NS_STYLE_PREFERS_CONTRAST_LESS },
+   { eCSSKeyword_more,                   NS_STYLE_PREFERS_CONTRAST_MORE },
+   { eCSSKeyword_custom,                 NS_STYLE_PREFERS_CONTRAST_CUSTOM },
+   { eCSSKeyword_UNKNOWN,                -1 },
+ };
+ 
++static const nsCSSProps::KTableEntry kPrefersReducedMotionKeywords[] = {
++  { eCSSKeyword_no_preference,          NS_STYLE_PREFERS_REDUCED_MOTION_NO_PREFERENCE },
++  { eCSSKeyword_reduce,                 NS_STYLE_PREFERS_REDUCED_MOTION_REDUCE },
++  { eCSSKeyword_UNKNOWN,                -1 },
++};
++
+ #ifdef XP_WIN
+ struct WindowsThemeName {
+   LookAndFeel::WindowsTheme id;
+   const wchar_t* name;
+ };
+ 
+ // Windows theme identities used in the -moz-windows-theme media query.
+ const WindowsThemeName themeStrings[] = {
+@@ -566,16 +572,30 @@ GetPrefersContrast(nsIDocument* aDocumen
+         break;
+       default:
+         aResult.Reset();
+     }
+   }
+ }
+ 
+ static void
++GetPrefersReducedMotion(nsIDocument* aDocument, const nsMediaFeature* aFeature,
++                        nsCSSValue& aResult)
++{
++  if (Preferences::GetInt("browser.display.prefers_reduced_motion", 0) == 1) {
++      aResult.SetIntValue(NS_STYLE_PREFERS_REDUCED_MOTION_REDUCE,
++                          eCSSUnit_Enumerated);
++  }
++  else {
++      aResult.SetIntValue(NS_STYLE_PREFERS_REDUCED_MOTION_NO_PREFERENCE,
++                          eCSSUnit_Enumerated);
++  }
++}
++
++static void
+ GetIsGlyph(nsIDocument* aDocument, const nsMediaFeature* aFeature,
+            nsCSSValue& aResult)
+ {
+   MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
+   aResult.SetIntValue(aDocument->IsSVGGlyphsDocument() ? 1 : 0, eCSSUnit_Integer);
+ }
+ 
+ /*
+@@ -681,16 +701,24 @@ nsMediaFeatures::features[] = {
+     &nsGkAtoms::prefers_contrast,
+     nsMediaFeature::eMinMaxNotAllowed,
+     nsMediaFeature::eEnumerated,
+     nsMediaFeature::eNoRequirements,
+     { kPrefersContrastKeywords },
+     GetPrefersContrast
+   },
+   {
++    &nsGkAtoms::prefers_reduced_motion,
++    nsMediaFeature::eMinMaxNotAllowed,
++    nsMediaFeature::eEnumerated,
++    nsMediaFeature::eNoRequirements,
++    { kPrefersReducedMotionKeywords },
++    GetPrefersReducedMotion
++  },
++  {
+     &nsGkAtoms::resolution,
+     nsMediaFeature::eMinMaxAllowed,
+     nsMediaFeature::eResolution,
+     nsMediaFeature::eNoRequirements,
+     { nullptr },
+     GetResolution
+   },
+   {
+diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h
+--- a/layout/style/nsStyleConsts.h
++++ b/layout/style/nsStyleConsts.h
+@@ -1226,11 +1226,15 @@ enum class StyleOverscrollBehavior : uin
+ #define NS_STYLE_PREFERS_COLOR_SCHEME_DARK      1
+ 
+ // prefers-contrast
+ #define NS_STYLE_PREFERS_CONTRAST_NO_PREFERENCE 0
+ #define NS_STYLE_PREFERS_CONTRAST_LESS          1
+ #define NS_STYLE_PREFERS_CONTRAST_MORE          2
+ #define NS_STYLE_PREFERS_CONTRAST_CUSTOM        3
+ 
++// prefers-reduced-motion
++#define NS_STYLE_PREFERS_REDUCED_MOTION_NO_PREFERENCE   0
++#define NS_STYLE_PREFERS_REDUCED_MOTION_REDUCE          1
++
+ } // namespace mozilla
+ 
+ #endif /* nsStyleConsts_h___ */
+diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
+--- a/modules/libpref/init/all.js
++++ b/modules/libpref/init/all.js
+@@ -410,16 +410,19 @@ pref("browser.display.prefers_color_sche
+ // 0 = default: no-preference
+ // 1 = less
+ // 2 = more
+ // 3 = custom;
+ // NOTE: If browser.display.document_color_use is 2 or
+ // LookAndFeel::eIntID_UseAccessibilityTheme evaluates to true 'custom' will return
+ // unconditionally.
+ pref("browser.display.prefers_contrast", 0);
++// 0 = default; no-preference
++// 1 = reduce
++pref("browser.display.prefers_reduced_motion", 0);
+ pref("browser.display.use_system_colors",   false);
+ pref("browser.display.foreground_color",    "#000000");
+ pref("browser.display.background_color",    "#FFFFFF");
+ pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
+ // 0 = no external leading,
+ // 1 = use external leading only when font provides,
+ // 2 = add extra leading both internal leading and external leading are zero
+ pref("browser.display.normal_lineheight_calc_control", 2);

+ 4 - 0
mozilla-release/patches/series

@@ -7194,3 +7194,7 @@ TOP-NOBUG-fixups-25320.patch
 1699950-2-88a1.patch
 1699950-2-88a1.patch
 1699950-3-88a1.patch
 1699950-3-88a1.patch
 TOP-1909743-nsstyle-prefers-color-scheme-25320.patch
 TOP-1909743-nsstyle-prefers-color-scheme-25320.patch
+1437360-68a1.patch
+TOP-NOBUG-nsstyle-prefers-contrast.patch
+TOP-NOBUG-nsstyle-prefers-reduced-motion.patch
+TOP-1909714-NSS3904-11514.patch