Use ContentDOMReference for "Inspect Element"
Categories
(DevTools :: Inspector, task, P3)
Tracking
(firefox72 fixed)
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: jdescottes, Assigned: jdescottes)
References
(Blocks 3 open bugs)
Details
Attachments
(2 files)
For the "Inspect Element" feature available in the regular context menu opened on content pages, we currently compute the selectors needed to target the element on which the user clicked and pass this list of selectors to DevTools.
(note we have several selectors to accommodate for iframes/webcomponents).
Some pointers to the existing code:
- computing the selectors in content process: https://searchfox.org/mozilla-central/rev/17756e2a5c180d980a4b08d99f8cc0c97290ae8d/browser/actors/ContextMenuChild.jsm#612
- passing the selectors to DevTools : https://searchfox.org/mozilla-central/rev/17756e2a5c180d980a4b08d99f8cc0c97290ae8d/browser/base/content/nsContextMenu.js#1082
All this logic relies on the findAllCssSelectors
and getSelectorParent
from css-selector.js that will no longer work in a Fission setup. So it would be nice to update to switch to another API before that.
Also if anything in the page changes after right clicking and invalidates the selector, the current approach will fail to highlight the good node, while the ContentDOMReference would be able to do it.
Assignee | ||
Comment 1•5 years ago
|
||
Depends on D48808
Using ContentDOMReference instead of creating an array of selectors makes inspect element more stable in case the page is modified between after the contextmenu opens.
It will also make the feature easier to make fission compatible
Assignee | ||
Comment 2•5 years ago
|
||
Depends on D49303
Some methods from css-logic were extracted from the devtools codebase to be used by context-menu files.
This was only needed in order to compute the css-selectors for Inspect Element.
If we use ContentDOMReference instead, those helpers can move back in the devtools codebase
(leaving them in css-selector.js fails the all-files-referenced test for some reason as well)
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a69208bb8c1a Use ContentDOMReference for context menu Inspect Element r=mconley,pbro https://hg.mozilla.org/integration/autoland/rev/ee250b40876e Move css-selector.js helpers back to DevTools css-logic.js r=pbro
Comment 4•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a69208bb8c1a
https://hg.mozilla.org/mozilla-central/rev/ee250b40876e
Description
•