mozilla / libdweb

Extension containing an experimental libdweb APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omitting contentType in browser.protocol.registerProtocol crashes nightly

lidel opened this issue · comments

I've been experimenting with Protocol handler API (#2) and tried to follow suggestion from #2 (comment):

contentType/contentEncoding
In IPFS we do not store mime-types along with data, so we don't know it before data starts arriving. Public HTTP gateways are doing mime-type-sniffing and we will have to do the same in browser.
Question: is it possible for Firefox to provide access to its own mime-type-sniffer? Perhaps setting contentType to auto or null could enable already existing heuristics described here?
Reusing it would be more elegant than doing mime-sniffing in userland.

I believe omitting contentType / contentEncoding would do exactly that.

Feedback from battlefield: while it is ok to omit contentEncoding, I get browser crash if I don't include contentType.

Steps to reproduce

  1. Checkout current HEAD (c36533e) and grab yesterday's Nightly 63.0a1
  2. Comment out this line:
    contentType: "text/html",
  3. yarn && yarn demo:protocol
  4. Open dweb://crash
  5. Nightly dies:

    browser crash

@lidel Thanks for reporting. I'll look into this