Open Bug 500612 Opened 15 years ago Updated 2 years ago

Scripts should run upon </script> even if script parent has been removed from the tree

Categories

(Core :: DOM: HTML Parser, defect)

Other Branch
defect

Tracking

()

ASSIGNED

People

(Reporter: hsivonen, Assigned: hsivonen)

References

Details

(Keywords: html5)

Attachments

(1 file)

From bug 487949: > >+ nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(mScriptElement); > >+ > >+ // Notify our document that we're loading this script. > >+ nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(mDocument); > >+ NS_ASSERTION(htmlDocument, "Document didn't QI into HTML document."); > >+ htmlDocument->ScriptLoading(sele); > >+ > >+ // Copied from nsXMLContentSink > >+ > >+ // Now tell the script that it's ready to go. This may execute the script > >+ // or return NS_ERROR_HTMLPARSER_BLOCK. Or neither if the script doesn't > >+ // need executing. > >+ nsresult rv = mScriptElement->DoneAddingChildren(PR_TRUE); > > So per current HTML spec this doesn't do exactly the right thing. If a parent > of the script element has been removed from the document, the script won't > execute here. However the HTML spec says it should. There was a recent thread > about this on the HTML list.
Attached patch Remove script's IsInDoc() test (deleted) — Splinter Review
Patch not tested yet.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
The patch fails Mochitest. I suppose it needs to be conditional on html5.enable.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: