Closed Bug 749367 Opened 8 years ago Closed 8 years ago
<script type="text/template"> content parsed as Java
Observed in Nightly 15.0a1 (2012-04-26) It's become a common pattern  in web applications to perform JS templating by placing HTML snippets in a script tag with the type of "text/template". It is said (and assumed by developers) that content wrapped in such a way will not be parsed by browsers or displayed. I observed in the most recent Nightly that HTML inside these script tags is being evaluated as XML and triggering errors in the console. Here is a sample from https://marketplace-dev.allizom.org/en-US/ Timestamp: 4/26/12 1:55:01 PM Error: SyntaxError: XML can't be the whole program Source File: https://marketplace-dev.allizom.org/en-US/ Line: 337 This has the potential to cause issues with existing sites. : https://github.com/documentcloud/backbone/blob/master/examples/todos/index.html
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
By code inspection, this is a regression from bug 744332. The else branch at http://hg.mozilla.org/mozilla-central/annotate/807403a04a6a/content/base/src/nsScriptLoader.cpp#l470 is now bogus.
This is a major web compat bug. It's common to use <script> tags like this for WebGL too, and it's actually possible that some WebGL shader bits can end up looking sorta like JS, I think. Mark, do you want to take this?
Severity: normal → major
yes... built the patch ... working on a mochitest
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
This patch builds and tests locally. The test fails before, works after. Running the whole test-suite ends suspiciously fast in my WIN7 environment, though qpop-ing and testing again ends fast also. Maybe something recent due to the PGO link problems ... ? Have a look, let me know -- mark
Attachment #620941 - Flags: feedback? → feedback?(Ms2ger)
Comment on attachment 620941 [details] [diff] [review] Patch (v2) Two things: 1) There are other places in the patch for bug 744332 that had similar issues. 2) I'd structure the test like this: <script> var ran = false; </script> <script type="text/template"> ran = true; </script> <script> is(ran, false, "text/template script should not run"); </script> and similar for any other types you want to test.
Attachment #620941 - Flags: feedback?(Ms2ger) → feedback+
Asking for feedback again ... found another block of identical code in nsXULContentSink.cpp that has now been addressed and a test created for. Again all builds and individually tests ok locally. The whole test-suite runs ok but seems to finish in about half the time it normally takes, though again, its doing this when I pop my change out also. Let me know if I should push to try, or go for the review? from JST ...
Comment on attachment 621003 [details] [diff] [review] Patch (v3) Review of attachment 621003 [details] [diff] [review]: ----------------------------------------------------------------- Thanks.
ms2ger: pushed manually https://tbpl.mozilla.org/?tree=Try&rev=98bd00bb353a
OS: Mac OS X → All
Hardware: x86 → All
Matt, how is that blocking rinmark? You shouldn't block ringmark but a ring number.
This bug does not affect any of the ringmark tests, but it causes errors in the rng.io test-runner HTML page. I had thought the errors were causing the test runner to fail, but it looks like they are non-fatal, so this probably doesn't need to block.
No longer blocks: ringmark
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Autoland Patchset: Patches: 621003 Branch: mozilla-central => try Patch 621003 could not be applied to mozilla-central. patching file content/base/src/nsScriptLoader.cpp Hunk #1 FAILED at 459 1 out of 1 hunks FAILED -- saving rejects to file content/base/src/nsScriptLoader.cpp.rej patching file content/base/test/Makefile.in Hunk #1 FAILED at 572 1 out of 1 hunks FAILED -- saving rejects to file content/base/test/Makefile.in.rej file content/base/test/test_bug749367.html already exists 1 out of 1 hunks FAILED -- saving rejects to file content/base/test/test_bug749367.html.rej patching file content/xul/content/test/Makefile.in Hunk #1 FAILED at 40 1 out of 1 hunks FAILED -- saving rejects to file content/xul/content/test/Makefile.in.rej file content/xul/content/test/test_bug749367.xul already exists 1 out of 1 hunks FAILED -- saving rejects to file content/xul/content/test/test_bug749367.xul.rej patching file content/xul/document/src/nsXULContentSink.cpp Hunk #1 FAILED at 922 1 out of 1 hunks FAILED -- saving rejects to file content/xul/document/src/nsXULContentSink.cpp.rej patch failed, unable to continue (try -v) patch failed, rejects left in working dir Patchset could not be applied and pushed.
Duplicate of this bug: 756715
Since web apps can only be installed on Nightly builds, I tried to verify this issue on Firefox 15.0 Nightly builds: 05/10 Nightly - the issue still reproduces (the push was only made that day, so this is ok) 05/11 Nightly & 05/27 Nightly - the Install button from the web app pages is unresponsive (nothing happens when clicking it & nothing gets displayed in the Error Console).
Verified as fixed on the 08/06 Firefox 17.0 Nightly.
You need to log in before you can comment on or make changes to this bug.