Page 1 of 1

11.0.34rc1 does not display <noscript> tags

Posted: Mon Jul 27, 2020 10:48 pm
by barbaz
Firefox 79 Dev Edition
NoScript 11.0.34rc1
new profile

Test page:

Code: Select all

<!doctype html>
<script>document.write('<code>Javascript Is Enabled!!!!!!!!!</code>');</script>
<noscript>Javascript Is Blocked Or Unavailable.</noscript>
With scripts blocked, this page is blank.

Re: 11.0.34rc1 does not display <noscript> tags

Posted: Tue Jul 28, 2020 12:34 am
by therube
Confirmed.

Works as expected with NoScript disabled & toggling javascript.enabled.

Re: 11.0.34rc1 does not display <noscript> tags

Posted: Tue Jul 28, 2020 1:39 am
by barbaz
The HTML of the page with scripts disabled, from devtools -

Code: Select all

<!DOCTYPE html>
<html><head><script>document.write('<code>Javascript Is Enabled!!!!!!!!!</code>');</script>
<span>Javascript Is Blocked Or Unavailable.</span></head><body></body></html>
So NoScript does try to show the <noscript> tag, it just doesn't work on this page. I think the problem is that the <span> somehow ended up inside the <head> element.

Re: 11.0.34rc1 does not display <noscript> tags

Posted: Tue Jul 28, 2020 7:18 am
by skriptimaahinen
<noscript> is a valid tag for head and since you didn't specify where it goes, Firefox guessed head.

Noscript on the other hand does not care where the <noscript> is and converts all of them to <span>. For head it does not make much sense, but doesn't seem to break anything.

Re: 11.0.34rc1 does not display <noscript> tags

Posted: Wed Jul 29, 2020 2:36 pm
by Giorgio Maone
Please check latest dev build:
v 11.0.35rc2
============================================================
x Updated TLDs
x Fixed buggy policy references in the Options dialog
x More accurate NOSCRIPT element emulation
x Anticipate onScriptDisabled surrogates to first script-src
'none' CSP violation
x isTrusted checks for all the content events
x Improved look in mobile portrait mode

Re: 11.0.34rc1 does not display <noscript> tags

Posted: Wed Jul 29, 2020 3:54 pm
by barbaz
Fixed. Thanks Giorgio! Image

Re: [Fixed] 11.0.34rc1 does not display <noscript> tags

Posted: Fri Jul 31, 2020 11:53 am
by skriptimaahinen
Oh. I see. So noscript tags are put in the head like I said, BUT if scripts are disabled and the noscript tag contains stuff that doesn't belong to the head, Firefox moves it to the body. Interesting.

Consider this case:

Code: Select all

<!DOCTYPE html>
<html>
    <head>
        <noscript>
            <style>body {background-color:red}</style>
        </noscript>
        <style>body {background-color:blue}</style>
    </head>
    <body></body>
</html>
Naturally this shows blue bg for both javascript enabled and disabled, but since 11.0.35rc2 the noscript tag gets moved to the body and the bg becomes red when scripts are blocked.

Maybe not the most real-life example, but I think it's safe to say that it's not safe to indiscriminatorily move every noscript tag to the body. Need to check which are allowed to stay in the head. Though do note that apparently Firefox will move every tag to the body after the first non-allowed. Even those that are supposed to be in the head (e.g. meta).

For example:

Code: Select all

<!DOCTYPE html>
<html>
    <head>
        <noscript>
            <style>body {background-color:red}</style>
        </noscript>
        <noscript>
            This should not be in the head.
        </noscript>
        <style>body {background-color:blue}</style>
        <link rel="stylesheet" href="styles.css">
        <meta name="description" content="Really should be in the head.">
    </head>
    <body></body>
</html>
becomes

Code: Select all

<!DOCTYPE html>
<html>
    <head>
        <noscript>
            <style>body {background-color:red}</style>
        </noscript>
        <noscript></noscript>
    </head>
    <body>
        This should not be in the head.
        <style>body {background-color:blue}</style>
        <noscript><link rel="stylesheet" href="styles.css"></noscript>
        <meta name="description" content="Really should be in the head.">
    </body>
</html>
Note that interestingly the noscript tag of the first moved element itself is left in the head.