JavaScript error: resource://formautofill/FormAutofillHandler.jsm, line 1000: TypeError: this.form.rootElement.ownerGlobal is null
Categories
(Toolkit :: Form Autofill, defect, P2)
Tracking
()
People
(Reporter: robwu, Unassigned)
Details
In log files of tests that open and close tabs (e.g. toolkit/components/extensions/test/browser/browser_ext_themes_ntp_colors.js), the following error appears repeatedly:
JavaScript error: resource://formautofill/FormAutofillHandler.jsm, line 1000: TypeError: this.form.rootElement.ownerGlobal is null
source of FormAutofillHandler.jsm, line 1000
FormAutofillHandler is constructed in FormAutofillContent.identifyAutofillFields
which is called here: https://searchfox.org/mozilla-central/rev/8ecd15049c11eb753717a6631213ba5ecc90e123/browser/extensions/formautofill/content/FormAutofillFrameScript.js#51
That happens after a setTimeout, and I can imagine that if the document unloads before the scheduled task has run, that the _nextHandleElement is a disconnected DOM element, and therefore causes the error.
This flaw is not only causing error message in the console; based on code inspection it may also cause memory leaks (of the DOM element) and prevent form detection from working (because the _hasPendingTask flag is never reset).
To fix this problem, _nextHandleElement should be cleared when the document onloads, and the logic in the setTimeout callback should return if _nextHandleElement has been unset (don't forget to clear _hasPendingTask though).
Comment 2•3 years ago
|
||
When running the toolkit/components/extensions/text/browser/browser_ext_themes_ntp.colors.js test, this error no longer appears. So I tried browser/extensions/formautofill/test/unit/test_onFormSubmitted.js since this test calls identifyAutofillFields twice and still the error did not appear.
Closing as wfm
Description
•