fregante/content-scripts-register-polyfill

`code` isn't supported, only `file` is

fregante opened this issue · 1 comments

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contentScripts/register

code is currently unsupported

browser.contentScripts.register({
  matches: ['https://github.com/*'],
  css: [{
    code: 'html {background: red}'
  }]
});

Only this works:

/* file.css */
html {background: red}
browser.contentScripts.register({
  matches: ['https://github.com/*'],
  css: [{
    file: 'file.css'
  }]
});

Incorrect! It does work. The code has a constant called file but it can look like {file: 'file.js'} or {code: 'alert(1)'}