Closed
Bug 691534
Opened 14 years ago
Closed 14 years ago
Use asyncFetch when loading files in aboutHome.xhtml
Categories
(Firefox for Android Graveyard :: General, defect)
Firefox for Android Graveyard
General
Tracking
(firefox9 fixed, firefox10 fixed)
RESOLVED
FIXED
Firefox 10
People
(Reporter: mfinkle, Assigned: mfinkle)
References
Details
(Keywords: perf, Whiteboard: [mobilestartupshrink][QA?])
Attachments
(1 file)
10.59 KB,
patch
|
mbrubeck
:
review+
asa
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
We are actually using sync file loading in aboutHome.xhtml - CRAZY!
This patch switches us to use asyncFetch to load the JSON data files. The patch also refactors the code to use a single _readFile method.
This should make trying to interact with Fennec easier _right_ after the home page is loaded.
Attachment #564345 -
Flags: review?(mbrubeck)
Comment 1•14 years ago
|
||
Comment on attachment 564345 [details] [diff] [review]
patch
r=mbrubeck with some minor nits:
>+ function _readFile(aFile, aCallback) {
> try {
You can probably remove the try/catch
>+ let channel = NetUtil.newChannel(aFile);
>+ channel.contentType = "application/json";
>+ NetUtil.asyncFetch(channel, function(aStream, aResult) {
>+ if (!Components.isSuccessCode(aResult)) {
>+ Cu.reportError("AboutHome: Could not read from " + aFile.leafName);
>+ aCallback(null);
>+ return;
>+ }
>
>+ let content = NetUtil.readInputStreamToString(aStream, aStream.available()) || "";
>+ aStream.close();
>+
>+ aCallback(content.replace(/\r\n?/g, "\n"));
>+ return;
No need for explicit "return" here.
>+ });
> }
> catch (ex) { Cu.reportError(ex); }
>
>- return null;
>+ aCallback(null);
> }
Remove the aCallback(null) here.
> loadFromCacheOrScheduleUpdate: function(aDelay) {
>+ let self = this;
> let file = this._getFile();
> if (file.exists()) {
>+ _readFile(file, function(aContent) {
>+ let json = JSON.parse(aContent);
>+ if (!json || json.addons.length == 0) {
>+ //noRecentTabs();
Remember to remove the commented-out line above.
Attachment #564345 -
Flags: review?(mbrubeck) → review+
Assignee | ||
Comment 2•14 years ago
|
||
Comment 3•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 10
Assignee | ||
Comment 4•14 years ago
|
||
Comment on attachment 564345 [details] [diff] [review]
patch
Cheap, local fix for reading two data files using async methods. Should reduce the "stall" that can occur after loading the phone page on phones with slow file systems (still looking at you Galaxy S)
Attachment #564345 -
Flags: approval-mozilla-aurora?
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → mark.finkle
Updated•14 years ago
|
Attachment #564345 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 5•14 years ago
|
||
We should hold off pushing this to Aurora unless bug 692767 is also fixed and approved for Aurora.
status-firefox10:
--- → fixed
status-firefox9:
--- → affected
Keywords: perf
OS: Linux → All
Hardware: x86 → All
Whiteboard: [mobilestartupshrink]
Assignee | ||
Comment 6•14 years ago
|
||
Target Milestone: Firefox 10 → Firefox 9
![]() |
||
Updated•14 years ago
|
Whiteboard: [mobilestartupshrink] → [mobilestartupshrink][QA?]
You need to log in
before you can comment on or make changes to this bug.
Description
•