Closed Bug 1653474 Opened 7 months ago Closed 6 months ago

dynamic insert http-equiv='refresh' meta on an already loaded document doesn't create navigation

Categories

(Core :: DOM: Core & HTML, defect, P3)

80 Branch
defect

Tracking

()

RESOLVED FIXED
81 Branch
Webcompat Priority P3
Tracking Status
firefox79 --- wontfix
firefox80 --- wontfix
firefox81 --- fixed

People

(Reporter: karlcow, Assigned: sefeng)

References

()

Details

Attachments

(3 files, 1 obsolete file)

See the test case with this document.

In an already loaded document, insert dynamically anywhere in the body of the document, a meta with http-equiv='refresh' such as

<meta http-equiv="refresh" content="0; url=http://www.mozilla.org/">

Actual:
nothing is happening

Expected:
navigation to http://www.mozilla.org/ should happen

  • FAIL in Firefox Nightly Desktop 80.0a1 (2020-07-16) (64-bit)
  • WORK in
    • Safari Tech Preview Release 110 (Safari 14.0, WebKit 15610.1.21.0.2)
    • Chrome Canary Version 86.0.4204.0 (Build officiel) canary (64 bits)

Specification
https://html.spec.whatwg.org/#pragma-directives

When a meta element is inserted into the document, if its http-equiv attribute is present and represents one of the above states, then the user agent must run the algorithm appropriate for that state, as described in the following list:

This creates a webcompat issue
https://webcompat.com/issues/55451

Severity: -- → S3
Priority: -- → P3

https://searchfox.org/mozilla-central/rev/d6d8fcc22c3820f2ae08229e0d37be19fba74db9/dom/base/nsContentSink.cpp#736-775 runs during parsing. It should probably run whenever a meta element is added to tree.

I'll get a patch up.

Assignee: nobody → sefeng
Blocks: 1653157

Spec: https://html.spec.whatwg.org/#pragma-directives

When a meta element is inserted into the document, the
refresh steps should run if certain criteria is met.

Attachment #9164792 - Attachment is obsolete: true

It turns out we did this intentionally/differently per https://github.com/whatwg/html/pull/2198#issuecomment-268356668 and https://www.w3.org/Bugs/Public/show_bug.cgi?id=28520#c5, and there's whatwg/html issue to investigate this behaviour.

I think we need some context here to learn why we did this, and this was something I couldn't figure from reading our code.

Perhaps annevk can provide something here?

Flags: needinfo?(annevk)

The way I read bz's comment there is that this is how we decided to implement this initially without attaching much value to it. Evidently other browsers took a different route. Unfortunately for us web compatibility is aligned with them (as is the specification).

So it seems to me we should fix this and then add a comment to https://github.com/whatwg/html/issues/2210 saying that Firefox is now aligned with the specification, ideally with a pointer to new WPT tests. Hope that helps.

Flags: needinfo?(annevk)
Webcompat Priority: ? → P3

Spec: https://html.spec.whatwg.org/#pragma-directives

When a meta element is inserted into the document, the
refresh steps should run if certain criteria is met.

Depends on D84545

Attachment #9165432 - Attachment description: Bug 1653474 - Fix refresh steps don't run when a meta element is inserted → Bug 1653474 - Process META elements when it's inserted
Attachment #9165433 - Attachment description: Bug 1653474 - Fix meta tag related wpt test → Bug 1653474 - Update meta element related tests
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/885c9b25c9ff
Process META elements when it's inserted r=smaug
https://hg.mozilla.org/integration/autoland/rev/d6ead0115fc4
Update meta element related tests r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/24896 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch

I'm assuming this can ride the trains, feel free to reset status and request uplift otherwise.

Duplicate of this bug: 1653157
Regressions: 1662525
You need to log in before you can comment on or make changes to this bug.