Closed Bug 1701004 Opened 3 years ago Closed 3 years ago

DevTools eye dropper command should use a dedicated descriptor & target

Categories

(DevTools :: General, task, P3)

task

Tracking

(Fission Milestone:M8, firefox91 fixed)

RESOLVED FIXED
91 Branch
Fission Milestone M8
Tracking Status
firefox91 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

(Whiteboard: dt-fission-m3-mvp)

Attachments

(1 file)

See https://phabricator.services.mozilla.com/D109470#inline-613143

In order to pick a color on the page, the eyedropper tool can create a TabDescriptor + inspector front early: https://searchfox.org/mozilla-central/rev/6c9ff2820d3aae683ec87c53c79e5108d54f3f76/devtools/client/menus.js#133-139

      const descriptor = await TabDescriptorFactory.createDescriptorForTab(
        window.gBrowser.selectedTab
      );
      const target = await descriptor.getTarget();
      await target.attach();
      const inspectorFront = await target.getFront("inspector");

Since the tab descriptor is cached per tab in the TabDescriptorFactory, this descriptor & front will be reused if you open a toolbox afterwards.

This is confusing and fragile. The eyedropper should not rely on the cache of descriptors which is really intended for toolboxes.

This might get fixed indirectly by Bug 1700909 when we move the descriptor (or rather commands) caching to gDevTools.

Priority: -- → P3
Summary: DevTools inspector command should use a dedicated descriptor & target → DevTools eye dropper command should use a dedicated descriptor & target
Whiteboard: dt-fission-m3-triage
Fission Milestone: --- → M8
Whiteboard: dt-fission-m3-triage → dt-fission-m3-mvp

Note that I think that bug 1700909 doesn't have to be a blocker.
We can probably migrate from TabDescriptorFactory to CommandsFactory and it should address target switching issues.

Adding some easy STRs to reproduce the bug here:

  • open https://www.mozilla.org/en-US/
  • start the eyedropper (Tools > Browser Tools > Eyedropper)
  • close the eyedropper
  • open the toolbox
  • select the body in the inspector

ER: The ruleview should show a rule for body pointing to protocol-mozilla.66302a5234e3.css (you might see a different hash)
AR: The ruleview shows "inline" for all rules

This is because the toolbox will reuse a cached Front created without watcher support (https://searchfox.org/mozilla-central/rev/b7bc94b4689a7f002c61d016c6e162e5e5708bf3/devtools/client/fronts/inspector.js#58-67).

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/54a777ac91e3
[devtools] Use a dedicated commands instance for the eyedropper menu item r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: