Speculatively load stylesheets from preloading

RESOLVED FIXED

Status

()

Core
HTML: Parser
RESOLVED FIXED
9 years ago
4 years ago

People

(Reporter: mrbkap, Assigned: bjarne)

Tracking

(Depends on: 1 bug, {fixed1.9.1})

Trunk
x86
Linux
fixed1.9.1
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

9 years ago
This is similar to bug 457809 but for stylesheets.
Assuming you have the nsIDocument involved in |doc|, the URI of the sheet in |uri| and an nsICSSLoaderObserver implementation (probably one which just does "return NS_OK;" as the body of StyleSheetLoaded) in |obs|:

  doc->CSSLoader()->LoadSheet(uri, doc->NodePrincipal(), obs);

will do the trick, since CSSLoader already caches loaded sheets and already coalesces sheet loads.

You probably want to avoid doing this for alternate stylesheets, though, since currently we deprioritize them and forcing them to load earlier could actually slow sites that use them down.
(Assignee)

Comment 2

8 years ago
See patch for bug #457809
Status: NEW → ASSIGNED
(Assignee)

Updated

8 years ago
Assignee: nobody → bjarne
Depends on: 457809
(Assignee)

Comment 3

8 years ago
Created attachment 370195 [details] [diff] [review]
V1.0 part of patch to preload stylesheets


This is the part of patch from bug #457809 needed to preload stylesheets. See bug #457809 comment #45.

Requesting another round of reviews just in case...
Attachment #370195 - Flags: superreview?(bzbarsky)
Attachment #370195 - Flags: review?(mrbkap)
Depends on: 486044
Attachment #370195 - Attachment description: V1.0 part of patch to preload images → V1.0 part of patch to preload stylesheets
Attachment #370195 - Flags: superreview?(bzbarsky) → superreview+
(Reporter)

Updated

8 years ago
Attachment #370195 - Flags: review?(mrbkap) → review+
(Assignee)

Updated

8 years ago
Keywords: checkin-needed
(Assignee)

Comment 4

8 years ago
Created attachment 370827 [details] [diff] [review]
V2.0 not depending on patch from bug #457809

This can be applied without the fix for bug #457809. Not tested beyond mochitests and some random browsing since it's a trivial code-shuffle.
Pushed http://hg.mozilla.org/mozilla-central/rev/bf5cf25cdd3c with the following changes to the patch:

1) No changes to nsIDocument IID
2) Fixed checkin comment.

Unfortunately, I missed the fact that the patch doesn't have the right user set.  :(
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Assignee)

Comment 6

8 years ago
Must have shuffled code a little too fast this morning... :\ thanks for fixing up. :)

(Apparently hg qfold does not preserve user-info. Must remember to check this next time!)
Tp is looking good, on both Linux and Mac!
Keywords: checkin-needed
Attachment #370827 - Flags: approval1.9.1?
We should probably fix bug 485012 before landing this on branch.
Depends on: 485012
No longer depends on: 457809
(Assignee)

Comment 9

8 years ago
Created attachment 372430 [details] [diff] [review]
V2.0 for 1.9.1 branch 

Identical to V2.0 but with issues from comment #5 fixed.
Attachment #372430 - Flags: approval1.9.1?
Attachment #370827 - Flags: approval1.9.1?
Comment on attachment 372430 [details] [diff] [review]
V2.0 for 1.9.1 branch 

a191=beltzner
Attachment #372430 - Flags: approval1.9.1? → approval1.9.1+
Pushed http://hg.mozilla.org/releases/mozilla-1.9.1/rev/88bf56a8362c
Keywords: fixed1.9.1
And pushed http://hg.mozilla.org/releases/mozilla-1.9.1/rev/e36f8c547a96 to fix the resulting test bustage due to the test fix from bug 457809 never making it to branch....
Depends on: 493968
Depends on: 495274

Updated

8 years ago
Depends on: 533247
Depends on: 907564
You need to log in before you can comment on or make changes to this bug.