Opened on 03/30/2017 at 05:48:43 AM

Closed on 04/20/2017 at 08:19:48 AM

#5059 closed change (fixed)

Simplify io.js API

Reported by: trev Assignee: trev
Priority: P3 Milestone:
Module: Core Keywords:
Cc: wspee Blocked By: #5052
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29408742/

Description (last modified by trev)

Background

With #5052 resolved, we are only using io.js module to access files within our data directory (or its moral equivalent). So there is no longer a point to ask for nsIFile objects. While at it, some other parts of the API aged as well - we should simplify IO API as well as FilterStorage (the only remaining IO usage in Core).

What to change

  • Expect a file name for all methods rather than nsIFile.
  • Remove IO.lineBreak property.
  • Remove IO.resolveFilePath() method.
  • Return promises from all methods instead of using callbacks.
  • Make listener parameter in IO.readFromFile() a simple function, it doesn't need to be an object. Also, calling the listener with null at the end of file is unnecessary, this is an INIParser implementation detail that FilterStorage can take care of itself.
  • Remove isDirectory and isFile keys in IO.statFile result - these are unused, and we are only interested in files.
  • Remove calling Utils.yield() in FilterStorage, this hack is part of Firefox-specific code now.

Integration notes

  • io.js module needs to be updated to expect file name strings instead of nsIFile objects. Also, all methods should return promises instead of requiring a callback parameter.
  • Fake nsIFile implementations can be removed, these are no longer required.
  • Utils.yield() function should be removed.
  • data_directory and patternsfile preferences should be removed if they exist.

Attachments (0)

Change History (14)

comment:1 Changed on 03/30/2017 at 05:38:41 PM by trev

  • Description modified (diff)

comment:2 Changed on 04/10/2017 at 10:34:27 AM by trev

  • Description modified (diff)

comment:3 Changed on 04/10/2017 at 10:58:08 AM by trev

  • Description modified (diff)

comment:4 Changed on 04/10/2017 at 11:06:40 AM by trev

  • Description modified (diff)

comment:5 Changed on 04/10/2017 at 11:35:33 AM by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:6 Changed on 04/10/2017 at 11:40:46 AM by trev

  • Description modified (diff)
  • Review URL(s) modified (diff)
  • Status changed from reviewing to reopened

comment:7 Changed on 04/10/2017 at 11:41:27 AM by trev

  • Owner set to trev

comment:8 Changed on 04/10/2017 at 11:42:04 AM by trev

  • Description modified (diff)

comment:9 Changed on 04/10/2017 at 03:00:05 PM by trev

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

comment:10 Changed on 04/11/2017 at 02:13:24 PM by trev

  • Description modified (diff)

comment:11 Changed on 04/11/2017 at 02:28:29 PM by wspee

  • Cc wspee added

comment:12 Changed on 04/20/2017 at 07:16:19 AM by trev

  • Description modified (diff)

comment:13 Changed on 04/20/2017 at 08:19:11 AM by abpbot

A commit referencing this issue has landed:
Issue 5059 - Simplify I/O API and FilterStorage implementation

comment:14 Changed on 04/20/2017 at 08:19:48 AM by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed

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 trev.
 
Note: See TracTickets for help on using tickets.