Closed Bug 1522273 Opened 5 years ago Closed 5 years ago

Markup view not working on elements containing a 'constructor' attribute

Categories

(DevTools :: Inspector, defect, P2)

defect

Tracking

(firefox67 fixed)

RESOLVED FIXED
Firefox 67
Tracking Status
firefox67 --- fixed

People

(Reporter: bgrins, Assigned: miker)

References

()

Details

Attachments

(1 file, 1 obsolete file)

When I right click -> Inspect Element on one of the <summary> tags on https://bgrins.github.io/xbl-analysis/tree/, I'm getting mostly-empty markup view along with this error in the Browser Console.

STR:
Right click on the text "basecontrol" and Inspect Element

Expected:
Element is opened in markup view

Actual:

TypeError: ATTRIBUTE_TYPES[attributeName] is not iterable: getType@resource://devtools/client/shared/node-attribute-parser.js:305:1
parseAttribute@resource://devtools/client/shared/node-attribute-parser.js:279:16
_createAttribute@resource://devtools/client/inspector/markup/views/element-editor.js:545:29
update@resource://devtools/client/inspector/markup/views/element-editor.js:260:27
ElementEditor@resource://devtools/client/inspector/markup/views/element-editor.js:133:3
MarkupElementContainer@resource://devtools/client/inspector/markup/views/element-container.js:36:19
importNode@resource://devtools/client/inspector/markup/markup.js:1076:19
_ensureNodeImported@resource://devtools/client/inspector/markup/markup.js:1261:7
showNode@resource://devtools/client/inspector/markup/markup.js:1241:7
_onNewSelection@resource://devtools/client/inspector/markup/markup.js:689:20
emit@resource://devtools/shared/event-emitter.js:186:15
emit@resource://devtools/shared/event-emitter.js:267:5
setNodeFront@resource://devtools/client/framework/selection.js:153:5
inspectNode@resource://devtools/client/framework/devtools.js:706:5
async*inspectNode@chrome://devtools-startup/content/DevToolsShim.jsm:239:12
inspectNode@chrome://browser/content/nsContextMenu.js:767:12
oncommand@chrome://browser/content/browser.xul:1:1

Assignee: nobody → mratcliffe
Status: NEW → ASSIGNED

These are two different issues so I will split the P1 off into a new bug.

Priority: P1 → P2
Summary: Inspect Element / Element Picker not working on some elements. Content missing from Markup view → Inspect element / markup view not working on some elements at https://bgrins.github.io/xbl-analysis/tree/
Attachment #9040120 - Attachment is obsolete: true
No longer depends on: 1524005
Summary: Inspect element / markup view not working on some elements at https://bgrins.github.io/xbl-analysis/tree/ → Markup view not working on elements containing a 'constructor' attribute
OS: Unspecified → All
Hardware: Unspecified → All

ATTRIBUTE_TYPES was an object and we used to access it's attributes using e.g.
ATTRIBUTE_TYPES["href"], which is fine in almost all cases.

The problem occurred when the attribute name was constructor. This caused us
to attempt to parse ATTRIBUTE_TYPES["constructor"], which returned
{}.constructor therefore breaking the attribute parser.

Changing ATTRIBUTE_TYPES to a Map fixes the issue because
ATTRIBUTE_TYPES.get("constructor") returns null rather than an object
constructor.

(In reply to Mike Ratcliffe [:miker] [:mratcliffe] [:mikeratcliffe] from comment #8)

The problem occurred when the attribute name was constructor. This caused us
to attempt to parse ATTRIBUTE_TYPES["constructor"], which returned
{}.constructor therefore breaking the attribute parser.

Ouch! When JavaScript bites back :)

Good catch, though I'm sure this took a while to track down. Thanks for fixing this!

Pushed by mratcliffe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e9a2417a0425
Markup view not working on elements containing a 'constructor' attribute r=rcaliman
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: