Closed
Bug 1095411
Opened 10 years ago
Closed 10 years ago
PlacesUtils.wrapNode is using synchronous getKeywordForBookmark
Categories
(Toolkit :: Places, defect)
Toolkit
Places
Tracking
()
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: mak, Assigned: mak)
References
(Depends on 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
33.27 KB,
patch
|
Details | Diff | Splinter Review |
We could leave this issue to a later time, the problem is that we likely cannot make wrapNode async...
Flags: qe-verify-
Flags: firefox-backlog+
Comment 1•10 years ago
|
||
Once PT is on we can do away with that. The new Move and Copy transactions rely merely on the itemGuid property, ignoring everything else.
Updated•10 years ago
|
Points: 8 → 2
Assignee | ||
Comment 2•10 years ago
|
||
I'm honestly uncertain this will be SO easy, cause D&D is involved that means manual testing of a bunch of cases. let's say 3, even I'd be more for 5.
Points: 2 → 3
Assignee | ||
Updated•10 years ago
|
No longer blocks: placesAsyncBookmarks
Updated•10 years ago
|
Iteration: --- → 40.3 - 11 May
Assignee | ||
Comment 4•10 years ago
|
||
I'm sorry, this one may not be easy to review, cause I preferred refactoring this piece of code. There's a reason though.
Once upon a time, wrapNode was shared code used by copy&paste, drag&drop, sync, html exports, json backups.
Slowly we moved to better solutions and today the code is only used for copy&paste and drag&drop.
When I converted the export/json code, I didn't bother touching this code cause the patches were large enough.
But that means the code is doing far more than we need for just copy&paste and drag&drop
1. it doesn't need to mark roots
2. it doesn't need the charset (cause they are uri bound and the uri never goes away, so it never gets lost)
3. it doesn't need the keywords (same reason as the charset)
4. it doesn't need tens of sub functions calls
5. it's non-trivial-at-all to make this async, so the smaller the better
Additionally, when we will move to PlacesTransactions, it won't even need to collect children of containers. It doesn't indeed make sense to collect all children of a folder, just to move it around... Even when copying, the folder id is enough to find its children. PlacesTransactions use promiseBookmarksTree.
Due to the removal of .children, I had to add a small hack to the PlacesUIUtils code, to fetch children when needed. I tried to limit changes there.
I preferred to hack PlacesUIUtils rather than keeping .children, cause this hack will go away when we enable new transactions, and we'll be fine already.
So, based on this, I could simplify a lot the wrapNode code, it's about half the size.
Finally while testing the patch through the UI, I found an existing bug with tag containers, I filed Bug 1160193 and for now I've just added a workaround to disallow dangerous operation on title-less tags.
Attachment #8599937 -
Flags: review?(ttaubert)
Assignee | ||
Comment 5•10 years ago
|
||
Assignee | ||
Comment 6•10 years ago
|
||
Just an unbitrot
Attachment #8599937 -
Attachment is obsolete: true
Attachment #8599937 -
Flags: review?(ttaubert)
Attachment #8604127 -
Flags: review?(ttaubert)
Updated•10 years ago
|
Iteration: 40.3 - 11 May → 41.1 - May 25
Comment 7•10 years ago
|
||
Comment on attachment 8604127 [details] [diff] [review]
patch v1.1
Review of attachment 8604127 [details] [diff] [review]:
-----------------------------------------------------------------
Very tricky to review... didn't see any red flags. Guess we should do some manual testing too for it?
::: browser/components/places/PlacesUIUtils.jsm
@@ +212,5 @@
> + PlacesUtils.LMANNO_FEEDURI);
> + let node = PlacesUtils.unwrapNodes(
> + PlacesUtils.wrapNode(child, PlacesUtils.TYPE_X_MOZ_PLACE, isLivemark),
> + PlacesUtils.TYPE_X_MOZ_PLACE
> + ).shift();
Maybe: let [node] = PlacesUtils.unwrapNodes(...);
@@ +253,3 @@
> let transactions = [];
> + if (!aData.livemark && aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) {
> + let root = PlacesUtils.getFolderContents(aData.id, false, false).root;
Can be fancy here too:
let {root} = PlacesUtils.getFolderContents(aData.id, false, false);
@@ +267,5 @@
> if (aData.livemark && aData.annos) { // Copying a livemark.
> return this._getLivemarkCopyTransaction(aData, aContainer, aIndex);
> }
>
> + let root = PlacesUtils.getFolderContents(aData.id, false, false).root;
let {root} = PlacesUtils.getFolderContents(aData.id, false, false);
::: toolkit/components/places/PlacesUtils.jsm
@@ +148,5 @@
> + data.dateAdded = aNode.dateAdded;
> + data.lastModified = aNode.lastModified;
> +
> + let annos = PlacesUtils.getAnnotationsForItem(data.id);
> + if (annos.length != 0)
Nit: maybe if (annos.length > 0) ?
@@ +158,5 @@
> + NetUtil.newURI(aNode.uri);
> +
> + // Tag root accepts only folder nodes.
> + if (data.parent == PlacesUtils.tagsFolderId)
> + throw new Error("Unexpected node type");
Are the comment, condition, and error message in sync? Maybe I'm just not following it well enough. Feel free to ignore if so.
@@ +186,5 @@
> + data.type = PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER;
> + }
> + }
> + else {
> + // This is a grouped container query, dinamically generated.
Nit: dynamically
@@ +594,5 @@
> + // escape out potential HTML in the title
> + let escapedTitle = node.title ? htmlEscape(node.title) : "";
> +
> + if (aFeedURI) {
> + return "<A HREF=\"" + aFeedURI + "\">" + escapedTitle + "</A>" + NEWLINE;
Could use a template string.
@@ +616,5 @@
> + node.containerOpen = wasOpen;
> + return childString + "</DL>" + NEWLINE;
> + }
> + if (PlacesUtils.nodeIsURI(node))
> + return "<A HREF=\"" + node.uri + "\">" + escapedTitle + "</A>" + NEWLINE;
Template string?
Attachment #8604127 -
Flags: review?(ttaubert) → review+
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8604127 -
Attachment is obsolete: true
Comment 10•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•