Closed
Bug 298841
Opened 19 years ago
Closed 19 years ago
JS error: "less0 has no properties" and first lessButton in edit virtual folder not fully functional
Categories
(MailNews Core :: Filters, defect)
MailNews Core
Filters
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: whimboo, Assigned: whimboo)
References
Details
Attachments
(1 file, 5 obsolete files)
4.31 KB,
patch
|
whimboo
:
review+
neil
:
superreview+
cbeard
:
approval-aviary1.1a2+
cbeard
:
approval1.8b3+
|
Details | Diff | Splinter Review |
Opening the dialog for editing virtual folders shows following js error: Error: document.getElementById("less0") has no properties Source File: chrome://messenger/content/virtualFolderProperties.js Line: 112 Also the disabled state of the lessButton is not updated correctly due to the missing property disabled. Patch is on the way.
Assignee | ||
Comment 1•19 years ago
|
||
This patch adds the missing ids to the lessButtons and sets their disabled state over setAttribute due to the missing property.
Assignee | ||
Updated•19 years ago
|
Summary: JS error: "less0 has no properties" and lessButton not functional → JS error: "less0 has no properties" and first lessButton not fully functional
Assignee | ||
Updated•19 years ago
|
Summary: JS error: "less0 has no properties" and first lessButton not fully functional → JS error: "less0 has no properties" and first lessButton in edit virtual folder not fully functional
Assignee | ||
Comment 2•19 years ago
|
||
Same like patch v1 but with updated comment for function updateRemoveRowButton
Attachment #187357 -
Attachment is obsolete: true
Attachment #187359 -
Flags: review?(mnyromyr)
Assignee | ||
Updated•19 years ago
|
Attachment #187357 -
Flags: review?(mnyromyr)
Assignee | ||
Comment 3•19 years ago
|
||
Ok, I simplified the patch a lot. We shouldn't add an id for each button. If the user removes e.g. the first button we would run into trouble because id="less0" doesn't exist anymore. This fix also fixes this part.
Assignee | ||
Updated•19 years ago
|
Attachment #187359 -
Attachment is obsolete: true
Attachment #187426 -
Flags: review?(mnyromyr)
Assignee | ||
Updated•19 years ago
|
Attachment #187359 -
Flags: review?(mnyromyr)
Assignee | ||
Comment 4•19 years ago
|
||
Attachment #187426 -
Attachment is obsolete: true
Attachment #187427 -
Flags: review?(mnyromyr)
Assignee | ||
Updated•19 years ago
|
Attachment #187426 -
Flags: review?(mnyromyr)
Comment 5•19 years ago
|
||
Comment on attachment 187427 [details] [diff] [review] the correct patch v3 >Index: mailnews/base/search/resources/content/searchTermOverlay.js >=================================================================== >- firstListItem.lastChild.lastChild.lastChild.disabled = gTotalSearchTerms == 1; >+ firstListItem.lastChild.lastChild.lastChild.setAttribute("disabled", gTotalSearchTerms == 1); Strangely enough, the disabled property really doesn't work, so the setAttribute is needed! I wonder if something's broken there... > function getSearchRowIndexForElement(aElement) > { > var listitem = aElement; > while (listitem) >-{ >+ { > if (listitem.localName == "listitem") > break; > listitem = listitem.parentNode; > } > > return gSearchTermList.getIndexOfItem(listitem); You could write that as var listitem; for (listitem = aElement; listitem && listitem.localName == "listitem"; listitem = listitem.parentNode); return gSearchTermList.getIndexOfItem(listitem); (if you like). > function onLess(event) > { > if (gTotalSearchTerms > 1) > { >- var rowIndex; >- if (event) >-{ >+ if (event) >+ { > removeSearchRow(getSearchRowIndexForElement(event.target)); > --gTotalSearchTerms; > } > } It'd be shorter to say if (event && gTotalSearchTerms > 1) r=me with the onLess nit fixed. And please fix the JavaScript strict warning: chrome://messenger/content/searchTermOverlay.js, line 198: assignment to undeclared variable i and the broken indentation there for bonus points, while your at it. ;-)
Attachment #187427 -
Flags: review?(mnyromyr) → review+
Assignee | ||
Comment 6•19 years ago
|
||
(In reply to comment #5) > You could write that as > > var listitem; > for (listitem = aElement; > listitem && listitem.localName == "listitem"; > listitem = listitem.parentNode); > return gSearchTermList.getIndexOfItem(listitem); That's not true. If you use that, no listitem will be returned. You have to execute the for loop while "listitem.localName != "listitem"). But I won't use that, it looks a little bit complex. So I modified the while loop to fetch your mentioned way. > r=me with the onLess nit fixed. And please fix the Carrying over r with that fixes. > JavaScript strict warning: chrome://messenger/content/searchTermOverlay.js, > line 198: assignment to undeclared variable i Finally done.
Attachment #187427 -
Attachment is obsolete: true
Attachment #187755 -
Flags: review+
Comment 7•19 years ago
|
||
Eww, a typo :((
Assignee | ||
Updated•19 years ago
|
Attachment #187427 -
Flags: review+
Assignee | ||
Updated•19 years ago
|
Attachment #187755 -
Flags: superreview?(hex226)
Assignee | ||
Updated•19 years ago
|
Attachment #187755 -
Flags: superreview?(hex226) → superreview?(bienvenu)
Comment 8•19 years ago
|
||
Comment on attachment 187755 [details] [diff] [review] patch v4 Neil can probably say what's going on with the enabled/disabled attribute.
Attachment #187755 -
Flags: superreview?(bienvenu) → superreview?(neil.parkwaycc.co.uk)
Comment 9•19 years ago
|
||
Comment on attachment 187755 [details] [diff] [review] patch v4 >- for (i = 0; i < searchTerms.Count(); i++) { >+ for (var i = 0; i < searchTerms.Count(); i++) { Odd, I wonder why my build isn't whining about this. >- firstListItem.lastChild.lastChild.lastChild.disabled = gTotalSearchTerms == 1; >+ firstListItem.lastChild.lastChild.lastChild.setAttribute("disabled", gTotalSearchTerms == 1); Ah, of course, I forgot that .disabled doesn't work for a newly created element. Sigh :-[ >- if (gTotalSearchTerms > 1) >+ if (event && gTotalSearchTerms > 1) > { >- var rowIndex; >- if (event) >-{ >- removeSearchRow(getSearchRowIndexForElement(event.target)); >- --gTotalSearchTerms; >- } >+ removeSearchRow(getSearchRowIndexForElement(event.target)); >+ --gTotalSearchTerms; If you thought this was bad, mscott's original patch was worse. > initializeSearchRows(nsMsgSearchScope.offlineMail, aSearchTerms); >- if (aSearchTerms.Count() == 1) >- document.getElementById("less0").setAttribute("disabled", "true"); >+ updateRemoveRowButton(); Doesn't initializeSearchRows already call updateRemoveRowButton? > } > else > onMore(null, 0); This should just be onMore(null) now.
Assignee | ||
Comment 10•19 years ago
|
||
(In reply to comment #9) > > initializeSearchRows(nsMsgSearchScope.offlineMail, aSearchTerms); > >- if (aSearchTerms.Count() == 1) > >- document.getElementById("less0").setAttribute("disabled", "true"); > >+ updateRemoveRowButton(); > Doesn't initializeSearchRows already call updateRemoveRowButton? Uuh, you are right. I removed the crap. > This should just be onMore(null) now. Fixed. I also updated the function onMore(event). gSearchTermList.getRowCount() is called every time also when it's not needed by an event. In that case we save a function call every time when a search term is added.
Assignee | ||
Updated•19 years ago
|
Attachment #187755 -
Attachment is obsolete: true
Attachment #187829 -
Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #187829 -
Flags: review+
Assignee | ||
Updated•19 years ago
|
Attachment #187755 -
Flags: superreview?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 11•19 years ago
|
||
I believe this bug should be fixed now? I hope we could checkin the fix ASAP. Only the sr is missing.
Component: Search → MailNews: Filters
Flags: blocking1.8b3?
Flags: blocking-aviary1.1?
Comment 12•19 years ago
|
||
Comment on attachment 187829 [details] [diff] [review] patch v5 with all mentioned changes I noticed that the title of the virtual properties dialog for an existing saved search isn't set correctly, is there already a bug open for this?
Attachment #187829 -
Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Assignee | ||
Comment 13•19 years ago
|
||
(In reply to comment #12) > I noticed that the title of the virtual properties dialog for an existing saved > search isn't set correctly, is there already a bug open for this? Yes, this is covered by bug 294407.
Assignee | ||
Updated•19 years ago
|
Attachment #187829 -
Flags: approval1.8b3?
Attachment #187829 -
Flags: approval-aviary1.1a2?
Comment 14•19 years ago
|
||
Comment on attachment 187829 [details] [diff] [review] patch v5 with all mentioned changes a=cbeard, let's get this landed ASAP to make 1.8b3
Attachment #187829 -
Flags: approval1.8b3?
Attachment #187829 -
Flags: approval1.8b3+
Attachment #187829 -
Flags: approval-aviary1.1a2?
Attachment #187829 -
Flags: approval-aviary1.1a2+
Updated•19 years ago
|
Flags: blocking1.8b3? → blocking1.8b3+
Comment 15•19 years ago
|
||
Checking in searchTermOverlay.js; /cvsroot/mozilla/mailnews/base/search/resources/content/searchTermOverlay.js,v <-- searchTermOverlay.js new revision: 1.43; previous revision: 1.42 done Checking in virtualFolderProperties.js; /cvsroot/mozilla/mailnews/base/resources/content/virtualFolderProperties.js,v <-- virtualFolderProperties.js new revision: 1.11; previous revision: 1.10 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Flags: blocking1.8b3+ → blocking1.8b3?
Resolution: --- → FIXED
Comment 16•19 years ago
|
||
cbeard: sorry for killing that blocking flag! :( But it's irrelevant now anyway. :)
Flags: blocking1.8b3?
Assignee | ||
Updated•19 years ago
|
Status: RESOLVED → VERIFIED
Flags: blocking-aviary1.1?
Updated•16 years ago
|
Product: Core → MailNews Core
You need to log in
before you can comment on or make changes to this bug.
Description
•