Opened 18 months ago

Last modified 13 months ago

#7271 closed change

Adjust Chrome API calls to use Promises where possible — at Version 4

Reported by: kzar Assignee: kzar
Priority: P2 Milestone: Adblock-Plus-for-Chrome-Opera-Firefox-next
Module: Platform Keywords: manifestv3
Cc: sebastian, greiner Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

Description (last modified by kzar)


For version 3 of Chrome's extension manifest format, one planned change is to switch from callbacks to Promises for the Chrome APIs. From the draft spec:

Extension APIs will be promise-based. The older callback version will continue to be supported...

In order to maintain backwards compatibility (and not force developers to rewrite their extension
more than they already have to), providing a callback to an API method will continue to work. If
a callback is provided, a promise will not be returned.

What to change

Where possible use Promises instead of callbacks when using the browser.* or chrome.* APIs. If necessary wrap them - see adblockpluschrome/polyfill.js.


  • See #7272 for the equivalent adblockplusui changes.

Change History (4)

comment:1 Changed 18 months ago by kzar

  • Description modified (diff)

comment:2 Changed 18 months ago by greiner

For reference, I've created #7272 for doing the same in adblockplusui.

comment:3 Changed 18 months ago by kzar

  • Description modified (diff)

comment:4 Changed 18 months ago by kzar

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