0

I am porting my Chrome extension to work in Microsoft Edge. I used Microsoft's toolkit and bridged the code. But i get an error is console saying "SCRIPT5007: Unable to get property 'contains' of undefined or null reference". This is thrown at the place where i have called chrome.permissions.contains.

Let me know if there is a solution for this or if there is a documentation for all these incompatibilities.

Vickmaniac
  • 165
  • 9

1 Answers1

0

The API is not currently supported by Edge. Microsoft lists it as "Under consideration".

So the only solutions are:

  • Do not use chrome.permissions in your port. Probably by granting the widest permissions possible. Unpleasant, but you have to explain to users that it's a platform limitation.
  • Wait until it is supported (which is not guaranteed; FF's WebExtension platform doesn't support them yet either).

The roadmap of API support is here: Microsoft Edge extension API roadmap

Detailed list of supported APIs with known issues/incompatibilities: Supported APIs

Xan
  • 74,770
  • 16
  • 179
  • 206
  • Thanks and any idea about chrome.cookies ? I see that it is present in supported API doc but it keeps throwing "undefined" error. – Vickmaniac Sep 27 '16 at 08:36
  • Did you declare the permission to use it? – Xan Sep 27 '16 at 08:36
  • I included "cookies" under permissions in manifest.json and included the domain name in the permissions as well. – Vickmaniac Sep 27 '16 at 08:39
  • Are you trying to [use it from a content script](http://stackoverflow.com/q/6850787/934239)? – Xan Sep 27 '16 at 08:42
  • No this extension is of chrome's and it works in chrome browser but not with edge. It is not used in a content script – Vickmaniac Sep 27 '16 at 08:47
  • Have you looked at the second link? It's not fully supported (`onChanged` isn't) – Xan Sep 27 '16 at 08:50
  • chrome.cookies.getAll({ "url": cookie_domain }, function(cookies){console.error("name: "+cookies[0].value);}); this return "Unable to get property 'value' of undefined or null reference". – Vickmaniac Sep 27 '16 at 08:52
  • 1
    Well there are no cookies for this domain. The code doesn't consider that a possibility and craps itself. API not at fault. I think it's pointless to continue this discussion in comments - ask a new question if you think it's worth discussing. – Xan Sep 27 '16 at 08:54