Closed Bug 1699497 Opened 3 years ago Closed 3 years ago

FrameConnector fails if called twice in parallel

Categories

(DevTools :: Framework, defect)

defect

Tracking

(Fission Milestone:M7a, firefox89 fixed)

RESOLVED FIXED
89 Branch
Fission Milestone M7a
Tracking Status
firefox89 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

(Whiteboard: dt-fission-m3-mvp)

Attachments

(1 file)

While working on bug 1699493, I was having test failures on browser/components/extensions/test/browser/browser_ext_devtools_inspectedWindow_targetSwitch.js because of this.

The issue is that connectToFrame is called twice at about the same time.
And this method calls:
https://searchfox.org/mozilla-central/source/devtools/server/connectors/frame-connector.js#46

mm.loadFrameScript("resource://devtools/server/startup/frame.js", false);

and
https://searchfox.org/mozilla-central/source/devtools/server/connectors/frame-connector.js#278

 mm.sendAsyncMessage("debug:connect", { prefix, addonId });

twice in parallel.

On the other side of the process bridge, here:
https://searchfox.org/mozilla-central/source/devtools/server/startup/frame.js#53-54

    const onConnect = DevToolsUtils.makeInfallible(function(msg) {
      removeMessageListener("debug:connect", onConnect);

      const mm = msg.target;
      const prefix = msg.data.prefix;
      const addonId = msg.data.addonId;

      const conn = DevToolsServer.connectToParent(prefix, mm);

We end up calling connectToParent twice with the same prefix, instead of twice with the two distinct prefixes. One for each connectToFrame call, one for each tab top level target.

Doing this leads to really cryptic issues of having all content process actors being instanciated twice for the same prefix and having the client to receive all response twice and be confused about unexpected packets.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Whiteboard: dt-fission-m3-triage
Whiteboard: dt-fission-m3-triage → dt-fission-m3-mvp
Fission Milestone: --- → M7a
Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a6af447d7028
[devtools] Fix races when connecting to the same browser element twice in parallel. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: