Closed Bug 1430443 Opened 2 years ago Closed 2 years ago

devtools/client/webconsole/test/browser_webconsole_clear_method.js fails after bug 1193394

Categories

(DevTools :: General, defect)

defect
Not set

Tracking

(firefox59 fixed)

RESOLVED FIXED
Firefox 59
Tracking Status
firefox59 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(2 files)

https://treeherder.mozilla.org/#/jobs?repo=try&revision=c7b7ba9086f5524823ea95f717f4bfbe0430313a&filter-searchStr=dt&selectedJob=154669321
> TEST-UNEXPECTED-FAIL | devtools/client/webconsole/test/browser_webconsole_clear_method.js | console.clear() message is still displayed -
> ...
> TEST-UNEXPECTED-FAIL | devtools/client/webconsole/test/browser_webconsole_clear_method.js | console.clear() message is only displayed once - Got 1, expected 2
The remaining part after `yield sidebarClosed;` is executed inside `this.jsterm.clearOutput(false);`,
https://searchfox.org/mozilla-central/rev/ab63c465d9f54d7608a3c01dad3eb84e433097f5/devtools/client/webconsole/test/browser_webconsole_clear_method.js#52
https://searchfox.org/mozilla-central/rev/ab63c465d9f54d7608a3c01dad3eb84e433097f5/devtools/client/webconsole/webconsole.js#2118
especially `this.inputNode.focus();`
https://searchfox.org/mozilla-central/rev/ab63c465d9f54d7608a3c01dad3eb84e433097f5/devtools/client/webconsole/jsterm.js#290

here's the partial stack trace, from focus() call to MicroTask checkpoint.

#21: mozilla::CycleCollectedJSContext::PerformMicroTaskCheckPoint
#22: mozilla::EventListenerManager::HandleEventSubType
#23: mozilla::EventListenerManager::HandleEventInternal
#24: mozilla::EventTargetChainItem::HandleEventTargetChain
#25: mozilla::EventDispatcher::Dispatch
#26: nsXULCommandDispatcher::UpdateCommands
#27: nsContentUtils::AddScriptRunner
#28: nsGlobalWindowOuter::UpdateCommands
#29: non-virtual thunk to nsGlobalWindowOuter::UpdateCommands
#30: nsFocusManager::Focus
#31: nsFocusManager::SetFocusInner
#32: nsFocusManager::SetFocus
#33: mozilla::dom::Element::Focus
#34: mozilla::dom::HTMLElementBinding::focus
#35: mozilla::dom::GenericBindingMethod

I'm not sure if this behavior is a special case for HTML element inside XUL, but I cannot reproduce similar execution with plain HTML.
also, the frame #27 above is the following line, so at least this case is specific to XUL.
https://searchfox.org/mozilla-central/rev/ab63c465d9f54d7608a3c01dad3eb84e433097f5/dom/base/nsGlobalWindowOuter.cpp#6398
if the behavior is specific to XUL, then I think it's just fine.
we can fix the bug by just waiting for the next event tick to leave the microtask checkpoint.
I think working around this by waiting until the next tick would be fine. This is the older webconsole implementation that's currently only used by the Browser Console and we are currently porting relevant the tests to enable the new frontend there before removing the old implementation. Nicolas, what's the plan with this test in particular? I don't see it in the new browser.ini.
Flags: needinfo?(nchevobbe)
It's not planned for the migration as what it asserts is already tested in mocha.
Flags: needinfo?(nchevobbe)
Same as bug 1430441, converted to async functions first
Attachment #8943922 - Flags: review?(bgrinstead)
And added wait after `await sidebarClosed` to leave the microtask checkpoint inside XUL focus event
Attachment #8943923 - Flags: review?(bgrinstead)
Attachment #8943922 - Flags: review?(bgrinstead) → review+
Attachment #8943923 - Flags: review?(bgrinstead) → review+
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2ae308123cd5
Part 1: Use Async Function in devtools/client/webconsole/test/browser_webconsole_clear_method.js r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/abaf10c8c07c
Part 2: Wait for the next event tick after closing sidebar to make sure the message is flushed in devtools/client/webconsole/test/browser_webconsole_clear_method.js r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/2ae308123cd54499ba99c95fe1c722623c978334
Bug 1430443 - Part 1: Use Async Function in devtools/client/webconsole/test/browser_webconsole_clear_method.js r=bgrins

https://hg.mozilla.org/integration/mozilla-inbound/rev/abaf10c8c07c0972d28a4f8d8c5a96c333b4f403
Bug 1430443 - Part 2: Wait for the next event tick after closing sidebar to make sure the message is flushed in devtools/client/webconsole/test/browser_webconsole_clear_method.js r=bgrins
https://hg.mozilla.org/mozilla-central/rev/2ae308123cd5
https://hg.mozilla.org/mozilla-central/rev/abaf10c8c07c
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 59
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.