Closed Bug 1566421 Opened 1 year ago Closed 1 year ago

Make webconsole destroy codepath synchronous


(DevTools :: Console, enhancement, P1)



(Not tracked)



(Reporter: ochameau, Assigned: ochameau)


(Blocks 1 open bug)



(3 files, 1 obsolete file)

See bug 1529621. This bug is dedicated to the Web Console and aims at getting rid of async on this particular method and all its dependencies:

It doesn't look too bad.
But it is interesting to see that removing the one RDP request is enough to trigger all the shutdown races we have a tests.
All failures are about pending requests from tests which are not waited correctly.

Here is the last try push I had:

No RDP request should be done when the toolbox closes as there no guarantee that
the request will complete. Instead, such cleanup should be done by the actors.

Comment on attachment 9078671 [details]
Bug 1566421 - Do focus the content window from the actor when the toolbox closes.

Well. Removing this focus request isn't trivial.

I tried two things:

  • Automatically do it from the webconsole actor, on destroy, only for tabs (i.e. ignore the browser toolbox, workers, ...)
    This makes one test to fail devtools/shared/webconsole/test/test_console_serviceworker_cached.html in a very unexpected way!
    We open a first tab, instantiate a console actor, close the connection, open a new tab and reinstantiate a new console actor for the new tab.
    It happens that when we try to instantiate the second console actor, the first tab is being selected because of the focus call.
    This is a race where the call to focus is asynchronous and happen after we requested to open a second tab.
    (I get failure on this service worker test)

We could somehow address that by ensuring that we try to reset the focus only when a toolbox is involved.
(There is no toolbox involved in this test)
(I'm waiting for try results for this one)

  • Use Target.reconfigure to very precisely tell when to restore the focus.
    The current behavior isn't 100% perfect. We force focusing the content page no matter what if the console actor is created (i.e. always).
    We could listen for focus/blur on JSTerm to know if we have the focus in the console and only try to restore it on the content if we were focused.
    But this solution creates various pending requests in tests, as we quite often focus the console input and aren't waiting for its now async completion...
    (I get random failure because of pending reconfigure request)

Getting closer:

There is a surprising impact on DOM panel tests. It looks like one change of this queue make the DOM panel initialization faster, leading to race in the panel's tests!
Then, it looks like there is at least one additional failure in a console test testing network request inspection.

Priority: -- → P1

I might have a green try this time:

This is really not trivial test failures, but it helped highlighting tests not waiting correctly for many async operations!

Hum. It looks like when I fix tests, some new start failing. So it isn't clear when I will be done here... The new failure are still around the netmonitor.

The code callng action.updateRequest, in FirefoxDataProvider, expects the updateRequest action
to be processed once the returned promise is resolved. Otherwise it may spawn
duplicated requestData requests.

Keywords: leave-open
Pushed by
Make WebConsoleUI.destroy synchronous. r=nchevobbe
Pushed by
Ensure that actions.updateRequest resolves only once the action is processed. r=nchevobbe

Comment on attachment 9078671 [details]
Bug 1566421 - Do focus the content window from the actor when the toolbox closes.

Revision D38309 was moved to bug 1510690. Setting attachment 9078671 [details] to obsolete.

Attachment #9078671 - Attachment is obsolete: true
Pushed by
Make webconsole panel destroy codepath synchronous. r=nchevobbe
Closed: 1 year ago
Keywords: leave-open
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.