mozilla / libdweb

Extension containing an experimental libdweb APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cc['@mozilla.org/network/content-sniffer;1'] is undefined with Nightly 64.0a1

lidel opened this issue · comments

I've noticed a regression when running against latest Nightly (64.0a1):

$ npm run demo:protocol

> libdweb@0.0.0 demo:protocol /home/lidel/project/libdweb
> cross-env MOZ_DISABLE_CONTENT_SANDBOX=1 web-ext run --firefox=nightly --browser-console --url about:debugging --source-dir demo/protocol

Applying config file: ./package.json
Running web extension from /home/lidel/project/libdweb/demo/protocol
Use --verbose or open Tools > Web Developer > Browser Console to see logging

WebExtError: installTemporaryAddon: Error: unknownError: Could not install add-on at '/home/lidel/project/libdweb/demo/protocol': TypeError: Cc['@mozilla.org/network/content-sniffer;1'] is undefined; can't access its "createInstance" property
    at /home/lidel/project/libdweb/node_modules/web-ext/dist/webpack:/src/firefox/remote.js:116:27
    at Client.handleMessage (/home/lidel/project/libdweb/node_modules/web-ext/dist/webpack:/node_modules/@cliqz-oss/firefox-client/lib/client.js:162:1)
    at Client.readMessage (/home/lidel/project/libdweb/node_modules/web-ext/dist/webpack:/node_modules/@cliqz-oss/firefox-client/lib/client.js:221:1)
    at Client.onData (/home/lidel/project/libdweb/node_modules/web-ext/dist/webpack:/node_modules/@cliqz-oss/firefox-client/lib/client.js:187:1)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:601:20)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libdweb@0.0.0 demo:protocol: `cross-env MOZ_DISABLE_CONTENT_SANDBOX=1 web-ext run --firefox=nightly --browser-console --url about:debugging --source-dir demo/protocol`
npm ERR! Exit status 1

cc ipfs/ipfs-companion#533

It seems that content-sniffer XPCOM registration was removed by Bug 1488306

There is still a @mozilla.org/media/sniffer;1 component which actually might work in this instance, but I'm not entirely sure

While it would be nice a option to have, now that we have an async handler it is not a hard blocker.
Sniffing can be done in userland (ipfs example).

Worst case scenario: we could just ignore the browser's sniffer entirely and make presence of contentType and contentEncoding mandatory in protocol handler response.

Alright this change a78b0a0 puts a band-aid on this, not sure if we'll be able to get content sniffer back, but I'll try.