Closed Bug 1067345 Opened 10 years ago Closed 9 years ago

Speculative parser doesn't handle <picture>/srcset based resources

Categories

(Core :: DOM: HTML Parser, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: yoav, Assigned: johns)

References

Details

Attachments

(7 files, 6 obsolete files)

2.20 KB, patch
Details | Diff | Splinter Review
7.43 KB, patch
Details | Diff | Splinter Review
16.20 KB, patch
Details | Diff | Splinter Review
7.47 KB, patch
Details | Diff | Splinter Review
10.84 KB, patch
Details | Diff | Splinter Review
34.53 KB, patch
Details | Diff | Splinter Review
13.94 KB, patch
Details | Diff | Splinter Review
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36

Steps to reproduce:

Looking at the code that handles speculative loads at http://mxr.mozilla.org/mozilla-central/source/parser/html/nsHtml5TreeBuilderCppSupplement.h#103 picture based resources don't seem to be handled.

Furthermore, it seems that <img> based resources will just preload the 'src' attribute regardless of the presence of the srcset attribute or a <picture> parent.

So, it seems like the problem is two-fold: src resources should not be preloaded for such resources, and srcset/<picture> based resources should be.
At the very least we should not pref <picture> on by default as long as we preload <img src> as a child of <picture> or with an srcset attribute without actually checking if the <img src> will end up being used.

But indeed, it would be even better to gather the relevant <picture>/srcset bits in full in the preloader and ship them to the main thread for evaluation so that the right URL can be preloaded.
Status: UNCONFIRMED → NEW
Ever confirmed: true
So the quirk fix is to not take action on <img src> with a <picture> parent or <srcset> attr, one of which is necessary to trigger non-simple-src rules.

To extend early image opening off thread to the full <picture> implementation, the ResponsiveImageSelector class is already designed to be runnable off thread, but there are some scenarios where e.g. viewport width isn't available yet that would need to return a indeterminate response -- we would resume loading in that case at element creation on the dom thread.
Assignee: nobody → jschoenick
Status: NEW → ASSIGNED
No longer depends on: 1140769
Who reviewed these patches?  I don't see reviews from anyone who's a peer for the HTML parser here, or reviews from anyone at all.

These added a ton of bloat to the nsHtml5SpeculativeLoad struct...
Flags: needinfo?(josh)
Apparently nobody. I thought I had checked that, but I guess it got lost in the shuffle when I inherited the responsive image work.
Flags: needinfo?(josh)
Alright, thanks.  I'll see what Henri ends up saying in bug 1382020 about how this code should actually work...
Depends on: 1385907
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: