Opened 10 months ago

Last modified 5 months ago

#7271 closed change

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

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):

https://gitlab.com/eyeo/adblockplus/adblockpluschrome/merge_requests/42

Description (last modified by kzar)

Background

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.

Change History (1)

comment:1 Changed 10 months ago by kzar

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