Mochitests window leaks when focusing input elements when DevTools runs in a content frame
Categories
(DevTools :: General, task, P2)
Tracking
(Fission Milestone:M4, firefox70 fixed)
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
I am trying to fix the last few failures we have when running DevTools in a frame with type = content.
One of the recurring failures only occurs in debug mode, when a mochitest focuses an <input type="text">
in one of our panels.
This only happens if the input is in a HTML panel.
If the panel uses XHTML or if the input is directly in the toolbox's XUL document, no leaks.
So the setup that fails is:
<iframe src="about:devtools-toolbox"> <-- loads toolbox.xul
<iframe src="chrome://devtools/content/somepanel/index.html">
<input type="text">
So far, I have isolated the issue with a minimal devtools panel, I'll try to isolate it further without devtools.
The leaks reported are
0:18.98 ERROR TEST-UNEXPECTED-FAIL | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | leaked 2 window(s) until shutdown [url = about:devtools-toolbox]
0:18.98 ERROR TEST-UNEXPECTED-FAIL | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | leaked 1 window(s) until shutdown [url = about:blank]
0:18.98 ERROR TEST-UNEXPECTED-FAIL | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | leaked 1 window(s) until shutdown [url = chrome://devtools/content/testpanel/index.html]
0:18.98 INFO TEST-INFO | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | windows(s) leaked: [pid = 1481] [serial = 18], [pid = 1481] [serial = 15], [pid = 1481] [serial = 20], [pid = 1481] [serial = 19]
0:18.98 INFO TEST-INFO | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | This test created 0 hidden window(s)
0:18.98 INFO TEST-INFO | devtools/client/testpanel/test/browser/browser_testpanel_focusinput.js | This test created 1 hidden docshell(s)
0:18.98 INFO runtests.py | Application ran for: 0:00:17.874468
Full log of a basic test at https://gist.github.com/juliandescottes/bf77a5b82c69d6ef559682893fc7d445
Assignee | ||
Comment 1•5 years ago
|
||
Hi Nika,
I see window leaks in debug mochitests which focus inputs when devtools run in a content frame, when the input is loaded in a HTML document (see summary for more info).
While I keep investigating, does this issue ring a bell by any chance?
Thanks
Assignee | ||
Comment 2•5 years ago
|
||
This is not a fix, just an easy way to trigger the issue.
- enable debug mode
- run ./mach test browser_testpanel_focusinput.js
-> should leak
Assignee | ||
Comment 3•5 years ago
|
||
this example does not rely on any devtools API but still reproduces the leak.
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Odd - not sure why a html iframe would end up leaking.
Interestingly, this leak appears to not be a "real" leak, as in it gets cleaned up before shutdown, but there are extra windows which are being held by a persistent object after the test completes, and aren't cycle-collected correctly. It's also interesting that we only leak with HTML documents, and not with XHTML documents. Might help pinpoint what the specific problem is.
Specifically it seems to have something to do with framing a HTML document within a content XUL document.
:kmag, any idea off the top of your head why this might be happening?
Comment 5•5 years ago
|
||
Looks like it's being held alive by FormAutofill:
via persistent-Object :
0x1722374da610 [NonSyntacticVariablesObject <no private>]
--[FormAutofillContent]--> 0x386f34b23260 [Object <no private>]
--[_activeItems]--> 0x81b7a6123c0 [Object <no private>]
--[handler]--> 0x3c5e82be7ec0 [Object <no private>]
--[form]--> 0xf9d7d3e6980 [Object <no private>]
--[rootElement]--> 0x1b764360a60 [HTMLHtmlElement <no private>]
--[group]--> 0x1b7643c3400 [object_group]
--[group_global]--> 0x1e8d0f7c74c0 [Window <no private>]
Assignee | ||
Comment 6•5 years ago
|
||
Cleaning the FormAutofillContent on blur seems to fix the leak.
Assignee | ||
Comment 7•5 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #5)
Looks like it's being held alive by FormAutofill:
via persistent-Object :
0x1722374da610 [NonSyntacticVariablesObject <no private>]
--[FormAutofillContent]--> 0x386f34b23260 [Object <no private>]
--[_activeItems]--> 0x81b7a6123c0 [Object <no private>]
--[handler]--> 0x3c5e82be7ec0 [Object <no private>]
--[form]--> 0xf9d7d3e6980 [Object <no private>]
--[rootElement]--> 0x1b764360a60 [HTMLHtmlElement <no private>]
--[group]--> 0x1b7643c3400 [object_group]
--[group_global]--> 0x1e8d0f7c74c0 [Window <no private>]
Thanks for sharing this! FormAutofillContent does keep a reference on the active element. I am not sure why this only results in a leak in my XUL+html scenario, but clearing the reference seems to fix the leak so I will try to cleanup and propose a patch.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 9•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Updated•5 years ago
|
Description
•