Opened 3 years ago

Last modified 2 years ago

#5028 closed change

Use the browser extension API via the "browser" (instead of "chrome") namespace — at Version 4

Reported by: sebastian Assignee:
Priority: P4 Milestone: Adblock-Plus-3.0-for-Firefox
Module: Platform Keywords: goodfirstbug
Cc: greiner, mjethani Blocked By:
Blocking: #4579 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29570614/
https://codereview.adblockplus.org/29573083/
https://codereview.adblockplus.org/29573134/

Description (last modified by sebastian)

Background

In the upcoming browserext standard, which is already implemented by Firefox and Microsoft Edge, the browser extension API is provided by the browser namespace, as opposed to the chrome namespace.

As a quick fix, we therefore aliased chrome = browser in the edge branch (#3695), in the Firefox we can either use chrome or browser. However, given that browser.* is going to be standardized, this is backwards, and using chrome.* in code that also runs on other platforms is also misleading.

What to change

  • If the browser object is undefined (i.e. on Chrome), globally define browser = chrome.
  • Adapt all usage of the extension API to use browser.* instead of chrome.*.

Change History (4)

comment:1 Changed 3 years ago by sebastian

  • Description modified (diff)

comment:2 Changed 3 years ago by greiner

  • Cc greiner added

comment:3 Changed 2 years ago by mjethani

Mozilla has a polyfill for this.

comment:4 Changed 2 years ago by sebastian

  • Description modified (diff)
Note: See TracTickets for help on using tickets.