Closed Bug 1634819 Opened 5 years ago Closed 5 years ago

Login autocomplete broken if field parent is a Shadow Root: can't access property "tagName", parentElement is null

Categories

(Toolkit :: Password Manager, defect, P1)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
mozilla78
Tracking Status
firefox-esr68 --- unaffected
firefox75 --- unaffected
firefox76 - wontfix
firefox77 --- verified
firefox78 --- verified

People

(Reporter: MattN, Assigned: bdanforth)

References

(Depends on 1 open bug, Blocks 1 open bug, Regression, )

Details

(Keywords: regression, Whiteboard: [passwords:fill-ui])

Attachments

(1 file)

STR:

  1. Visit about:logins and add a (fake) saved login for https://www.virustotal.com
  2. Load https://www.virustotal.com/gui/sign-in
  3. Focus the password field (clear it if it's non-empty)

Expected result:
Password autocomplete appears

Actual result:
Error in Browser Console (at least with signon.debug=true)

The problem is that NewPasswordModel assume that the parentElement of the <input> is non-null but the Shadow Root isn't an element, it's just a Node, so it is null. In this case we should use Node.parentNode.nodeName or handle element.parentElement being null.

LoginAutoComplete: TypeError: "can't access property "tagName", parentElement is null"
    hasLabelMatchingRegex resource://gre/modules/NewPasswordModel.jsm:152
    hasCurrentLabel resource://gre/modules/NewPasswordModel.jsm:362
    getSubfactsFromFunction resource://gre/modules/third_party/fathom/fathom.jsm:1687
    fact resource://gre/modules/third_party/fathom/fathom.jsm:1734
    updateFnode resource://gre/modules/third_party/fathom/fathom.jsm:2288
    forEach resource://gre/modules/third_party/fathom/fathom.jsm:608
    results resource://gre/modules/third_party/fathom/fathom.jsm:2278
    _execute resource://gre/modules/third_party/fathom/fathom.jsm:2683
    get resource://gre/modules/third_party/fathom/fathom.jsm:2598
    _computeType resource://gre/modules/third_party/fathom/fathom.jsm:2107
    scoreFor resource://gre/modules/third_party/fathom/fathom.jsm:2008
    _isProbablyANewPasswordField resource://gre/modules/LoginAutoComplete.jsm:691
    _requestAutoCompleteResultsFromParent resource://gre/modules/LoginAutoComplete.jsm:636
    startSearch resource://gre/modules/LoginAutoComplete.jsm:597
LoginAutoComplete.jsm:605:37
Flags: qe-verify+

hey matt, could you add a severity? also, do you think this would drive/ride a dot release?

Flags: needinfo?(MattN+bmo)

[Tracking Requested - why for this release]: New regression in 76 around a feature we are marketing. Saved login autocomplete and password generation are broken with specific forms of shadow DOM that are fairly common nowadays. The context menu is a workaround so that's why I didn't choose S1.

I think this should ride-along but not drive a dot release. I suspect Bianca will be starting on this today.

Bianca, note that you should fix this on model 3.1 so we can uplift, not on master from the fathom-login-forms repo.

Severity: -- → S2
Flags: needinfo?(MattN+bmo)
Assignee: nobody → bdanforth
Status: NEW → ASSIGNED

The element.parentNode.nodeName approach also handled the error, but when I ran the updated model through the training, validation and testing samples, our false positive rate (FPR) went up from 2.2% to 4.5% (referencing the most recent update to NewPasswordModel.jsm in bug 1629132) with a confidence threshold of 0.75. Unfortunately, that is well above our target FPR of 2-3%.

Going with simply returning false for this rule in these cases will leave the model's performance unchanged on pages that don't use the Shadow DOM at all or in this specific way.

Attachment #9146360 - Attachment description: Bug 1634819 - Login autocomplete broken if field parent is a Shadow Root: can't access property tagName, parentElement is null; r=MattN → Bug 1634819 - Existence check element.parentElement in new password heuristics; r=MattN
Attachment #9146360 - Attachment description: Bug 1634819 - Existence check element.parentElement in new password heuristics; r=MattN → Bug 1634819 - Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN
Pushed by mozilla@noorenberghe.ca: https://hg.mozilla.org/integration/autoland/rev/f63a19d7effa Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN

Comment on attachment 9146360 [details]
Bug 1634819 - Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN

Beta/Release Uplift Approval Request

  • User impact if declined: In certain cases where a ShadowRoot is part of a form with a password field, the Password Manager autocomplete popup will not work on the password field due to an unhandled error. We estimate a small percentage of pages to be affected by this (<< 10%).
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: STR are in the description for the bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1634819#c0).
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This change just adds some checks to make sure that an object exists (i.e. is not null) before we try to access a property on it. It does not change the logic for showing the autocomplete popup.
  • String changes made/needed:
Attachment #9146360 - Flags: approval-mozilla-beta?
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78

Confirmed issue with 77.0a1(20200501094247) & 78.0a1(20200508033807) on macOS 10.15.3.
Verified with the treeherder builds for Nighlty branch.

QA Whiteboard: [qa-triaged]

Comment on attachment 9146360 [details]
Bug 1634819 - Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN

Fixes a P1 regression and verified by QA in nightly, uplift approved for the next beta, thanks.

Attachment #9146360 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified with 77.0b4 on macOS 10.15.3, Windows 10, Ubuntu 20.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

Comment on attachment 9146360 [details]
Bug 1634819 - Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN

Beta/Release Uplift Approval Request

  • User impact if declined: In certain cases where a ShadowRoot is part of a form with a password field, the Password Manager autocomplete popup will not work on the password field due to an unhandled error. We estimate a small percentage of pages to be affected by this (<< 10%).
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This change just adds some checks to make sure that an object exists (i.e. is not null) before we try to access a property on it. It does not change the logic for showing the autocomplete popup.

We are hoping this uplift could ride along if there is a dot release, though it does not warrant a dot release by itself.

  • String changes made/needed:
Attachment #9146360 - Flags: approval-mozilla-release?

Comment on attachment 9146360 [details]
Bug 1634819 - Existence check element.parentElement and element.previousElementSibling in new password heuristics; r=MattN

Not planning a 76 dot release at this time with 77 going to RC next week.

Attachment #9146360 - Flags: approval-mozilla-release? → approval-mozilla-release-
Depends on: 1655165
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: