Closed Bug 1618535 Opened 5 years ago Closed 4 years ago

[rel=preload] as="fetch" preload support

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: mayhemer, Assigned: mayhemer)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Part of Design documentation for rel=preload

Please see the implementation notes for “fetch” type.

The idea is to have a loader - in this case more a preloader - that can be used to preload any "as" type of resource. Primarily it will be used for "fetch", but we may also want to use it for "font" (in a different bug).

The fetch loader should hang off the document as all other loaders (script, style, ...) do.

It will provide a method taking a channel and a key (as defined in the design doc). It will asyncOpen the channel with a class derived from PreloaderBase class as the listener, and register it in Document.PreloadService, similarly as we want for other loaders in bug 1618292 el al. There is no need to do anything else, this exposes the preload data and status in Document.PreloadService under the key for <link rel=preload> DOM nodes and final data consumers, like fetch and XHR.

There will be no coalescing inside the loader, it's up to the callers to coalesce by checking Document.PreloadService.LookupPreload for the key.

Wondering if this could be reduced to a helper static function only, taking Document, nsIChannel and key as only arguments, possibly returning PreloaderBase as a result for use.

Blocks: 1618536
Blocks: 1618543
Blocks: 1618544
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Pushed by honzab.moz@firemni.cz: https://hg.mozilla.org/integration/autoland/rev/d7a40b7e663f Implement preloading for as="fetch" type r=kershaw,baku
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Pushed by geoff@darktrojan.net: https://hg.mozilla.org/integration/autoland/rev/1706d4d54ec6 Add missing `#include "nsIDocShell.h"` to unbreak the Thunderbird build r=baku

Thanks, Geoff!

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

Attachment

General

Created:
Updated:
Size: