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

VERIFIED FIXED in Firefox 59

Status

()

defect
VERIFIED FIXED
2 years ago
Last year

People

(Reporter: magicp.jp, Assigned: selee)

Tracking

Trunk
mozilla59
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 unaffected, firefox57 unaffected, firefox58 unaffected, firefox59 verified)

Details

Attachments

(1 attachment)

Reporter

Description

2 years ago
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
Reporter

Updated

2 years ago
Blocks: 1417803
Has Regression Range: --- → yes
Has STR: --- → yes
Assignee

Comment 2

2 years ago
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 3

2 years ago
mozreview-review
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 hidden (mozreview-request)
Assignee

Comment 6

2 years ago
mozreview-review-reply
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 7

2 years ago
mozreview-review
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+

Comment 8

2 years ago
Pushed by lchang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/325e9306bf09
Fix the null pointer issue caused by FormAutofillContent. r=lchang
Duplicate of this bug: 1427219

Comment 10

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/325e9306bf09
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Reporter

Comment 11

2 years ago
This bug fix has verified in the latest Nightly build (20171229220051). Thanks!
Status: RESOLVED → VERIFIED

Updated

2 years ago
Duplicate of this bug: 1426549

Updated

2 years ago
Duplicate of this bug: 1426314

Updated

Last year
Depends on: 1434581
You need to log in before you can comment on or make changes to this bug.