Open Bug 1918682 Opened 2 years ago Updated 1 year ago

In browser.xhtml <scripts> inside <template> seem to execute

Categories

(Core :: XUL, defect)

defect

Tracking

()

People

(Reporter: tschuster, Unassigned)

Details

I can't really explain this behavior, but using <template><script></script></template> inside the browser.xhtml file, somehow triggers the script to execute inside the template. This behavior definitely doesn't reproduce for normal HTML: data:text/html,<template><h1>hey</h1><script>console.log(window.location.href);</script></template>.

This patch shows some possible variants of this, that all seem to execute.

What happens for XHTML served as XHTML (data: or http) ?

Flags: needinfo?(tschuster)

It does not execute the script: data:application/xhtml+xml,<?xml version="1.0" ?><html xmlns="http://www.w3.org/1999/xhtml"><body><template><script>console.log(window.location.href);</script></template></body></html>
(For comparison: data:application/xhtml+xml,<?xml version="1.0" ?><html xmlns="http://www.w3.org/1999/xhtml"><body><script>console.log(window.location.href);</script></body></html>)

Flags: needinfo?(tschuster)

Henri, do you mind take a look?

Severity: -- → S3
Flags: needinfo?(hsivonen)

All three scripts run from https://searchfox.org/mozilla-central/rev/c414b4538dd3c7e1dc674f7b66176e7c309afa95/dom/prototype/PrototypeDocumentContentSink.cpp#568

The PrototypeDocumentContentSink needs to check for a template ancestor.

Flags: needinfo?(hsivonen)
Component: DOM: HTML Parser → XUL
No longer blocks: 1918615
You need to log in before you can comment on or make changes to this bug.