Closed Bug 1426561 Opened 7 years ago Closed 7 years ago

TypeError: this._activeItems.elementWeakRef is undefined in FormAutofillContent.jsm when enter in urlbar

Categories

(Toolkit :: Form Autofill, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla59
Tracking Status
firefox-esr52 --- unaffected
firefox57 --- unaffected
firefox58 --- unaffected
firefox59 --- verified

People

(Reporter: magicp.jp, Assigned: selee)

References

Details

Attachments

(1 file)

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0 ID:20171220121833 Steps to reproduce: 1. Launch the latest Nightly (20171220121833) 2. Enter in urlbar Actual results: The following error is logged in the browser console. TypeError: this._activeItems.elementWeakRef is undefined FormAutofillContent.jsm:490:5 Expected results: No error Regression range: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=deb775eb35bb3e157e89646ede5416b5f00cf8ee&tochange=18c3ccc735368550df23936bf766627a1fcba487
Blocks: 1417803
Has Regression Range: --- → yes
Has STR: --- → yes
This patch fixes the two null pointer issues: 1. TypeError: this._activeItems.elementWeakRef is undefined in FormAutofillContent.jsm - when press enter key in urlbar 2. JavaScript error: resource://gre/modules/FormLikeFactory.jsm, line 109: TypeError: aField is null [1] - when focus on a field which is not marked. [1] https://searchfox.org/mozilla-central/rev/d99de806665d227ad71262933800ef6b069b230a/browser/extensions/formautofill/FormAutofillContent.jsm#449
Assignee: nobody → selee
Status: NEW → ASSIGNED
Comment on attachment 8938988 [details] Bug 1426561 - Fix the null pointer issue caused by FormAutofillContent. https://reviewboard.mozilla.org/r/209442/#review215164 ::: browser/extensions/formautofill/FormAutofillContent.jsm:479 (Diff revision 1) > element = element || formFillController.focusedInput; > let handler = this._getFormHandler(element); > if (handler) { > handler.focusedInput = element; > } > this._activeItems = { > handler, > - elementWeakRef: Cu.getWeakReference(element), > + elementWeakRef: element ? Cu.getWeakReference(element) : null, > section: handler ? handler.activeSection : null, > fieldDetail: null, > }; How about early-returning an empty object (as its initial value) if the element doesn't exist? (as I don't think we'll benefit by keeping those `null` properties in this case.) e.g. ```js if (!element) { this._activeItems = {}; return; } ```
Comment on attachment 8938988 [details] Bug 1426561 - Fix the null pointer issue caused by FormAutofillContent. https://reviewboard.mozilla.org/r/209442/#review215164 > How about early-returning an empty object (as its initial value) if the element doesn't exist? (as I don't think we'll benefit by keeping those `null` properties in this case.) e.g. > > ```js > if (!element) { > this._activeItems = {}; > return; > } > ``` Sounds good! Updated in the latest patch.
Comment on attachment 8938988 [details] Bug 1426561 - Fix the null pointer issue caused by FormAutofillContent. https://reviewboard.mozilla.org/r/209442/#review215168
Attachment #8938988 - Flags: review?(lchang) → review+
Pushed by lchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/325e9306bf09 Fix the null pointer issue caused by FormAutofillContent. r=lchang
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
This bug fix has verified in the latest Nightly build (20171229220051). Thanks!
Status: RESOLVED → VERIFIED
Depends on: 1434581
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: