Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29760680: Issue 4580 - Removed ext.storage (Closed)

Created:
April 24, 2018, 5:18 p.m. by Sebastian Noack
Modified:
April 25, 2018, 11:41 a.m.
Reviewers:
kzar
Visibility:
Public.

Description

Issue 4580 - Removed ext.storage

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -98 lines) Patch
M ext/background.js View 1 chunk +0 lines, -20 lines 0 comments Download
M lib/io.js View 3 chunks +15 lines, -50 lines 3 comments Download
M lib/prefs.js View 3 chunks +25 lines, -28 lines 3 comments Download

Messages

Total messages: 4
Sebastian Noack
April 24, 2018, 5:19 p.m. (2018-04-24 17:19:25 UTC) #1
kzar
Sorry I hoped to finish this review tonight, but I'm feeling pretty tired. This change ...
April 24, 2018, 8:38 p.m. (2018-04-24 20:38:56 UTC) #2
Sebastian Noack
https://codereview.adblockplus.org/29760680/diff/29760681/lib/io.js File lib/io.js (right): https://codereview.adblockplus.org/29760680/diff/29760681/lib/io.js#newcode35 lib/io.js:35: throw {type: "NoSuchFile"}; On 2018/04/24 20:38:56, kzar wrote: > ...
April 24, 2018, 9:12 p.m. (2018-04-24 21:12:55 UTC) #3
kzar
April 25, 2018, 10:33 a.m. (2018-04-25 10:33:39 UTC) #4
LGTM

https://codereview.adblockplus.org/29760680/diff/29760681/lib/io.js
File lib/io.js (right):

https://codereview.adblockplus.org/29760680/diff/29760681/lib/io.js#newcode35
lib/io.js:35: throw {type: "NoSuchFile"};
On 2018/04/24 21:12:55, Sebastian Noack wrote:
> On 2018/04/24 20:38:56, kzar wrote:
> > Don't we normally throw an Error instance? (I get the feeling you know what
> > you're doing here, so I'm not saying this is wrong. Just kinda curious,
since
> > I've not seen throw used like this before.)
> 
> Yeah, I had a similar WTF moment when I converted this code, but didn't feel
> like doing an unrelated change here.
> 
> FWIW you can throw any kind of value (or reject a promise with any kind of
> value). It will just be passed through to any catch statement (or error
callback
> attached to the promise). There is nothing special about Error objects in
> JavaScript (other than that they have a traceback attached).
> 
> Its of course good practice to use Error objects to indicate an error, but
then
> I have to also change the code that detects non existing files, and adding a
> custom property to the error object might not be much better. If we want to do
> that properly we would just resolve the promise with null if the file does not
> exist, but then I have to change even more. 

Acknowledged.

https://codereview.adblockplus.org/29760680/diff/29760681/lib/prefs.js
File lib/prefs.js (right):

https://codereview.adblockplus.org/29760680/diff/29760681/lib/prefs.js#newcod...
lib/prefs.js:336: (error) =>
On 2018/04/24 21:12:55, Sebastian Noack wrote:
> This callback is removed with the next patch anyway.

Ah right, well it's not a big deal then.

Powered by Google App Engine
This is Rietveld