This introduces preferences loading style. See D201997 for the
rationale, test coverage and why there is no behavior change.
Note that current behavior for deferred style is to always set
PRIORITY_LOW, so the fetchpriority attribute has no effect.
Some preference names could be more verbose to match the if
branches in `Loader::AdjustPriority` but note that it is not
clear whether "deferred preload style" can actually happen,
see bug 1879335.
Differential Revision: https://phabricator.services.mozilla.com/D202052
This is shorter, clearer and more consistent with the case when
StaticPrefs::network_fetchpriority_enabled() is disabled. No
behavior changes.
Differential Revision: https://phabricator.services.mozilla.com/D200925
Includes only support for dynamically loading style sheets from `<link>`
elements and `Link` header fields.
The remaining support, including preloading, is completed in part 3.
Differential Revision: https://phabricator.services.mozilla.com/D191745
This matches the behavior of other browsers, and avoids having to keep
alive the link element and thus associated document etc for too long.
Differential Revision: https://phabricator.services.mozilla.com/D192834
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.
I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).
Differential Revision: https://phabricator.services.mozilla.com/D190450
The old code was basically doing string copies that are totally
redundant, in a not-very performant way too.
This was from the time where stylo had to live with the old style
engine, and there's no need to keep the copy around anymore.
Differential Revision: https://phabricator.services.mozilla.com/D186974
CSS rules were storing absolute rather than relative line numbers (this
was done to match the old style system).
So when we hit the cached inline stylesheet code-path, for which we
share the CSS rules of the stylesheet, for the cache hit the line
numbers were completely off.
This particular page was probably regressed by bug 1834081, but the
issue could happen before with Shadow DOM.
Always store relative numbers and convert to absolute when asked by the
inspector, rather than the other way around.
This is simpler and makes the cache work.
Differential Revision: https://phabricator.services.mozilla.com/D185916
This fixes the windows WPT failures in comment 23. The issue is that the
new accessiblecaret.css makes us delay the load event by a tick even in
about:blank.
Depends on D173998
Differential Revision: https://phabricator.services.mozilla.com/D182878
Subtle things:
* We now have shadow trees in NAC, inception! Only a couple lines of
code in the style system had to be changed to match :host rules and
so properly.
* Had to make highlighters.css contentaccessible, because otherwise we
can't load it from the shadow tree. I don't think it's a big deal.
* I removed some of the code from highlighters.css that claimed that
stuff inherited from the html element. That's just no longer true.
* Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
This is needed because CSSOM from chrome code bypasses CSP (as
AnonymousContent did), but setAttribute() doesn't, see bug 1424474.
Differential Revision: https://phabricator.services.mozilla.com/D173998
Subtle things:
* We now have shadow trees in NAC, inception! Only a couple lines of
code in the style system had to be changed to match :host rules and
so properly.
* Had to make highlighters.css contentaccessible, because otherwise we
can't load it from the shadow tree. I don't think it's a big deal.
* I removed some of the code from highlighters.css that claimed that
stuff inherited from the html element. That's just no longer true.
* Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
This is needed because CSSOM from chrome code bypasses CSP (as
AnonymousContent did), but setAttribute() doesn't, see bug 1424474.
Differential Revision: https://phabricator.services.mozilla.com/D173998
Subtle things:
* We now have shadow trees in NAC, inception! Only a couple lines of
code in the style system had to be changed to match :host rules and
so properly.
* Had to make highlighters.css contentaccessible, because otherwise we
can't load it from the shadow tree. I don't think it's a big deal.
* I removed some of the code from highlighters.css that claimed that
stuff inherited from the html element. That's just no longer true.
* Had to switch from `setAttribute("style", ...)` to `.style = ...;`.
This is needed because CSSOM from chrome code bypasses CSP (as
AnonymousContent did), but setAttribute() doesn't, see bug 1424474.
Differential Revision: https://phabricator.services.mozilla.com/D173998
The spec asks to post a task, see html.spec.whatwg.org/#update-a-style-block
What we were doing is quite crazy. Unifying the scheduling between
<style> and <link rel=stylesheet> on the patch above causes failures on
some mochitests.
Some of them aren't really related to these and are a pre-existing bug,
see bug 1838346.
Differential Revision: https://phabricator.services.mozilla.com/D180895
Otherwise stuff accessing stylesheets from a sandbox and content might
conflict, and we might incorrectly deny giving access to a CSSStyleSheet's
rules.
Differential Revision: https://phabricator.services.mozilla.com/D178971
Make all UA widgets also NAC.
Keep the UA widget flag but break at anonymous subtree boundaries, so
that only nodes inside the UA widget directly (and not NAC from those)
get the flag.
This is important because two callers depend on this difference:
* The style system, since we still want to match content rules from
stylesheets in the UA widget. We also match user rules, which is a
bit sketchy, but that was the previous behavior, will file a
follow-up for that.
* The reflector code, since we want the scope for UA widgets to not
include the NAC nodes inside that UA widget. nsINode::IsInUAWidget
got it wrong.
After this patch, ChromeOnlyAccess is equivalent to
IsInNativeAnonymousSubtree, so we should probably unify the naming.
That's left for a follow-up patch because I don't have a strong
preference.
Differential Revision: https://phabricator.services.mozilla.com/D174310
I don't think there's ever a way these should differ.
Got some include hell from removing ReferrerInfo.h from Document.h but
hopefully should be straight-forward to review.
Depends on D173154
Differential Revision: https://phabricator.services.mozilla.com/D173155