Closed Bug 340383 Opened 18 years ago Closed 7 years ago

DOMParser parsing errors should raise exceptions, not errors

Categories

(Core :: XML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: gmiroshnykov, Unassigned)

References

Details

Attachments

(1 file)

539 bytes, application/vnd.mozilla.xul+xml
Details
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

As of the current implementation, when a parsing error occurs within DOMParser, an error gets reported to Javascript Console (or whatever it's new name is) without the opportunity for a developer to handle this error siletly.

I understand that as noted in bug 155749, users are asking for more descriptive parsing error messages, but IMO these messages should raise an exception, not an error.
Currently, there is no other way to test if a given string is a well-formed XML or not without raising this error.

Reproducible: Always

Steps to Reproduce:
1. Open the attached testcase;
2. Press the "Test Error" button.

Actual Results:  
Parsing error is silently added to the Javascript Console.

Expected Results:  
(as of the testcase javascript code)
An error popup should appear with the description of the exception.
No errors should be added to the Javascript Console.
Attached file Testcase
Raising exceptions is bug 45566.  I'm making this bug depend on bug 45566 instead of marking this bug as a dup because I'm not sure a fix for that bug would take the other error message off of the console.
Status: UNCONFIRMED → NEW
Depends on: 45566
Ever confirmed: true
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
Existing behavior is enshrined in the standard these days: https://w3c.github.io/DOM-Parsing/
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: