Closed Bug 793713 Opened 12 years ago Closed 12 years ago

[inspector] Right click on a doctype node in the markup panel throws errors and causes weird things to happen

Categories

(DevTools :: Inspector, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 22

People

(Reporter: rcampbell, Assigned: miker)

Details

Attachments

(1 file, 1 obsolete file)

STR:

Open the Inspector, open the Markup panel.
Right click on a doctype and select Delete Node from the context menu.

Weird things happen, including two errors on the Error Console. E.g.,

Timestamp: 2012-09-24 3:54:40 PM
Error: TypeError: this.node.classList is undefined
Source File: resource:///modules/highlighter.jsm
Line: 611
After inspector refactoring, I now see:

Error: NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [inIDOMUtils.hasPseudoClassLock]
Source File: resource://gre/modules/devtools/InspectorPanel.jsm
Line: 342
Priority: -- → P2
Summary: Right click on a doctype node in the markup panel throws errors and causes weird things to happen → [inspector] Right click on a doctype node in the markup panel throws errors and causes weird things to happen
OS: Mac OS X → All
QA Contact: mratcliffe
Hardware: x86 → All
Attached patch Patch (obsolete) (deleted) — Splinter Review
This patch adds a little context menu intelligence:
1. Pseudo classes can only be set on element nodes as they are the only nodes that contain styles.
2. Deleting doctype nodes is forbidden as the spec does not allow them to be edited.
3. Copy unique selector is not valid for doctype nodes as they cannot be accessed using selectors.
Attachment #716510 - Flags: review?(fayearthur)
Whiteboard: [has-patch]
Assignee: nobody → mratcliffe
Comment on attachment 716510 [details] [diff] [review]
Patch

>+    // Disable "Copy Unique Selector" if needed
>+    let unique = this.panelDoc.getElementById("node-menu-copyuniqueselector");
>+    if (this.selection.isDocumentTypeNode()) {
>+      unique.setAttribute("disabled", "true");
>+    } else {
>+      unique.removeAttribute("disabled");
>+    }

Shouldn't we enable "copy unique selector" only if this.select.isElementNode()?

This needs tests.
Attachment #716510 - Flags: review?(fayearthur) → review-
Attached patch Patch v2 (deleted) — Splinter Review
(In reply to Paul Rouget [:paul] from comment #3)
> Comment on attachment 716510 [details] [diff] [review]
> Patch
> 
> >+    // Disable "Copy Unique Selector" if needed
> >+    let unique = this.panelDoc.getElementById("node-menu-copyuniqueselector");
> >+    if (this.selection.isDocumentTypeNode()) {
> >+      unique.setAttribute("disabled", "true");
> >+    } else {
> >+      unique.removeAttribute("disabled");
> >+    }
> 
> Shouldn't we enable "copy unique selector" only if
> this.select.isElementNode()?
> 

Yes, we should also only show "copy inner/outerhtml" entries for elements. Both fixed.

> This needs tests.

Done.
Attachment #716510 - Attachment is obsolete: true
Attachment #718453 - Flags: review?(paul)
Attachment #718453 - Flags: review?(paul) → review?(jwalker)
Comment on attachment 718453 [details] [diff] [review]
Patch v2

Review of attachment 718453 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me.
Attachment #718453 - Flags: review?(jwalker) → review+
Whiteboard: [has-patch] → [land-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/b7f366cbd4e2
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 22
Depends on: 847314
No longer depends on: 847314
No longer blocks: DevToolsPaperCuts
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: