Closed Bug 1729861 Opened 3 years ago Closed 3 years ago

nsPresContext fails to actually register callbacks for some of the prefs it wants to react to

Categories

(Core :: Layout, defect)

defect

Tracking

()

RESOLVED FIXED
94 Branch
Tracking Status
firefox94 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(3 files)

The nsPresContext::PreferenceChanged method wants to respond to changes in a number of prefs that can affect @media (prefers-contrast).

However, a couple of these (layout.css.prefers-contrast.enabled and privacy.resistFingerprinting) are missing from the callback lists, so we will not actually get the expected callback when they are modified.

Unfortunately, simply adding them to the gExactCallbackPrefs list results in intermittent (but frequent) failures in layout/style/test/test_bug418986-2.html, which aims to test the effect of changing privacy.resistFingerprinting.

It appears that just adding privacy.resistFingerprinting to the requiresRefresh set in SpecialPowersParent.jsm is not sufficient to resolve this; the test failures still occur.

For some reason that I don't currently understand, the testcase bug418986-2 is sensitive to this,
and when we correctly observe changes in the resistFingerprinting spec, it starts to intermittently
fail a few of the media-queries-in-picture-elements tests. If the rest of the tests are disabled
and only those tests run, they consistently pass for me; but when they're running after the
various other tests, I see frequent failures in the non-resisting case for the device-height/-width/
-aspect-ratio tests.

Moving the media-queries-in-picture-elements tests ahead of the other categories seems to
avoid this, although it suggests there's some kind of underlying race or similar issuei in handling
the effect of the pref change on media queries.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Attachment #9241618 - Attachment description: Bug 1729861 - Add missing entries to gExactCallbackPrefs in nsPresContext.cpp. r=#layout-reviewers → Bug 1729861 - Add missing entry to gExactCallbackPrefs in nsPresContext.cpp. r=#layout-reviewers

The test was relying on media queries not being recomputed, because it
ran something like this:

  1. RFP off: add a bunch of images with class "testImage" to the
    document. Then test all images with class "testImage".

  2. RFP on: do the same.

Note that there's no "remove all images added in step 1" step between 1
and 2. So the test with rfp on was also testing the images from step 1.
This worked before because resistFingerprinting didn't trigger
recomputation of the previous images.

This is a cut-down version of the 418986-2 testcase, with an explicit check that changes to
the resistFingerprinting pref will cause media queries to be re-evaluated and the resulting
computed styles to be updated at runtime.

Depends on D125857

Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/129487f35030
Fix test for bug 418986. r=jfkthame
https://hg.mozilla.org/integration/autoland/rev/55bc705a6b3f
Add missing entry to gExactCallbackPrefs in nsPresContext.cpp. r=dholbert,emilio
https://hg.mozilla.org/integration/autoland/rev/589c77329c8d
Add mochitest for the effect of dynamic changes to the resistFingerprinting pref on media queries. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: