Closed Bug 1077620 Opened 10 years ago Closed 9 years ago

BrowserElementParent needs a way of getting a W3C manifest

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1003890

People

(Reporter: marcosc, Assigned: marcosc)

References

(Blocks 1 open bug, )

Details

The BrowserElementParent class currently lacks a way of obtaining the w3c manifest of a top-level browsing context. 

Proposal is to add a getW3CManifest() method that would retrieve a w3c manifest for/from the document contained by the BrowserElementParent by following the W3C spec for how to do that.
Assignee: nobody → mcaceres
This would be part of the Browser API, so let's get some feedback from Kan-Ru.

Kan-Ru, Marcos is proposing adding a method to the Browser API called getW3CManifest().

When called, it would look for a manifest either specified in a <link rel=manifest> link relation or at a /.well-known URL and return a Promise which will eventually respond with a JavaScript object containing the parsed web manifest data. (Marcos, please correct me if I'm wrong).

This is a proposed alternative to the mozbrowsermanifestchange event which currently just fires when it comes across a <link rel=manifest> link relation and contains the manifest URL which Gaia is then left to fetch itself.

We do have existing methods like getScreenshot(), getVisible, getCanGoBack(), getCanGoForward() and getScreenshot() on the Browser API but they all currently use callbacks rather than Promises. Also this use case seems more similar to mozbrowsericonchange where a <link rel=icon> link relation fires an event which contains an icon URL which Gaia is then meant to fetch. Gaia is left to fallback to the well known /favicon.ico itself if no iconchange event is fired.

Do you think we should stick to the mozbrowsermanifestchange event currently implemented or add this new method to the API? If it's the latter, should we start to update other parts of the Browser API to return Promises instead of using callbacks, and should we consider adding a getIcon() method which returns a Promise and get the platform to deal with fetching icons rather than Gaia?
Flags: needinfo?(kchen)
I think it's ok to expose this method. It's good that Gaia doesn't have to retrieve and parse the manifest by itself.

I'll be very happy to move to Promises :)
Flags: needinfo?(kchen)
Thanks for the feedback Kan-Ru. In bug 1003876 Jonas has suggested the idea of extending XMLHttpRequest to enable manifests and other resources to be fetched using a specific data jar.

Perhaps we should suggest using Promises instead of callbacks when we standardise the Browser API?
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
This is all better thought out in bug 1003890, which is explicitly about FxOS.
You need to log in before you can comment on or make changes to this bug.