Closed Bug 506286 Opened 11 years ago Closed 10 years ago

If <script src=""> exists in HTML, error message of "Error: syntax error", "Error: missing } in XML expression" is displayed in Error Console

Categories

(Core :: DOM: HTML Parser, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 531327

People

(Reporter: World, Unassigned)

References

Details

Attachments

(1 file)

This is spin-off of Bug 387078 Comment #12.

If <script src=""> exists in HTML, error message of "Error: syntax error", "Error: missing } in XML expression" is displayed in Error Console.

[Build Id]
> Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1
Same phenomenon was observed with Seammonkey 1.1.17.

[steps top reproduce]

(1) Create HTML file with <script id="scr1" language="javascript" src="">.
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
> <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Test</title>
> <script id="scr1" language="javascript" src=""></script>
> <script type="text/javascript" id="scr0">
> function abc()
> {
> var xxx;
> xxx=document.getElementById("scr1"); xxx.src="abc.js";
> }
> </script>
> </head>
> >(snip)
> </html>

(2) Load the HTML file => next error message is displayed in Error Console.
(2-A) Above HTML
> Error: syntax error
> Source File: file:///C:/...html Line: 1
> Source Code:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
(2-B) First "<!DOCTYPE HTML ..." line is removed.
> Error: syntax error
> Source File: file:///C:/...html Line: 9
> Source Code:
> var xxx;
(2-C) First "<!DOCTYPE HTML ..." line and "var xxx;" line are removed.
> Error: missing } in XML expression
> Source File: file:///C:/...html Line: 9, Column: 35
> Source Code:
> xxx=document.getElementById("scr1"); xxx.src="abc.js";
> ------------------------------------A

Error message of (2-C) indicates the error is XML parsing error.

Because of <script src="">, data obtained by src="" is usually Content-Type: text/html etc., and is not usually suitable for <script>. And, if data obtained by src=""(== my own HTML source) is analyzed to use as script source, it'll always produce error, unless the HTML source has multiple meanings(valid as HTML source, and valid as JavaScript source, and valid as XML source).

Is processing of data obtained by <script src="">(without <base>) mandatory?
What is reason to check data obtained by <script src="">(without <base>)?
Change to <img src=""> like is impossible or invalid thing?
Depends on: 531327
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 531327
You need to log in before you can comment on or make changes to this bug.