11.0.34rc1 does not display <noscript> tags

Bug reports and enhancement requests
Post Reply
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

11.0.34rc1 does not display <noscript> tags

Post 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.
*Always* check the changelogs BEFORE updating that important software!
-
User avatar
therube
Ambassador
Posts: 7924
Joined: Thu Mar 19, 2009 4:17 pm
Location: Maryland USA

Re: 11.0.34rc1 does not display <noscript> tags

Post by therube »

Confirmed.

Works as expected with NoScript disabled & toggling javascript.enabled.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball NoScript FlashGot AdblockPlus
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.4
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: 11.0.34rc1 does not display <noscript> tags

Post 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.
*Always* check the changelogs BEFORE updating that important software!
-
skriptimaahinen
Master Bug Buster
Posts: 244
Joined: Wed Jan 10, 2018 7:37 am

Re: 11.0.34rc1 does not display <noscript> tags

Post 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.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: 11.0.34rc1 does not display <noscript> tags

Post 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
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: 11.0.34rc1 does not display <noscript> tags

Post by barbaz »

Fixed. Thanks Giorgio! Image
*Always* check the changelogs BEFORE updating that important software!
-
skriptimaahinen
Master Bug Buster
Posts: 244
Joined: Wed Jan 10, 2018 7:37 am

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

Post 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.
Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0
Post Reply