Opened on 01/14/2016 at 03:01:09 PM

Closed on 01/19/2016 at 04:45:06 PM

Last modified on 01/28/2016 at 11:57:06 AM

#3515 closed change (fixed)

Use ES6 promises

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-1.10.1-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: kzar Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Scheer Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29333514
https://codereview.adblockplus.org/29333518
https://codereview.adblockplus.org/29333522
https://codereview.adblockplus.org/29333528
https://codereview.adblockplus.org/29333533
https://codereview.adblockplus.org/29333538
https://codereview.adblockplus.org/29333541
https://codereview.adblockplus.org/29333544

Description (last modified by sebastian)

Background

Promises make asynchronous code easier to write and read and therefore contribute to a better code quality and fewer bugs.

ES2015 (aka ES6) introduced promises as part of the JavaScript language. This has been implemented by now in recent versions of Chrome, Opera and Safari. Though we still support older versions of these browsers that lack native support. This however isn't a problem as we can use a polyfill.

The extension API and our abstraction layer shouldn't be considered for now. There is a Chrome bug to support promises in the extension API. Theoretically, we could already support promises in our abstraction layer, but I'm still undecided what the approach should be there.

What to change

  • Add polyfills for the Promise class and fetch() API.
  • Replace usage of XMLHttpRequest with fetch().
  • Replace the Prefs.onLoaded event with a Prefs.isLoadedpromise.

Hints for testers

  • Make sure that extension initialization works
    • so that settings are preserved when restarting the browser or updating the extension.
    • so that default filter lists are configured and that the first run page shows for new installs.
  • Make sure that the options page, and in particular adding new filter lists from the dropdown, works.
  • Also test on older browser versions, in particular Chrome <32 and Safari 6.

Attachments (0)

Change History (8)

comment:1 Changed on 01/14/2016 at 05:35:45 PM by sebastian

  • Review URL(s) modified (diff)

comment:2 Changed on 01/14/2016 at 05:58:17 PM by sebastian

  • Description modified (diff)
  • Ready set

comment:3 Changed on 01/14/2016 at 06:05:12 PM by kzar

  • Cc kzar added

comment:4 Changed on 01/19/2016 at 12:31:48 PM by sebastian

  • Status changed from new to reviewing

comment:6 Changed on 01/20/2016 at 01:35:17 PM by sebastian

  • Description modified (diff)

comment:7 Changed on 01/28/2016 at 11:56:34 AM by scheer

Done.

  • Extension initialization works.
  • Settings are preserved when restarting the browser or updating the extension.
  • Default lists are configured and first page runs on installation.
  • Options Page and 'add filter subscription' drop down menu functions.

Chrome 30,31,32,44,45,46,48
Safari 6
Adblock Plus 1.10.0.1534

Last edited on 01/28/2016 at 11:57:06 AM by scheer

comment:8 Changed on 01/28/2016 at 11:56:44 AM by scheer

  • Tester changed from Unknown to Scheer
  • Verified working set

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from sebastian.
 
Note: See TracTickets for help on using tickets.