From 6ba66f43cf00c609d10197d15f129061468a5a50 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 25 Oct 2015 11:52:39 -0400 Subject: [PATCH] Add a test for contextual MIME sniffing. --- tests/wpt/mozilla/meta/MANIFEST.json | 6 ++ .../mime_sniffing_font_context.html.ini | 2 + .../mozilla/mime_sniffing_font_context.html | 85 +++++++++++++++++++ .../tests/mozilla/resources/no_mime_type.py | 11 +++ 4 files changed, 104 insertions(+) create mode 100644 tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini create mode 100644 tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html create mode 100644 tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3ac785d5da7..97a488de177 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -5685,6 +5685,12 @@ "url": "/_mozilla/mozilla/load_event.html" } ], + "mozilla/mime_sniffing_font_context.html": [ + { + "path": "mozilla/mime_sniffing_font_context.html", + "url": "/_mozilla/mozilla/mime_sniffing_font_context.html" + } + ], "mozilla/mozbrowser/iframe_goback.html": [ { "path": "mozilla/mozbrowser/iframe_goback.html", diff --git a/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini b/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini new file mode 100644 index 00000000000..92e5aeb2640 --- /dev/null +++ b/tests/wpt/mozilla/meta/mozilla/mime_sniffing_font_context.html.ini @@ -0,0 +1,2 @@ +[mime_sniffing_font_context.html] + prefs: ['net.mime.sniff:true'] diff --git a/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html b/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html new file mode 100644 index 00000000000..ab0bc5d81c8 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/mime_sniffing_font_context.html @@ -0,0 +1,85 @@ + + +Sniffed Content-Type for @font-face is different than XHR + + + +w w
+w w
+w w
+ diff --git a/tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py b/tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py new file mode 100644 index 00000000000..55304d50081 --- /dev/null +++ b/tests/wpt/mozilla/tests/mozilla/resources/no_mime_type.py @@ -0,0 +1,11 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +def main(request, response): + headers = [] + if 'Content-Type' in request.GET: + headers += [('Content-Type', request.GET['Content-Type'])] + with open('./resources/ahem/AHEM____.TTF') as f: + return 200, headers, f.read()