Closed Bug 791093 Opened 12 years ago Closed 8 years ago

optimize and consolidate searching for the wanted ID in the pageElements array in AccountManager.js

Categories

(MailNews Core :: Account Manager, defect)

defect
Not set
trivial

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 51.0

People

(Reporter: aceman, Assigned: aceman)

References

Details

Attachments

(1 file, 1 obsolete file)

+++ This bug was initially created as a clone of Bug #577775 comment 44 +++

Mike Conley (:mconley) 2012-09-13 18:05:31 CEST 
::: mailnews/base/prefs/content/AccountManager.js
> +  // Check the new value of the server.localPath field for validity.
> +  for (let i = 0; i < pageElements.length; i++) {
Instead of iterating through the pageElements, can't you use document.getElementById, or querySelector?

There are about 3 loops like this that just look for a specific ID and then check the value of the corresponding accountValues[] and pageElements[] arrays. Let's try to consolidate this into some wrapper functions that hides the implementation details of how to find the ID and also may be faster without looping over the array, e.g. like:
top.frames["contentFrame"].document.querySelector("#server.localPath[wsm_persist='true']") ...
Summary: Invalid account directory path to folders should raise an error dialog/verify setting, not just log in error console → optimize and consolidate searching for the wanted ID in the pageElements array in AccountManager.js
Depends on: 525024
Status: NEW → ASSIGNED
Attached patch patch v2Splinter Review
Removed unrelated changes that belong in another bug.
Attachment #8776189 - Attachment is obsolete: true
Attachment #8776189 - Flags: review?(mkmelin+mozilla)
Attachment #8776203 - Flags: review?(mkmelin+mozilla)
Attachment #8776203 - Flags: review?(mkmelin+mozilla) → review+
https://hg.mozilla.org/comm-central/rev/c23005eea70868e2031e9e0a35c389cc3b00559c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 51.0
Depends on: 1293408
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: