Closed
Bug 967324
Opened 12 years ago
Closed 11 years ago
Use promise to wrap db accesses in Reader mode
Categories
(Firefox for Android Graveyard :: Reader View, defect)
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1087722
People
(Reporter: tetsuharu, Assigned: tetsuharu)
Details
Attachments
(1 file, 1 obsolete file)
11.37 KB,
patch
|
Details | Diff | Splinter Review |
After bug 918806 landed, We're able to use DOM Promise.
So I think we can refactor the function which request data (e.g. Reader.getArticleFromCache()).
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → saneyuki.s.snyk
Assignee | ||
Updated•12 years ago
|
Summary: Use promise in Reader mode → Use promise to wrap db accesses in Reader mode
Comment 2•12 years ago
|
||
Can you explain the benefit of this patch? In general, we don't like to accept patches that refactor things without some clear gain (performance, ease of adding some new logic, etc.).
Flags: needinfo?(saneyuki.s.snyk)
Assignee | ||
Comment 3•12 years ago
|
||
(In reply to :Margaret Leibovic from comment #2)
> Can you explain the benefit of this patch? In general, we don't like to
> accept patches that refactor things without some clear gain (performance,
> ease of adding some new logic, etc.).
I think we get these by this change.
* Separate handling on success/error obviously. `Promise` represents the abstraction container which will fulfill with a result and provide handling points. This change can move some codes for error handling (e.g. http://hg.mozilla.org/mozilla-central/file/262e73a6b7cd/mobile/android/chrome/content/browser.js#l7691) to a part of obvious error handling.
* Stop to passing callbacks as a function's parameter. Each API gets only parameters which its really needs. However, I agree this might be mindset.
BTW, I found some point that I can polish in the patch. I'll modify it.
Flags: needinfo?(saneyuki.s.snyk)
Assignee | ||
Comment 4•12 years ago
|
||
Update to the patch v2.
Attachment #8371535 -
Attachment is obsolete: true
Attachment #8371535 -
Flags: review?(margaret.leibovic)
Attachment #8372304 -
Flags: review?(margaret.leibovic)
Comment 5•12 years ago
|
||
Comment on attachment 8372304 [details] [diff] [review]
patch v2
Review of attachment 8372304 [details] [diff] [review]:
-----------------------------------------------------------------
I would feel more comfortable with this patch if we had some tests to go with it. I think we should see if we can add some basic unit-style tests for getArticleFromCache/storeArticleInCache/removeArticleFromCache. We can use roboextender to write tests that run chrome JS, so maybe we can use that to call into those Reader methods.
You can look in here for some examples:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/roboextender/
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/testHomeBanner.java
::: mobile/android/chrome/content/browser.js
@@ +7682,5 @@
> callback(null);
> }
> },
>
> + getArticleFromCache: function Reader_getArticleFromCache(url) {
This would be a good opportunity to add some documentation explaining what this returns.
Comment 6•12 years ago
|
||
Comment on attachment 8372304 [details] [diff] [review]
patch v2
Clearing review until there's at least some really basic test coverage.
Attachment #8372304 -
Flags: review?(margaret.leibovic)
Assignee | ||
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•