Backed out changeset 79c1392f7c43 (bug 1701691) for failures on browser_toolbar_prefers_color_scheme.js. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Thu, 15 Apr 2021 22:18:09 +0300
changeset 576273 48a99646f183abc34e8eeb695fcede5bcc9463d1
parent 576272 738fa8ffae10a03b7d9312ca7931feef888f66ba
child 576274 4a26cd17142ad15ff97a99609ef822513d272c3e
push id141201
push userncsoregi@mozilla.com
push dateThu, 15 Apr 2021 19:20:30 +0000
treeherderautoland@48a99646f183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1701691
milestone89.0a1
backs out79c1392f7c4303028fce92d68d399af21bd75a27
first release with
nightly linux32
48a99646f183 / 89.0a1 / 20210415214643 / files
nightly linux64
48a99646f183 / 89.0a1 / 20210415214643 / files
nightly mac
48a99646f183 / 89.0a1 / 20210415214643 / files
nightly win32
48a99646f183 / 89.0a1 / 20210415214643 / files
nightly win64
48a99646f183 / 89.0a1 / 20210415214643 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 79c1392f7c43 (bug 1701691) for failures on browser_toolbar_prefers_color_scheme.js. CLOSED TREE
browser/components/extensions/test/browser/browser.ini
browser/components/extensions/test/browser/browser_toolbar_prefers_color_scheme.js
browser/modules/ThemeVariableMap.jsm
layout/style/test/chrome/chrome-only-media-queries.js
modules/libpref/init/StaticPrefList.yaml
servo/components/style/gecko/media_features.rs
toolkit/modules/LightweightThemeConsumer.jsm
widget/nsXPLookAndFeel.cpp
xpcom/ds/StaticAtoms.py
--- a/browser/components/extensions/test/browser/browser.ini
+++ b/browser/components/extensions/test/browser/browser.ini
@@ -306,9 +306,8 @@ tags = fullscreen
 [browser_ext_windows_size.js]
 skip-if = os == 'mac' || (debug && os == "linux" && os_version == "18.04") # Fails when windows are randomly opened in fullscreen mode, Bug 1638027
 [browser_ext_windows_update.js]
 skip-if = (verify && (os == 'mac')) || (os == 'linux' && bits == 64 && os_version == '18.04')  # Bug 1533982 for linux1804
 tags = fullscreen
 [browser_ext_contentscript_animate.js]
 [browser_ext_contentscript_cross_docGroup_adoption.js]
 [browser_ext_contentscript_cross_docGroup_adoption_xhr.js]
-[browser_toolbar_prefers_color_scheme.js]
deleted file mode 100644
--- a/browser/components/extensions/test/browser/browser_toolbar_prefers_color_scheme.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-add_task(async function testThemeDeterminesToolbarQuery() {
-  let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
-  let darkToolbarQuery = window.matchMedia(
-    "(-moz-toolbar-prefers-color-scheme: dark)"
-  );
-
-  let initialDarkModeMatches = darkModeQuery.matches;
-
-  let darkExtension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      theme: {
-        colors: {
-          toolbar: "rgba(12, 12, 12, 1)",
-        },
-      },
-    },
-  });
-  let lightExtension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      theme: {
-        colors: {
-          toolbar: "rgba(255, 255, 255, 1)",
-        },
-      },
-    },
-  });
-
-  await Promise.all([
-    TestUtils.topicObserved("lightweight-theme-styling-update"),
-    darkExtension.startup(),
-  ]);
-
-  is(darkModeQuery.matches, initialDarkModeMatches, "OS dark mode unchanged");
-  ok(darkToolbarQuery.matches, "toolbar query is dark mode");
-
-  await Promise.all([
-    TestUtils.topicObserved("lightweight-theme-styling-update"),
-    lightExtension.startup(),
-  ]);
-
-  is(darkModeQuery.matches, initialDarkModeMatches, "OS dark mode unchanged");
-  ok(!darkToolbarQuery.matches, "toolbar query is light mode");
-
-  await lightExtension.unload();
-  await darkExtension.unload();
-});
--- a/browser/modules/ThemeVariableMap.jsm
+++ b/browser/modules/ThemeVariableMap.jsm
@@ -1,16 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var EXPORTED_SYMBOLS = ["ThemeVariableMap", "ThemeContentPropertyList"];
 
-const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
 const ThemeVariableMap = [
   [
     "--lwt-accent-color-inactive",
     {
       lwtProperty: "accentcolorInactive",
     },
   ],
   [
@@ -52,32 +50,16 @@ const ThemeVariableMap = [
     {
       lwtProperty: "tab_background_separator",
     },
   ],
   [
     "--toolbar-bgcolor",
     {
       lwtProperty: "toolbarColor",
-      processColor(rgbaChannels, element) {
-        if (!rgbaChannels) {
-          Services.prefs.setBoolPref(
-            "browser.theme.dark-toolbar-theme",
-            element.ownerGlobal.matchMedia("(prefers-color-scheme: dark)")
-              .matches
-          );
-          return null;
-        }
-        const { r, g, b, a } = rgbaChannels;
-        Services.prefs.setBoolPref(
-          "browser.theme.dark-toolbar-theme",
-          _isColorDark(r, g, b)
-        );
-        return `rgba(${r}, ${g}, ${b}, ${a})`;
-      },
     },
   ],
   [
     "--toolbar-color",
     {
       lwtProperty: "toolbar_text",
     },
   ],
@@ -196,13 +178,8 @@ const ThemeVariableMap = [
 const ThemeContentPropertyList = [
   "ntp_background",
   "ntp_text",
   "sidebar",
   "sidebar_highlight",
   "sidebar_highlight_text",
   "sidebar_text",
 ];
-
-// This is copied from LightweightThemeConsumer.jsm.
-function _isColorDark(r, g, b) {
-  return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 110;
-}
--- a/layout/style/test/chrome/chrome-only-media-queries.js
+++ b/layout/style/test/chrome/chrome-only-media-queries.js
@@ -34,11 +34,9 @@ const CHROME_ONLY_TOGGLES = [
 ];
 
 // Non-parseable queries can be tested directly in
 // `test_chrome_only_media_queries.html`.
 const CHROME_ONLY_QUERIES = [
   "(-moz-os-version: windows-win7)",
   "(-moz-os-version: windows-win8)",
   "(-moz-os-version: windows-win10)",
-  "(-moz-toolbar-prefers-color-scheme: dark)",
-  "(-moz-toolbar-prefers-color-scheme: light)",
 ];
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -1139,24 +1139,16 @@
   mirror: always
 
 # Force usage of in-memory (rather than file on disk) media cache for video streaming when private browsing
 - name: browser.privatebrowsing.forceMediaMemoryCache
   type: bool
   value: false
   mirror: always
 
-# Whether the toolbar is dark/light/auto.
-# Controls @media -moz-toolbar-prefers-color-scheme.
-- name: browser.theme.dark-toolbar-theme
-  type: RelaxedAtomicBool
-  value: false
-  mirror: always
-  rust: true
-
 # Enable Proton restyle. Requires restart.
 - name: browser.proton.enabled
   type: RelaxedAtomicBool
   value: true
   mirror: always
   rust: true
 
 - name: browser.proton.contextmenus.enabled
--- a/servo/components/style/gecko/media_features.rs
+++ b/servo/components/style/gecko/media_features.rs
@@ -401,31 +401,16 @@ fn eval_prefers_color_scheme(device: &De
     let prefers_color_scheme =
         unsafe { bindings::Gecko_MediaFeatures_PrefersColorScheme(device.document()) };
     match query_value {
         Some(v) => prefers_color_scheme == v,
         None => true,
     }
 }
 
-/// The color-scheme of the toolbar in the current Firefox theme. This is based
-/// on a pref managed by the front-end.
-fn eval_toolbar_prefers_color_scheme(_: &Device, query_value: Option<PrefersColorScheme>) -> bool {
-    let prefers_color_scheme = if static_prefs::pref!("browser.theme.dark-toolbar-theme") {
-        PrefersColorScheme::Dark
-    } else {
-        PrefersColorScheme::Light
-    };
-
-    match query_value {
-        Some(v) => prefers_color_scheme == v,
-        None => true,
-    }
-}
-
 bitflags! {
     /// https://drafts.csswg.org/mediaqueries-4/#mf-interaction
     struct PointerCapabilities: u8 {
         const COARSE = structs::PointerCapabilities_Coarse;
         const FINE = structs::PointerCapabilities_Fine;
         const HOVER = structs::PointerCapabilities_Hover;
     }
 }
@@ -634,17 +619,17 @@ macro_rules! bool_pref_feature {
     }};
 }
 
 /// Adding new media features requires (1) adding the new feature to this
 /// array, with appropriate entries (and potentially any new code needed
 /// to support new types in these entries and (2) ensuring that either
 /// nsPresContext::MediaFeatureValuesChanged is called when the value that
 /// would be returned by the evaluator function could change.
-pub static MEDIA_FEATURES: [MediaFeatureDescription; 62] = [
+pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [
     feature!(
         atom!("width"),
         AllowsRanges::Yes,
         Evaluator::Length(eval_width),
         ParsingRequirements::empty(),
     ),
     feature!(
         atom!("height"),
@@ -844,22 +829,16 @@ pub static MEDIA_FEATURES: [MediaFeature
         ParsingRequirements::CHROME_AND_UA_ONLY,
     ),
     feature!(
         atom!("-moz-non-native-content-theme"),
         AllowsRanges::No,
         Evaluator::BoolInteger(eval_moz_non_native_content_theme),
         ParsingRequirements::CHROME_AND_UA_ONLY,
     ),
-    feature!(
-        atom!("-moz-toolbar-prefers-color-scheme"),
-        AllowsRanges::No,
-        keyword_evaluator!(eval_toolbar_prefers_color_scheme, PrefersColorScheme),
-        ParsingRequirements::CHROME_AND_UA_ONLY,
-    ),
 
     lnf_int_feature!(atom!("-moz-scrollbar-start-backward"), ScrollArrowStyle, get_scrollbar_start_backward),
     lnf_int_feature!(atom!("-moz-scrollbar-start-forward"), ScrollArrowStyle, get_scrollbar_start_forward),
     lnf_int_feature!(atom!("-moz-scrollbar-end-backward"), ScrollArrowStyle, get_scrollbar_end_backward),
     lnf_int_feature!(atom!("-moz-scrollbar-end-forward"), ScrollArrowStyle, get_scrollbar_end_forward),
     lnf_int_feature!(atom!("-moz-scrollbar-thumb-proportional"), ScrollSliderStyle),
     lnf_int_feature!(atom!("-moz-overlay-scrollbars"), UseOverlayScrollbars),
     lnf_int_feature!(atom!("-moz-menubar-drag"), MenuBarDrag),
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -473,12 +473,11 @@ function _rgbaToString(parsedColor) {
   }
   let { r, g, b, a } = parsedColor;
   if (a == 1) {
     return `rgb(${r}, ${g}, ${b})`;
   }
   return `rgba(${r}, ${g}, ${b}, ${a})`;
 }
 
-// There is a second copy of this in ThemeVariableMap.jsm.
 function _isColorDark(r, g, b) {
   return 0.2125 * r + 0.7154 * g + 0.0721 * b <= 110;
 }
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -417,17 +417,16 @@ void nsXPLookAndFeel::OnPrefChanged(cons
 }
 
 static constexpr nsLiteralCString kBoolMediaQueryPrefs[] = {
     "browser.proton.enabled"_ns,
     "browser.proton.contextmenus.enabled"_ns,
     "browser.proton.modals.enabled"_ns,
     "browser.proton.doorhangers.enabled"_ns,
     "browser.proton.places-tooltip.enabled"_ns,
-    "browser.theme.dark-toolbar-theme"_ns,
 };
 
 // Read values from the user's preferences.
 // This is done once at startup, but since the user's preferences
 // haven't actually been read yet at that time, we also have to
 // set a callback to inform us of changes to each pref.
 void nsXPLookAndFeel::Init() {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -2218,17 +2218,16 @@ STATIC_ATOMS = [
     Atom("_moz_gtk_csd_maximize_button", "-moz-gtk-csd-maximize-button"),
     Atom("_moz_gtk_csd_close_button", "-moz-gtk-csd-close-button"),
     Atom("_moz_gtk_csd_reversed_placement", "-moz-gtk-csd-reversed-placement"),
     Atom("_moz_proton", "-moz-proton"),
     Atom("_moz_proton_contextmenus", "-moz-proton-contextmenus"),
     Atom("_moz_proton_doorhangers", "-moz-proton-doorhangers"),
     Atom("_moz_proton_modals", "-moz-proton-modals"),
     Atom("_moz_proton_places_tooltip", "-moz-proton-places-tooltip"),
-    Atom("_moz_toolbar_prefers_color_scheme", "-moz-toolbar-prefers-color-scheme"),
     Atom("_moz_system_dark_theme", "-moz-system-dark-theme"),
     # application commands
     Atom("Back", "Back"),
     Atom("Forward", "Forward"),
     Atom("Reload", "Reload"),
     Atom("Stop", "Stop"),
     Atom("Search", "Search"),
     Atom("Bookmarks", "Bookmarks"),