Skip to content

Commit

Permalink
MIME Sniffing: HTML no feed
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored and sadym-chromium committed Jul 18, 2024
1 parent 454d8b9 commit ad940fd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mimesniff/sniffing/html.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
["atom", "rss"].forEach(item => {
async_test(t => {
const popup = window.open(`support/${item}.html`);
t.add_cleanup(() => popup.close());
popup.onload = t.step_func_done(() => {
assert_equals(popup.document.contentType, "text/html");
assert_equals(popup.document.documentElement.localName, "html");
assert_equals(popup.document.documentElement.namespaceURI, "http://www.w3.org/1999/xhtml");
assert_equals(popup.document.querySelector("b").namespaceURI, "http://www.w3.org/1999/xhtml");
});
}, `HTML is not sniffed for a "feed": ${item}`);
});
3 changes: 3 additions & 0 deletions mimesniff/sniffing/support/atom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<atom>
<b>HELLO</b>
</atom>
3 changes: 3 additions & 0 deletions mimesniff/sniffing/support/rss.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<rss>
<b>HELLO</b>
</rss>

0 comments on commit ad940fd

Please sign in to comment.