Opened 2 years ago

Closed 2 years ago

#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.

Change History (14)

comment:1 Changed 2 years ago by trev

  • Description modified (diff)

comment:2 Changed 2 years ago by trev

  • Description modified (diff)

comment:3 Changed 2 years ago by trev

  • Description modified (diff)

comment:4 Changed 2 years ago by trev

  • Description modified (diff)

comment:5 Changed 2 years ago by trev

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

comment:6 Changed 2 years ago by trev

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

comment:7 Changed 2 years ago by trev

  • Owner set to trev

comment:8 Changed 2 years ago by trev

  • Description modified (diff)

comment:9 Changed 2 years ago by trev

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

comment:10 Changed 2 years ago by trev

  • Description modified (diff)

comment:11 Changed 2 years ago by wspee

  • Cc wspee added

comment:12 Changed 2 years ago by trev

  • Description modified (diff)

comment:13 Changed 2 years ago by abpbot

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

comment:14 Changed 2 years ago by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.