meta refresh outside of <noscipt> is blocked

Bug reports and enhancement requests
Post Reply
al_9x
Master Bug Buster
Posts: 931
Joined: Thu Mar 19, 2009 4:52 pm

meta refresh outside of <noscipt> is blocked

Post by al_9x »

if <noscript> is exists somewhere in the page

Code: Select all

<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.google.com/">
</head>
<body>
<noscript></noscript>
</body>
</html>
processMetaRefresh doesn't check if <meta> is inside <noscript>

fx 3.6.3, ns 1.9.9.84
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: meta refresh outside of <noscipt> is blocked

Post by Giorgio Maone »

Unfortunately that's the only valid heuristic to implement this feature, because Gecko's HTML parser has the bad habit of moving to head META elements found in the body, leaving the surrounding <NOSCRIPT> elements in their original places.

For instance,

Code: Select all

<html>
<head>
</head>
<body>
<noscript><meta http-equiv="refresh" content="0;url=http://www.google.com/"></noscript>
</body>
</html>
internally becomes exactly identical to your sample, i.e.

Code: Select all

<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.google.com/">
</head>
<body>
<noscript></noscript>
</body>
</html>
The new HTML 5 parser in Firefox 4 doesn't perform this kind of unexpected transformations, therefore I'll be able to be more precise. Will drop a conditional path for pref("html5.enabled") == true in next build.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: meta refresh outside of <noscipt> is blocked

Post by dhouwn »

Is the new parser always used when the pref is set? What about quirks mode, XHTML and other edge cases?
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.0 (KHTML, like Gecko) Chrome/6.0.408.1 Safari/534.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: meta refresh outside of <noscipt> is blocked

Post by Giorgio Maone »

dhouwn wrote:Is the new parser always used when the pref is set?
Yes it is.
dhouwn wrote:What about quirks mode, XHTML and other edge cases?
HTML 5, differently from HTML 4 and XHTML, aside conformance rules specifies also rules for parsing (something sorely missing from previous specification, and one of the causes of the browser compatibility hell).
These rules have been agreed upon by browser vendors, picking the most common/reasonable behavior among existing browsers.
Therefore in most cases (like this), unreasonable and/or niche quirks just go away also for legacy HTML 4/XHTML documents, which are parsed by the new parser.

Anyway, latest development build implements the aforementioned behavior.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: meta refresh outside of <noscipt> is blocked

Post by dhouwn »

Did a little test in Firefox trunk with the HTML5 parser activated and meta-refresh redirections inside noscript-tags are not blocked for XHTML:

Code: Select all

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head></head>
<body>
<noscript><meta http-equiv="refresh" content="0;url=http://www.example.org/" /></noscript>
</body>
</html>
(Save as .xhtml)
Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:1.9.3a5pre) Gecko/20100601 Firefox/3.7
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: meta refresh outside of <noscipt> is blocked

Post by Giorgio Maone »

dhouwn wrote:Did a little test in Firefox trunk with the HTML5 parser activated and meta-refresh redirections inside noscript-tags are not blocked for XHTML:

Code: Select all

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head></head>
<body>
<noscript><meta http-equiv="refresh" content="0;url=http://www.example.org/" /></noscript>
</body>
</html>
(Save as .xhtml)
They are blocked for me, using your source both from a local .xhtml file and from http://evil.hackademix.net/test/meta/xhtml.xhtml
Is the relevant NoScript|Untrusted option checked?
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
al_9x
Master Bug Buster
Posts: 931
Joined: Thu Mar 19, 2009 4:52 pm

Re: meta refresh outside of <noscipt> is blocked

Post by al_9x »

blocked for me as well with:

Code: Select all

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a5pre) Gecko/20100531 Minefield/3.7a5pre
One thing I noticed, no blocked alert bar on back or forward (fx 3.6.3 & minefield)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: meta refresh outside of <noscipt> is blocked

Post by Giorgio Maone »

al_9x wrote:One thing I noticed, no blocked alert bar on back or forward (fx 3.6.3 & minefield)
The bar happens on DOMContentLoaded, which doesn't fire if a page is in the BFCache.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
al_9x
Master Bug Buster
Posts: 931
Joined: Thu Mar 19, 2009 4:52 pm

Re: meta refresh outside of <noscipt> is blocked

Post by al_9x »

Giorgio Maone wrote:
al_9x wrote:One thing I noticed, no blocked alert bar on back or forward (fx 3.6.3 & minefield)
The bar happens on DOMContentLoaded, which doesn't fire if a page is in the BFCache.
Are there perhaps other events, this thread seems to suggest that OnStateChange should fire?
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
dhouwn
Bug Buster
Posts: 968
Joined: Thu Mar 19, 2009 12:51 pm

Re: meta refresh outside of <noscipt> is blocked

Post by dhouwn »

Strange, I tested it with a normal HTML file and one without a DOCTYPE (quirks mode) and it blocked the redirect, but not for the XHTML file.
I can't reproduce this anymore, so I guess I just accidentally allowed the redirect once. Otherwise I would have suspected an extension.

/edit: It remembers the permission for redirection for all local XHTML files once I allowed it for a local file of this type?!
/edit: Yepp, seems so. Save my test file as a .xhtml, open it, allow the redirection, rename it (but leave file extension), open it, and you are instantly redirected, edit file extension to .html and no redirection.
Mozilla/5.0 (Windows; U; Windows NT 6.1; Win64; x64; en-US; rv:1.9.3a5pre) Gecko/20100602 Firefox/3.7
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: meta refresh outside of <noscipt> is blocked

Post by Giorgio Maone »

dhouwn wrote:/edit: It remembers the permission for redirection for all local XHTML files once I allowed it for a local file of this type?!
Yes, it remembers by domain (file:/// is treated as a domain).
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Post Reply