support content handlers in WebExtensions

UNCONFIRMED
Unassigned

Status

()

Toolkit
WebExtensions: Untriaged
P5
normal
UNCONFIRMED
4 months ago
10 days ago

People

(Reporter: Denis Lisov, Unassigned)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: triaged)

Attachments

(1 attachment)

(Reporter)

Description

4 months ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0
Build ID: 20170412100254

Steps to reproduce:

I'm porting Brief, a feed reader, to WebExtensions. A way is needed to add Brief to the list of available feed handlers.

Given the existence of registerContentHandler[1] as a web API (implemented in Firefox for feeds only, bug 391286), it makes sense to mirror the API introduced for protocol handlers in bug 1310427 and create an array of content MIME-type handlers (initially implemented for feeds only).

[1]: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/registerContentHandler

Comment 1

4 months ago
investigating idea
Flags: needinfo?(mixedpuppy)
Whiteboard: investigating
In my previous exploration of adding content handlers I discovered that essentially, beyond feeds, we wouldn't be able to support anything else.  At that point I decided to not bother.  I'd be fine with a content handler capability that mirrors the patch in bug 1310427 (it would likely be almost identical), but we'd have to limit the mime types per WebContentConverter.

https://dxr.mozilla.org/mozilla-central/source/browser/components/feeds/WebContentConverter.js#466

This wont be a priority for us to implement for 57, however I'd be happy to give input and guidance to anyone who wanted to tackle this.
Flags: needinfo?(mixedpuppy)
Priority: -- → P5
Whiteboard: investigating → triaged
(Reporter)

Comment 3

4 months ago
Is the "feeds only" limitation a fundamental one (almost everything else must not be available for some reason like security or privacy) or a technical one (the current Firefox infrastructure provides no way to do so)?

Anyway, I'm willing to work on this at least for feeds. What do I need to know apart from https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Introduction ?
The feeds only limitation is both security and technical entwined and I don't know the history, but from looking at code I can surmise the following:

A) undocumented security issues or concerns briefly mentioned in code
B) due to (A), general implementation was left unfinished

I spent a lot of time looking at the content handling code, it would have to be reworked to support a generic interface.  Feeds appear well handled at least in code if not UI.
(In reply to Denis Lisov from comment #3)
> Anyway, I'm willing to work on this at least for feeds. What do I need to
> know apart from
> https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/
> Introduction ?

Oh, and start there and ping me with any questions.
Created attachment 8859347 [details] [diff] [review]
exploratory patch contentHandlers

This is an old patch (probably bit rotted) I did when exploring adding content handler support (I was trying to support any mime type, not just feeds).  Some of it may still be useful (e.g. the schema and perhaps some of the ext-contenthandlers.js code).  It also probably illustrates some of the strange code paths that potentially happen with various content handling.
(Reporter)

Comment 7

4 months ago
Oh, thank you for the patch!
I was actually looking at WebContentConverterRegistrar that registerContentHandler uses. What's the reason you're avoiding it?
(In reply to Denis Lisov from comment #7)
> Oh, thank you for the patch!
> I was actually looking at WebContentConverterRegistrar that
> registerContentHandler uses. What's the reason you're avoiding it?

IIRC, and it's been some time since I looked at this so I could be wrong, WebContentConverterRegistrar was limiting to feeds and I was trying to get more general (such as supporting ebook mime types).
Blocks: 1341098
Blocks: 1344648

Comment 9

4 months ago
From my understanding if you limit content handlers to RSS you kill add-ons like a Markdown Viewer, e.g. https://github.com/Thiht/markdown-viewer/issues/62
(In reply to Croydon from comment #9)
> From my understanding if you limit content handlers to RSS you kill add-ons
> like a Markdown Viewer, e.g.
> https://github.com/Thiht/markdown-viewer/issues/62

I responded on that issue.  The specific code linked to should be possible given bug 1255894.
You need to log in before you can comment on or make changes to this bug.