Closed Bug 1591761 Opened 6 years ago Closed 6 years ago

parseXULToFragment needs to handle non-well-formed XML

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: WeirdAl, Assigned: WeirdAl)

References

()

Details

Attachments

(1 file)

I accidentally passed some not-well-formed XML (specifically, forgetting to replace & with & in a URL string) into MozXULElement.parseXULToFragment. The error I got back was not helpful:

JavaScript error: , line 0: uncaught exception: Object

If you do this, the DOMParser will return a <parsererror>...</parsererror> document, but one without a XUL box root element. Then it reaches the selectNodeContents(null) line and throws an exception.

Testcase coming.

Assignee: nobody → ajvincent
Attachment #9104482 - Attachment is obsolete: true
Attachment #9104482 - Attachment is obsolete: false
Pushed by csabou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8799781bbf34 parseXULToFragment should throw a clearer exception for non-well-formed markup. r=bgrins

One of the changes in the Phabricator request was both unnecessary and broke the parseXULToFragment code. Fixed.

Flags: needinfo?(ajvincent)
Pushed by bgrinstead@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2362ccd868c6 parseXULToFragment should throw a clearer exception for non-well-formed markup. r=bgrins
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: