Bug 1590050 - Preserve markup view selection in iframes after reload r=rcaliman,gl

Depends on D49940

To support this feature we perform two main changes
- the node actor exposes a getAllSelectors method, and the inspector now stores all selectors rather than just one
- the node actor exposes a waitForFrameLoad method, and the walkerFront findNodeFront helper uses it to make sure frames are loaded before querying a selector

Also added a test

Differential Revision: https://phabricator.services.mozilla.com/D49941
This commit is contained in:
Julian Descottes
2019-10-28 07:55:14 +00:00
parent dfaa37a8e4
commit 289d1eb14c
8 changed files with 171 additions and 18 deletions

View File

@@ -24,6 +24,11 @@ loader.lazyImporter(
"findCssSelector",
"resource://gre/modules/css-selector.js"
);
loader.lazyImporter(
this,
"findAllCssSelectors",
"resource://gre/modules/css-selector.js"
);
loader.lazyImporter(
this,
"getCssPath",
@@ -497,6 +502,16 @@ exports.prettifyCSS = prettifyCSS;
*/
exports.findCssSelector = findCssSelector;
/**
* Retrieve the array of CSS selectors corresponding to the provided node.
*
* The selectors are ordered starting with the root document and ending with the deepest
* nested frame. Additional items are used if the node is inside a frame or a shadow root,
* each representing the CSS selector for finding the frame or root element in its parent
* document.
*/
exports.findAllCssSelectors = findAllCssSelectors;
/**
* Get the full CSS path for a given element.
* @returns a string that can be used as a CSS selector for the element. It might not