Closed Bug 1686950 Opened 4 years ago Closed 4 years ago

Starting RDM from the toolbox might use the wrong tab target

Categories

(DevTools :: Responsive Design Mode, defect, P3)

defect

Tracking

(firefox87 fixed)

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

Attachments

(4 files)

RDM creates its own tab target in ui.js: https://searchfox.org/mozilla-central/rev/2a24205479519e70c0574929f45730d285141584/devtools/client/responsive/ui.js#398

    const descriptor = await this.client.mainRoot.getTab();
    const targetFront = await descriptor.getTarget();

We don't pass anything to getTab, so in the end we will use the currently selected tab to create the target. This is usually fine, but can fail in some edge case scenarios. STRs:

  • open a first tab on google.com
  • open a second tab on mozilla.org
  • open devtools for the second tab
  • move devtools to a separate window
  • select the google.com tab
  • focus the devtools window again, without selecting the mozilla.org tab
  • enable RDM

At this point, the UI of the mozilla.org tab will be modified to include the RDM ui. But most of the RDM features will actually impact the google.com tab. Eg. taking a screenshot will take a screenshot of the google tab. Changing the user agent will impact the google tab. Etc...

This is probably unlikely to be triggered by a end user, but it would be nice to fix it.

Will try to fix this and cleanup a bit tab target usage from RDM. This will help for Bug 1644397

Assignee: nobody → jdescottes
Blocks: 1644397
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3

RDM uses a dedicated client, target-list etc. Which means that we can use a local tab descriptor and remove the target switching logic from RDM.

Depends on: 1689559

Depends on D103326
Spotted while writing the patch, makes the code unnecessarily hard to navigate.

Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b96b289caa90
[devtools] Update RDM tab target creation to rely on a local tab target descriptor r=nchevobbe
https://hg.mozilla.org/integration/autoland/rev/2101550772b1
[devtools] RDM should stop watching resources and targets after performing cleanup r=nchevobbe
https://hg.mozilla.org/integration/autoland/rev/b80ef0302895
[devtools] Remove string concatenation to toggle RDM from toolbox r=nchevobbe
https://hg.mozilla.org/integration/autoland/rev/822bc5a120c7
[devtools] Add test for opening RDM on non-selected tab r=nchevobbe
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: