Closed Bug 685098 Opened 13 years ago Closed 13 years ago

append an element containing script code the code is not parsed

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 644034

People

(Reporter: piviul, Unassigned)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.1.16) Gecko/20110815 Iceweasel/3.5.16 (like Firefox/3.5.16)
Build ID: 20110815153231

Steps to reproduce:

I have write this html page:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8" />
<title>Test ajax error</title>
<script type="text/javascript">
function init()
{
    var target=document.getElementById("target");
    var el = document.createElement("span");
    el.innerHTML = '<script type="text/javascript">alert("Hello wolrld");<'+
        '/script>';
    for(i = 0; i<el.childNodes.length; i++) {
        target.appendChild(el.childNodes[i].cloneNode(true));
    }
}
</script>
<body onload="init();">
<div id="target">
</div>
</body>
</html>


Actual results:

In Firefox 5 or 6 the code above doesn't produce any alert saying "Hello world"; in Firefox 4 or 3 the script produce an alert saying "Hello world".


Expected results:

I expect that firefox 5 or 6 have the same behavior of firefox 4 or If  you decide to change a behavior, I expect  a warning or error should appear on the error console.
OS: Linux → All
The problem have some consequence in PEAR::HTML_AJAX. I have opened a new bug to this package too: https://pear.php.net/bugs/18801
WFM:
Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.2.22) Gecko/20110902 Firefox/3.6.22

Reproduced:
Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20100101 Firefox/7.0
Mozilla/5.0 (X11; Linux x86_64; rv:8.0a2) Gecko/20110906 Firefox/8.0a2
Mozilla/5.0 (X11; Linux x86_64; rv:9.0a1) Gecko/20110906 Firefox/9.0a1
Keywords: regression
Hardware: x86 → All
Version: 5 Branch → Trunk
Sounds like this is a duplicate of bug 644034
Last good nightly: 2010-05-03
First bad nightly: 2010-05-04

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=83c887dff0da&tochange=d6bb0f9e9519

I *guess* this is the regression changeset:
http://hg.mozilla.org/mozilla-central/rev/358113b3642e
Bug 373864 - Enable the HTML5 parser by default. r+sr=jst. 


Reproduced:
Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0

WFM with html5.parser.enable = false:
Mozilla/5.0 (X11; Linux x86_64; rv:2.0) Gecko/20100101 Firefox/4.0
Yes, the testcase code looks the same as in bug 644034.
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
To be clear, the Firefox 4 and later behavior here is required by the HTML5 specification.  Firefox 4 had a bug where multiple <script>s in the innerHTML could cause some but not all of them to execute, but that bug has since been fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: