Closed
Bug 1222797
Opened 10 years ago
Closed 10 years ago
listbox.selectedItems is a ChromeNodeList since bug 120684
Categories
(Thunderbird :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 45.0
People
(Reporter: aleth, Assigned: aleth)
References
Details
Attachments
(3 files, 2 obsolete files)
|
13.32 KB,
patch
|
aleth
:
review+
|
Details | Diff | Splinter Review |
|
27.19 KB,
patch
|
philip.chee
:
review+
|
Details | Diff | Splinter Review |
|
4.01 KB,
patch
|
philip.chee
:
review+
|
Details | Diff | Splinter Review |
Fix the usages of listbox.selectedItems in c-c.
| Assignee | ||
Updated•10 years ago
|
| Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8684652 -
Flags: review?(mkmelin+mozilla)
| Assignee | ||
Updated•10 years ago
|
Assignee: nobody → aleth
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•10 years ago
|
||
| Assignee | ||
Updated•10 years ago
|
Attachment #8684652 -
Attachment is obsolete: true
Attachment #8684652 -
Flags: review?(mkmelin+mozilla)
| Assignee | ||
Comment 3•10 years ago
|
||
Comment on attachment 8684652 [details] [diff] [review]
Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684
Didn't want this r? to be cancelled, it's just bzexport being annoying.
Attachment #8684652 -
Attachment is obsolete: false
Attachment #8684652 -
Flags: review?(mkmelin+mozilla)
| Assignee | ||
Updated•10 years ago
|
Attachment #8684654 -
Flags: review?(iann_bugzilla)
Comment 4•10 years ago
|
||
Comment on attachment 8684654 [details] [diff] [review]
Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684, suite/ part
The large amount of whitespace changes makes this patch hard to review. Please leave off all the whitespace changes or put them in a separate patch.
> - var languages = aListbox.selectedItems;
> - var addedLang = Array.map(languages, function(e) { return e.value; });
> + var languages = [...aListbox.selectedItems];
> + var addedLang = languages.map(function(e) { return e.value; });
This appears to be unnecessary.
> function awKeyDown(event, listboxElement)
> {
> switch(event.keyCode) {
> case KeyEvent.DOM_VK_DELETE:
> case KeyEvent.DOM_VK_BACK_SPACE:
> /* Warning, the listboxElement.selectedItems will change everytime we delete a row */
> - var selItems = listboxElement.selectedItems;
Good catch. You can keep this change but nuke all the whitespace adjustments please!
> - .forEach(this.selectedItems.push, this.selectedItems);
> + .forEach(this.selectedItems.append, this.selectedItems);
OK.
> function onShowAttachmentContextMenu()
> {
> // if no attachments are selected, disable the Open and Save...
> var attachmentList = document.getElementById('attachmentList');
> - var selectedAttachments = attachmentList.selectedItems;
> + var selectedAttachments = [...attachmentList.selectedItems];
OK.
> function handleAttachmentSelection(commandPrefix)
> {
> var attachmentList = document.getElementById('attachmentList');
> - var selectedAttachments = attachmentList.selectedItems;
> + var selectedAttachments = [...attachmentList.selectedItems];
OK
review- needs a new patch without the whitespace only changes.
Attachment #8684654 -
Flags: review?(iann_bugzilla) → review-
Comment 5•10 years ago
|
||
Comment on attachment 8684652 [details] [diff] [review]
Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684
> - list.selectedItems.length = 0;
> + while (list.selectedItems.length) {
> + let item = list.selectedItems[0];
> + item.selected = false;
Why?
> + list.selectedItems.remove(item);
Uh? Try this:
while(list.selectedItems.lastChild) {
list.selectedItems.lastChild.remove();
}
Comment 6•10 years ago
|
||
> - list.selectedItems.length = 0;
> + while (list.selectedItems.length) {
> + let item = list.selectedItems[0];
> + item.selected = false;
> + list.selectedItems.remove(item);
I read the code in Bug 120684 again. I think you can do:
while (list.selectedItems.length) {
list.removeItemFromSelection(list.selectedItems[0]);
}
Comment 7•10 years ago
|
||
Comment on attachment 8684652 [details] [diff] [review]
Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684
Review of attachment 8684652 [details] [diff] [review]:
-----------------------------------------------------------------
::: mail/base/content/msgHdrViewOverlay.js
@@ +2570,5 @@
> function HandleSelectedAttachments(action)
> {
> let attachmentList = document.getElementById("attachmentList");
> let selectedAttachments = [];
> + for (let item of attachmentList.selectedItems)
please add braces for the loop while you're here
@@ +2682,5 @@
> + while (list.selectedItems.length) {
> + let item = list.selectedItems[0];
> + item.selected = false;
> + list.selectedItems.remove(item);
> + }
go with Philip's suggestion if that works out
Attachment #8684652 -
Flags: review?(mkmelin+mozilla) → review+
| Assignee | ||
Comment 8•10 years ago
|
||
| Assignee | ||
Comment 9•10 years ago
|
||
| Assignee | ||
Comment 10•10 years ago
|
||
| Assignee | ||
Updated•10 years ago
|
Attachment #8684652 -
Attachment is obsolete: true
| Assignee | ||
Updated•10 years ago
|
Attachment #8684654 -
Attachment is obsolete: true
| Assignee | ||
Comment 11•10 years ago
|
||
(In reply to Philip Chee from comment #6)
> > - list.selectedItems.length = 0;
> > + while (list.selectedItems.length) {
> > + let item = list.selectedItems[0];
> > + item.selected = false;
> > + list.selectedItems.remove(item);
>
> I read the code in Bug 120684 again. I think you can do:
>
> while (list.selectedItems.length) {
> list.removeItemFromSelection(list.selectedItems[0]);
> }
I did list.clearSelection(), it seems the most future-proof.
| Assignee | ||
Updated•10 years ago
|
Attachment #8684701 -
Flags: review+
| Assignee | ||
Updated•10 years ago
|
Attachment #8684702 -
Flags: review?(philip.chee)
| Assignee | ||
Updated•10 years ago
|
Attachment #8684703 -
Flags: review?(philip.chee)
Updated•10 years ago
|
Attachment #8684702 -
Flags: review?(philip.chee) → review+
Comment 12•10 years ago
|
||
Comment on attachment 8684703 [details] [diff] [review]
Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684, suite/ part
Also a=me for SeaMonkey bustage fix CLOSED TREE
Attachment #8684703 -
Flags: review?(philip.chee) → review+
| Assignee | ||
Comment 13•10 years ago
|
||
https://hg.mozilla.org/comm-central/rev/88072f1a437435dea3fa6498679ee7479d2a2615
Bug 1222797 - Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684. r=mkmelin
https://hg.mozilla.org/comm-central/rev/22aefa4709d1c9cb1d7a40f9fc54d9aeb388b407
Bug 1222797 - Remove some gratuitous whitespace from suite/. r=IanN
https://hg.mozilla.org/comm-central/rev/554c45f6c0787943d71beb48fafe67665a67d59a
Bug 1222797 - Fix usage of listbox.selectedItems, which is a ChromeNodeList since bug 120684, suite/ part. r=philip.chee a=bustage fix CLOSED TREE DONTBUILD
| Assignee | ||
Updated•10 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 45.0
You need to log in
before you can comment on or make changes to this bug.
Description
•