Closed Bug 879578 Opened 11 years ago Closed 11 years ago

Maintain selected node and expanded html tree on reload

Categories

(DevTools :: Inspector, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: fitzgen, Assigned: pbro)

References

Details

Attachments

(1 file, 2 obsolete files)

STR:

* Open https://www.mozilla.org/en-US/

* Cmd+Opt+I and click on "Mozilla" in the title

* The html tree has expanded and the img element is selected

* Refresh

Expected result:

* The html tree has automatically re-expanded, and the img element is selected again

Actual result:

* Nothing is selected and the html tree is collapsed
Working on a patch for this. I should be ready soon.

What happens now is:
When the tab is reloaded and the inspector initializes, an attempt is made to select <body> and if that fails then documentElement is selected by default.

What I propose is:
- whenever a node is selected in the inspector, record its unique CSS selector and the current page's URL (this can be done at inspector-panel.js level as this module is not reloaded).
- when the tab is reloaded, we check 2 things: has a unique CSS selector been recorded and does its URL match the reloaded page's URL.
- if these 2 conditions are met, then an attempt should be made to select the unique CSS selector, if that fails then attempt to select <body>, and finally if that fails too, select documentElement.

This is by the way what other devtools seem to be doing.
Attachment #800134 - Flags: review?(paul)
Attachment #800134 - Flags: review?(paul)
TRY is green
Comment on attachment 800147 [details] [diff] [review]
879578-reselect-node-after-reload.patch

> CssLogic.findCssSelector(this.selection.node);

Are we sure this.selection.node is a node with a selector?

What if it's a comment or a doctype?

Don't you want to test first if it's an element:
> this.selection.isElementNode()
Attachment #800147 - Flags: review?(paul) → review+
Good point. Thanks for the review.

- I have changed the patch to check if the node is an element
- Try build is green
- Review is r+

Attaching the patch now and adding [land-in-fx-team] whiteboard.
Whiteboard: [land-in-fx-team]
Attachment #800134 - Attachment is obsolete: true
Attachment #800147 - Attachment is obsolete: true
https://tbpl.mozilla.org/?tree=Fx-Team&rev=bf671d77bdad
https://hg.mozilla.org/integration/fx-team/rev/bf671d77bdad
Assignee: nobody → pbrosset
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/bf671d77bdad
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 26
Depends on: 913641
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: