-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make text/plugin/media/ua-inline no-quirks documents #6745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits.
I don't know what category about:blank
falls under (either HTML or ua-inline) but it'd be good to test that as well.
For plugin documents it's worth seeing what people do for same-origin PDFs and whether they actually generate documents with <embed>
. We might end up deleting that section or converting it into something else as part of the general plugins-are-only-PDFs-these-days deprecation...
Thanks for the quick review! The about:blank document isn't included here, as I would be afraid of compat issues with that one, given its usage. The spec there is already explicitly quirks-mode: https://html.spec.whatwg.org/#creating-a-new-browsing-context. Step 13 says to mark the document quirks-mode. I'll see what I can do about pdf/embed tests. You're right that a same-origin PDF should be testable, but that does assume all browsers support PDFs. While true, I don't think it's specified, so writing a WPT feels funny. I've got the easy ones (text/media) up in a patch now. |
I did a quick test at https://selective-heliotrope-dumpling.glitch.me/pdf-iframe.html and it looks like for PDFs, Chrome uses the spec's "Page load processing model for content that uses plugins" (with some minor embellishments), while Firefox uses "Page load processing model for inline content that doesn't have a DOM". Notably, the latter case has an opaque origin and thus cannot be tested. But the former case is same-origin. So I think a test for this would embed a PDF and pass either if accessing Also it'd be ideal to test the difference between |
Thanks for the quick test! I made it into a WPT using your suggestion to just pass in the Firefox case. WebKit currently fails this new test. |
Oh boy, maybe I should stop using |
The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933}
The [1] PR will change the standard so that plugin documents are in standard (no quirks) mode. This CL adds a test, as much as this is testable. Some UAs display PDF documents using "content that uses plugins" [2] while others use "inline content that doesn't have a DOM [3]. This test will pass in either case. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 [2] https://html.spec.whatwg.org/#read-plugin [3] https://html.spec.whatwg.org/#read-ua-inline Bug: 1131185 Change-Id: Iccd1668199ac8b3b1c90a69b97a0adbaf8d02655
The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933}
The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933}
The [1] PR will change the standard so that plugin documents are in standard (no quirks) mode. This CL adds a test, as much as this is testable. Some UAs display PDF documents using "content that uses plugins" [2] while others use "inline content that doesn't have a DOM [3]. This test will pass in either case. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 [2] https://html.spec.whatwg.org/#read-plugin [3] https://html.spec.whatwg.org/#read-ua-inline Bug: 1131185 Change-Id: Iccd1668199ac8b3b1c90a69b97a0adbaf8d02655
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note an alternate version here which might not require as many changes to DOM would be:
- Define that each document has a "parser cannot change the mode" boolean, e.g. around https://html.spec.whatwg.org/#overview-of-the-parsing-model or maybe even in https://html.spec.whatwg.org/#the-initial-insertion-mode
- Consult that boolean before performing the mode-setting in https://html.spec.whatwg.org/#the-initial-insertion-mode
source
Outdated
on <var>document</var>, with <var>new mode</var> set to <code data-x="">no-quirks</code>.</p></li> | ||
|
||
<li><p>Set <var>document</var>'s <span data-x="concept-document-mode-locked">mode locked</span> | ||
flag to <code data-x="">true</code>.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary for the non-text cases, I don't think...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm ok - we currently lock the mode for all of these documents, so I just implemented the spec the same way. Any harm in keeping it locked for all document types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it's pretty confusing for readers to add something to the spec that in actuality has no impact.
Hmm, so you'd add this in the HTML spec, not in DOM? I saw this comment after I ended up filing the DOM PR. The biggest changes are here in HTML, and the DOM change is pretty minimal. So let me know what you think as-is. |
I'll let @annevk make the call as to whether layering this throughout both HTML & DOM is worthwhile, versus keeping this specific to the HTML parser. |
…documents, a=testonly Automatic update from web-platform-tests Modify WPTs to check for standards mode documents The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933} -- wpt-commits: ce674ef72677377bc04c08c314a753c9274e3982 wpt-pr: 29269
I hadn't read this discussion when I read the DOM PR. From this discussion it seems that over time HTML might not use the HTML parser for these type of documents in which case this problem would not come up, right? From that perspective a solution local to HTML seems preferable, as it can be more easily refactored over time. |
Alright, I updated the PR to use this suggestion instead of making changes to DOM. I'm not sure I added the flag to Document in the right spot, it feels kind of tossed in. Let me know if there's a better spot for it. I also updated the non-normative descriptions for parse errors to be correct, but I'm not sure we need to do that? And finally, I removed the "mode locks" from all other document types except text mode. |
Hmm, upon a re-read, I think I misunderstood this comment:
I believe we still do need to change the mode, you were just saying we didn't need to "lock" it, since the parser doesn't try to change it. If that's correct, I can add back setting the mode to no-quirks for plugin/media/ua-inline documents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we still do need to change the mode, you were just saying we didn't need to "lock" it, since the parser doesn't try to change it. If that's correct, I can add back setting the mode to no-quirks for plugin/media/ua-inline documents.
Yeah, I think per your reasoning at #6745 (comment), we indeed still need to change the mode.
Ok, I put those three back. And address the rest of your comments. Let me know if I missed anything, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Can you update the OP with a link to the tests that have been updated for text and media? It's fine to not do plugin and ua-inline.
Similarly go ahead and file bugs on WebKit and Gecko.
@annevk want to give things a final look? If not I'll merge tomorrow; everything seems nice to me.
…documents, a=testonly Automatic update from web-platform-tests Modify WPTs to check for standards mode documents The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933} -- wpt-commits: ce674ef72677377bc04c08c314a753c9274e3982 wpt-pr: 29269
The [1] PR will change the standard so that media and text documents are in standard (no quirks) mode. This CL updates the tests accordingly. Chromium already made this change in code in Sept 2020 (see CLs on crbug.com/1131185) and found no compat issues. [1] whatwg/html#6745 Bug: 1131185 Change-Id: Ie5f5ae5eb802008bf27794c152620bdcc9948ba2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2945338 Auto-Submit: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#889933} NOKEYCHECK=True GitOrigin-RevId: 30f7aa86969987278f7e7ff98ed0a855a789fbeb
This change moves these four document types over to be "standards mode" documents.
To implement this, a new Document flag called "parser cannot change the mode" is added to the Document. This flag is checked before the parser tries to change the mode. If the flag is true, no change will be made.
Closes #5939, Closes #3113
/browsing-the-web.html ( diff )
/parsing.html ( diff )