Closed
Bug 1343677
Opened 8 years ago
Closed 8 years ago
Consider adding asserts in nsCSSProps::IsEnabled that we've received the prefs from the parent process
Categories
(Core :: CSS Parsing and Computation, enhancement)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla55
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
Attachments
(3 files)
2.67 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
2.31 KB,
patch
|
dholbert
:
review+
billm
:
review+
|
Details | Diff | Splinter Review |
3.01 KB,
patch
|
dholbert
:
review+
billm
:
review+
|
Details | Diff | Splinter Review |
We want to catch it if we try to parse some pref-dependent CSS before we know our pref values.
Is it possible to detect, in a debug build, whether we've received the initial pref data in the content process?
Flags: needinfo?(wmccloskey)
Assignee | ||
Comment 1•8 years ago
|
||
To be clear, the idea here is to catch cases when prefs we did not add in dom/ipc/ContentPrefs.cpp are accessed too early from the style system.
Yes, we can detect in DEBUG builds whether prefs have been received yet:
http://searchfox.org/mozilla-central/rev/31b6089ce26fa76459642765115605d50a6c67b4/modules/libpref/prefapi.cpp#738
Flags: needinfo?(wmccloskey)
Assignee | ||
Comment 3•8 years ago
|
||
OK. So we could add a Preferences::GetInitPhase().
So I guess we can ContentPrefs::GetContentPrefs, check whether our pref is in the list, and if not assert that the phase is END_ALL_PREFS or so?
Yeah, I think that should work.
I don't really understand the UA stylesheet issue though. Is there a way that we could work around this so that we don't have to send these prefs on the command line? Could we initialize the UA stylesheet stuff later?
Assignee | ||
Comment 5•8 years ago
|
||
> Could we initialize the UA stylesheet stuff later?
It's really not clear to me that we don't already do that. We initialize it the first time we create a document that needs styling. That _ought_ to be pretty late! I just don't know for sure.
Once we have asserts for this stuff, we should try removing it from the list and seeing whether they trigger.
Assignee | ||
Comment 6•8 years ago
|
||
I guess there's also the question of how to make this play with stylo and its pref setup.
Assignee | ||
Comment 7•8 years ago
|
||
Ah, I guess stylo just calls nsCSSProps::IsEnabled.
Assignee | ||
Comment 8•8 years ago
|
||
So I tried doing the obvious thing and asserting that we're at the END_ALL_PREFS phase when IsEnabled() is called.
This fails to start up, and it has nothing to do with content processes, even. In the chrome process, the "addons-startup" notification is dispatched, WebCompatReporter.jsm runs, gets the stylesheet service, and does preloadSheet, passing "chrome://webcompat-reporter/skin/lightbulb.css" as the URI. This is all happening quite early, before we've loaded prefs even in the parent process, I guess.
The good news is presumably that it doesn't use any pref-controlled properties in that sheet. The bad news is that this makes it a bit more complicated to figure out what the right thing to assert is.
Assignee | ||
Comment 9•8 years ago
|
||
Hmm. I guess we never actually change the pref phase in the parent process. So maybe I need to restrict the assert to the content process...
Assignee | ||
Comment 10•8 years ago
|
||
MozReview-Commit-ID: JtHhLuFDu2d
Attachment #8847929 -
Flags: review?(wmccloskey)
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Assignee | ||
Comment 11•8 years ago
|
||
This ensures that we don't read incorrect values out of the gPropertyEnabled
array simply because we haven't gotten preference values from the parent process
yet.
MozReview-Commit-ID: 59AgN3ecXQl
Attachment #8847930 -
Flags: review?(wmccloskey)
Attachment #8847930 -
Flags: review?(dholbert)
Assignee | ||
Comment 12•8 years ago
|
||
We're now asserting that we never check these before the END_ALL_PREFS phase,
which means they don't need to be sent to the content process synchronously.
MozReview-Commit-ID: 4BGbvVCjDWz
Attachment #8847931 -
Flags: review?(wmccloskey)
Attachment #8847931 -
Flags: review?(dholbert)
Assignee | ||
Comment 13•8 years ago
|
||
Comment 14•8 years ago
|
||
Comment on attachment 8847930 [details] [diff] [review]
part 2. Assert in nsCSSprops::IsEnabled that we have received all preferences
Review of attachment 8847930 [details] [diff] [review]:
-----------------------------------------------------------------
This seems fine to me. r=me
Attachment #8847930 -
Flags: review?(dholbert) → review+
Comment 15•8 years ago
|
||
Comment on attachment 8847931 [details] [diff] [review]
part 3. Remove all the CSS bits from the ContentPrefs whitelist
Review of attachment 8847931 [details] [diff] [review]:
-----------------------------------------------------------------
This seems fine to me, if billm's OK with it & if the assertion doesn't fire.
Attachment #8847931 -
Flags: review?(dholbert) → review+
Attachment #8847929 -
Flags: review?(wmccloskey) → review+
Comment on attachment 8847930 [details] [diff] [review]
part 2. Assert in nsCSSprops::IsEnabled that we have received all preferences
Review of attachment 8847930 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/nsCSSProps.h
@@ +635,5 @@
> "out of range");
> + // We don't have useful pref init phases in the parent process. But in the
> + // child process, assert that we're not trying to parse stylesheets before
> + // we've gotten all our prefs.
> + MOZ_ASSERT(XRE_IsParentProcess() ||
MOZ_ASSERT_IF(XRE_IsContentProcess(), ...) is a little nicer IMO, but it looks like it doesn't allow the string to be passed in :-(. I guess it's fine as-is.
Attachment #8847930 -
Flags: review?(wmccloskey) → review+
Comment on attachment 8847931 [details] [diff] [review]
part 3. Remove all the CSS bits from the ContentPrefs whitelist
Review of attachment 8847931 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for doing this Boris.
Attachment #8847931 -
Flags: review?(wmccloskey) → review+
Comment 18•8 years ago
|
||
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/55ee07a916b8
part 1. Add a way to get the current preferences init phase in debug builds. r=billm
https://hg.mozilla.org/integration/mozilla-inbound/rev/d6b773c15593
part 2. Assert in nsCSSprops::IsEnabled that we have received all preferences. r=dholbert,billm
https://hg.mozilla.org/integration/mozilla-inbound/rev/008b180abd4a
part 3. Remove all the CSS bits from the ContentPrefs whitelist. r=billm,dholbert
Comment 19•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/55ee07a916b8
https://hg.mozilla.org/mozilla-central/rev/d6b773c15593
https://hg.mozilla.org/mozilla-central/rev/008b180abd4a
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•8 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•