Last Comment Bug 457810 - Speculatively load stylesheets from preloading
: Speculatively load stylesheets from preloading
: fixed1.9.1
Product: Core
Classification: Components
Component: HTML: Parser (show other bugs)
: Trunk
: x86 Linux
: -- normal with 1 vote (vote)
: ---
Assigned To: Bjarne (:bjarne)
Depends on: 907564 485012 486044 493968 495274 533247
  Show dependency treegraph
Reported: 2008-09-29 21:32 PDT by Blake Kaplan (:mrbkap)
Modified: 2013-08-20 21:53 PDT (History)
25 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

V1.0 part of patch to preload stylesheets (5.50 KB, patch)
2009-03-31 07:50 PDT, Bjarne (:bjarne)
mrbkap: review+
bzbarsky: superreview+
Details | Diff | Splinter Review
V2.0 not depending on patch from bug #457809 (9.60 KB, patch)
2009-04-03 03:16 PDT, Bjarne (:bjarne)
no flags Details | Diff | Splinter Review
V2.0 for 1.9.1 branch (8.70 KB, patch)
2009-04-13 11:20 PDT, Bjarne (:bjarne)
mbeltzner: approval1.9.1+
Details | Diff | Splinter Review

Description Blake Kaplan (:mrbkap) 2008-09-29 21:32:15 PDT
This is similar to bug 457809 but for stylesheets.
Comment 1 Boris Zbarsky [:bz] 2008-09-30 18:49:02 PDT
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.
Comment 2 Bjarne (:bjarne) 2009-03-20 09:36:53 PDT
See patch for bug #457809
Comment 3 Bjarne (:bjarne) 2009-03-31 07:50:06 PDT
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...
Comment 4 Bjarne (:bjarne) 2009-04-03 03:16:31 PDT
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.
Comment 5 Boris Zbarsky [:bz] 2009-04-03 07:17:31 PDT
Pushed 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.  :(
Comment 6 Bjarne (:bjarne) 2009-04-03 08:36:40 PDT
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!)
Comment 7 Boris Zbarsky [:bz] 2009-04-03 12:54:50 PDT
Tp is looking good, on both Linux and Mac!
Comment 8 Boris Zbarsky [:bz] 2009-04-08 07:32:44 PDT
We should probably fix bug 485012 before landing this on branch.
Comment 9 Bjarne (:bjarne) 2009-04-13 11:20:38 PDT
Created attachment 372430 [details] [diff] [review]
V2.0 for 1.9.1 branch 

Identical to V2.0 but with issues from comment #5 fixed.
Comment 10 Mike Beltzner [:beltzner, not reading bugmail] 2009-04-15 12:30:09 PDT
Comment on attachment 372430 [details] [diff] [review]
V2.0 for 1.9.1 branch 

Comment 11 Boris Zbarsky [:bz] 2009-04-15 17:03:44 PDT
Comment 12 Boris Zbarsky [:bz] 2009-04-15 21:29:26 PDT
And pushed to fix the resulting test bustage due to the test fix from bug 457809 never making it to branch....

Note You need to log in before you can comment on or make changes to this bug.