Closed Bug 1479230 Opened 6 years ago Closed 6 years ago

Remove useless condition in GetPrefersReducedMotion.

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

      No description provided.
This query is always enabled in content, so this check is always true.

The early return (similar to the return in the switch clause) makes me a bit
uncomfortable btw. Returning without changing a value makes the query
unconditionally evaluate to false. Which means that pages that detect the query
at runtime like:

  @media (prefers-reduced-motion: no-preference) {
    do-animations
  }

  @media (prefers-reduced-motion) {
    dont-do-animations
  }

Or something of the sort will be broken... Probably not a huge concern since
it's unlikely, but was this considered? Should we just return NoPreference for
unsupported platforms / resist fingerprinting?
Comment on attachment 8995759 [details]
Bug 1479230: Remove useless condition in GetPrefersReducedMotion. r=hiro

Hiroyuki Ikezoe (:hiro) has approved the revision.

https://phabricator.services.mozilla.com/D2490
Attachment #8995759 - Flags: review+
Thanks for the review Hiro! Any opinion on comment 1? I'll remove that from the commit message, but I want to confirm the current behavior is intentional.
Flags: needinfo?(hikezoe)
It's not intentional, I have no idea how happens the situation.  That's said, I agree clearing |aResult| and setting NoPreference looks safer actually.  Feel free to do that!
Flags: needinfo?(hikezoe)
I'll file a bug, since that's a change in behavior and we have a good way to test it via the resistFingerPrinting pref.
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dc5ea0cbf005
Remove useless condition in GetPrefersReducedMotion. r=hiro
https://hg.mozilla.org/mozilla-central/rev/dc5ea0cbf005
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: