mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 877500 - Test. r=joshmoz
This commit is contained in:
parent
6ecbb80f72
commit
66bf9bc41f
@ -16,6 +16,7 @@ MOCHITEST_FILES = \
|
||||
handlerApps.js \
|
||||
handlerApp.xhtml \
|
||||
unsafeBidiFileName.sjs \
|
||||
test_badMimeType.html \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
27
uriloader/exthandler/tests/mochitest/test_badMimeType.html
Normal file
27
uriloader/exthandler/tests/mochitest/test_badMimeType.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Crashtest for bad MIME type</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
const Cc = SpecialPowers.Cc;
|
||||
const Ci = SpecialPowers.Ci;
|
||||
const mimeService = Cc["@mozilla.org/mime;1"].
|
||||
getService(Ci.nsIMIMEService);
|
||||
// "text/plain" has an 0xFF character appended to it. This means it's an
|
||||
// invalid string, which is tricky to enter using a text editor (I used
|
||||
// emacs' hexl-mode). It also means an ordinary text editor might drop it
|
||||
// or convert it to something that *is* valid (in UTF8). So we measure
|
||||
// its length to make sure this hasn't happened.
|
||||
var badMimeType = "text/plainÿ";
|
||||
ok(badMimeType.length == 11, "badMimeType has changed, making this test invalid");
|
||||
mimeService.getFromTypeAndExtension(badMimeType, "txt");
|
||||
ok(true, "The test shouldn't trigger a crash");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user