Closed
Bug 993904
Opened 11 years ago
Closed 10 years ago
Use cached directory links instead of locally packaged links
Categories
(Firefox :: New Tab Page, defect)
Firefox
New Tab Page
Tracking
()
VERIFIED
FIXED
Firefox 32
People
(Reporter: Mardak, Assigned: mzhilyaev)
References
Details
(Whiteboard: p=0 s=it-32c-31a-30b.3 [qa-])
Attachments
(1 file, 5 obsolete files)
8.04 KB,
patch
|
Details | Diff | Splinter Review |
Bug 986521 implements fetching and caching of remotely hosted links, and this bug will be to use those links and stop using the packaged links.
Reporter | ||
Updated•11 years ago
|
Flags: firefox-backlog?
Reporter | ||
Updated•11 years ago
|
Flags: firefox-backlog? → firefox-backlog+
Comment 1•11 years ago
|
||
adw commented on a related bug975211 that we should be using OS.File if we are to read from a local file.
This involves the modification of DirectoryLinksProvider.jsm.
If no file is found, or the file cannot be read, DirectoryLinksProvider should return no link upon getLinks() invocation.
Reporter | ||
Comment 2•11 years ago
|
||
In the case of no links then later remotely fetched links, we'll probably need to call Links.populateCache or Links.resetCache. This resetting functionality should maybe exist in bug 986521 after a successful fetch?
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → mzhilyaev
Reporter | ||
Updated•11 years ago
|
Whiteboard: p=5
Updated•11 years ago
|
Status: NEW → ASSIGNED
Whiteboard: p=5 → p=5 s=it-31c-30a-29b.3 [qa?]
Whiteboard: p=5 s=it-31c-30a-29b.3 [qa?] → p=5 s=it-31c-30a-29b.3 [qa-]
Updated•11 years ago
|
Whiteboard: p=5 s=it-31c-30a-29b.3 [qa-] → p=5 s=it-32c-31a-30b.1 [qa-]
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8414577 -
Flags: review?(adw)
Comment 4•11 years ago
|
||
Comment on attachment 8414577 [details] [diff] [review]
v1. Read directory links from cached file.
Review of attachment 8414577 [details] [diff] [review]:
-----------------------------------------------------------------
This looks fine, but I'd like to reserve r+ until I see how the other patches shake out (plus the promise question I have below). I'll leave the r? for now.
::: toolkit/modules/DirectoryLinksProvider.jsm
@@ +229,5 @@
> },
>
> /**
> + * Reads directory links file and parses its content
> + * @param retruns a promise resolved to valid json or []
retruns -> returns
Also, it's more correct to say "a valid list of links" since JSON is a string encoding of an object and not the object itself. Call me pedantic. :-)
@@ +231,5 @@
> /**
> + * Reads directory links file and parses its content
> + * @param retruns a promise resolved to valid json or []
> + */
> + _readDirectoryLinksFile: function DirectoryLinksProvider_readDirectoryLinksFile(aCallback) {
Not a big deal, but these recent patches uses promises instead of callbacks, so why not be consistent here?
Assignee | ||
Comment 5•11 years ago
|
||
misspellings are fixed.
Tried refactoring _readDirectoryLinksFile() with a promise and decided against it:
the code came out more bulky without any obvious advantages in clarity.
However, if you feel strongly for the promise I will be happy to refactor it again.
Attachment #8419743 -
Flags: review?(adw)
Comment 6•11 years ago
|
||
Comment on attachment 8419743 [details] [diff] [review]
v2. Read directory links from cached file
Review of attachment 8419743 [details] [diff] [review]:
-----------------------------------------------------------------
(In reply to maxim zhilyaev from comment #5)
> However, if you feel strongly for the promise I will be happy to refactor it
> again.
Nope, no problem, thanks for trying. Although isn't the only thing you'd need to do is to replace the three aCallback() calls with deferred.resolve() (plus creating the deferred at the beginning and returning its promise at the end)? Anyhow, no big deal.
Attachment #8419743 -
Flags: review?(adw) → review+
Updated•11 years ago
|
Attachment #8414577 -
Attachment is obsolete: true
Attachment #8414577 -
Flags: review?(adw)
Assignee | ||
Comment 7•11 years ago
|
||
Attachment #8419743 -
Attachment is obsolete: true
Updated•11 years ago
|
Whiteboard: p=5 s=it-32c-31a-30b.1 [qa-] → p=5 s=it-32c-31a-30b.2 [qa-]
Comment 8•11 years ago
|
||
Removed from iteration. Will be tracked the same way we track "non-regular" contributions from the community.
Whiteboard: p=5 s=it-32c-31a-30b.2 [qa-] → p=0 [qa-]
Updated•11 years ago
|
Component: Tabbed Browser → New Tab Page
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #8421050 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Attachment #8426544 -
Attachment description: v1.1 rebased onto bug993901 → v3 rebased onto bug993901
Assignee | ||
Updated•11 years ago
|
Attachment #8426544 -
Attachment description: v3 rebased onto bug993901 → v3.1 rebased onto bug993901
Reporter | ||
Comment 10•10 years ago
|
||
Comment on attachment 8426544 [details] [diff] [review]
v3.1 rebased onto bug993901
>diff --git a/toolkit/modules/DirectoryLinksProvider.jsm b/toolkit/modules/DirectoryLinksProvider.jsm
> /**
>+ * Reads directory links file and parses its content
>+ * @param returns a promise resolved to valid list of links or []
This still says it returns a promise even though it takes a callback. But I think the code could actually be simplified with a promise. See below.
>+ _readDirectoryLinksFile: function DirectoryLinksProvider_readDirectoryLinksFile(aCallback) {
>+ try {
This try/catch block shouldn't be necessary. OS.File.read uses promises to reject failures, so this shouldn't throw.
>+ OS.File.read(this._directoryFilePath).then(binaryData => {
We should be returning the promise returned by the then(), so we don't need to create our own explicit promise.
>+ let output;
>+ try {
>+ let locale = this.locale;
>+ let json = gTextDecoder.decode(binaryData);
>+ output = JSON.parse(json)[locale];
>+ }
>+ catch (e) {
>+ Cu.reportError(e);
>+ }
>+ aCallback(output || []);
return output || [];
That'll have the promise returned by then resolve to output or [].
>+ },
>+ error => {
>+ Cu.reportError(error);
>+ aCallback([]);
return [];
>+ });
>+ }
>+ catch (e) {
>+ Cu.reportError("failed to read " + directoryLinksFile);
>+ aCallback([]);
>+ }
>+ },
As above, this catch is unnecessary.
Assignee | ||
Comment 11•10 years ago
|
||
Attachment #8426544 -
Attachment is obsolete: true
Reporter | ||
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 32
Updated•10 years ago
|
Status: RESOLVED → VERIFIED
Whiteboard: p=0 [qa-] → p=0 s=it-32c-31a-30b.3 [qa-]
I had to back this out in https://hg.mozilla.org/mozilla-central/rev/3689163e72a8 because it depended on changes made in bug 993901, which I just backed out for bustage.
Status: VERIFIED → REOPENED
Flags: needinfo?(mzhilyaev)
Resolution: FIXED → ---
Assignee | ||
Comment 15•10 years ago
|
||
Fix to intermittent failures in browser_tabopen_reflows.js
Repopulating newtab cache on change to directory source pref fixes the failure.
re-triggered on try server 4 times - all green
Attachment #8428410 -
Attachment is obsolete: true
Reporter | ||
Comment 16•10 years ago
|
||
Flags: needinfo?(mzhilyaev)
Comment 17•10 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
Resolution: --- → FIXED
Updated•10 years ago
|
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•