diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /modules/libjar/test/mochitest | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'modules/libjar/test/mochitest')
-rw-r--r-- | modules/libjar/test/mochitest/bug403331.zip | bin | 0 -> 239 bytes | |||
-rw-r--r-- | modules/libjar/test/mochitest/bug403331.zip^headers^ | 1 | ||||
-rw-r--r-- | modules/libjar/test/mochitest/mochitest.ini | 11 | ||||
-rw-r--r-- | modules/libjar/test/mochitest/openredirect.sjs | 5 | ||||
-rw-r--r-- | modules/libjar/test/mochitest/test_bug1034143_mapped.html | 53 | ||||
-rw-r--r-- | modules/libjar/test/mochitest/test_bug1173171.html | 64 | ||||
-rw-r--r-- | modules/libjar/test/mochitest/test_bug403331.html | 47 |
7 files changed, 181 insertions, 0 deletions
diff --git a/modules/libjar/test/mochitest/bug403331.zip b/modules/libjar/test/mochitest/bug403331.zip Binary files differnew file mode 100644 index 000000000..48ba268dd --- /dev/null +++ b/modules/libjar/test/mochitest/bug403331.zip diff --git a/modules/libjar/test/mochitest/bug403331.zip^headers^ b/modules/libjar/test/mochitest/bug403331.zip^headers^ new file mode 100644 index 000000000..28b8aa0a5 --- /dev/null +++ b/modules/libjar/test/mochitest/bug403331.zip^headers^ @@ -0,0 +1 @@ +Content-Type: application/java-archive diff --git a/modules/libjar/test/mochitest/mochitest.ini b/modules/libjar/test/mochitest/mochitest.ini new file mode 100644 index 000000000..0ae466cca --- /dev/null +++ b/modules/libjar/test/mochitest/mochitest.ini @@ -0,0 +1,11 @@ +[DEFAULT] +support-files = + bug403331.zip + bug403331.zip^headers^ + openredirect.sjs + !/dom/base/test/file_bug945152.jar + +[test_bug403331.html] +[test_bug1034143_mapped.html] +run-if = os == 'linux' +[test_bug1173171.html]
\ No newline at end of file diff --git a/modules/libjar/test/mochitest/openredirect.sjs b/modules/libjar/test/mochitest/openredirect.sjs new file mode 100644 index 000000000..b6249cadf --- /dev/null +++ b/modules/libjar/test/mochitest/openredirect.sjs @@ -0,0 +1,5 @@ +function handleRequest(request, response) +{ + response.setStatusLine(request.httpVersion, 301, "Moved Permanently"); + response.setHeader("Location", request.queryString, false); +} diff --git a/modules/libjar/test/mochitest/test_bug1034143_mapped.html b/modules/libjar/test/mochitest/test_bug1034143_mapped.html new file mode 100644 index 000000000..d65ae31f2 --- /dev/null +++ b/modules/libjar/test/mochitest/test_bug1034143_mapped.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1034143 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 945152</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1034143">Mozilla Bug 1034143</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script type="application/javascript;version=1.7"> +// Ensure that XMLHttpRequest's memory-mapping code can handle a case +// where the nsIJARChannel's jarFile property is null, but which is +// otherwise eligible for bug 945152's memory-mapping optimization. + +function runTest() { + const jarURL = "jar:http://example.org/tests/dom/base/test/file_bug945152.jar!/data_1.txt"; + let xhr = new XMLHttpRequest({ mozAnon: true, mozSystem: true }); + xhr.open("GET", jarURL); + xhr.onerror = function onerror(e) { + ok(false, "JAR XHR failed: " + e.status); + SimpleTest.finish(); + }; + xhr.onload = function onload(e) { + ok(xhr.status == 200, "Status is 200"); + let ct = xhr.getResponseHeader("Content-Type"); + ok(ct.indexOf("mem-mapped") == -1, "Data is not memory-mapped"); + SimpleTest.finish(); + }; + xhr.responseType = 'arraybuffer'; + xhr.send(); +} + +SimpleTest.waitForExplicitFinish(); + +addLoadEvent(function() { + SpecialPowers.pushPrefEnv({"set": [["dom.mapped_arraybuffer.enabled", true], + ["network.jar.block-remote-files", false]]}, function() { + SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], runTest); + }); +}); +</script> +</pre> +</body> +</html> diff --git a/modules/libjar/test/mochitest/test_bug1173171.html b/modules/libjar/test/mochitest/test_bug1173171.html new file mode 100644 index 000000000..9fed630b3 --- /dev/null +++ b/modules/libjar/test/mochitest/test_bug1173171.html @@ -0,0 +1,64 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1173171 +--> +<head> + <title>Test for Bug 1173171</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> + +<iframe id="testFrame"></iframe> + +<pre id="test"> +<script class="testbody" type="application/javascript;version=1.7"> + +/** Test for Bug 1173171 **/ + +// __setPref(key, value)__. +// Set a pref value asynchronously, returning a prmoise that resolves +// when it succeeds. +let pushPref = function (key, value) { + return new Promise(function(resolve, reject) { + SpecialPowers.pushPrefEnv({"set": [[key, value]]}, resolve); + }); +}; + +// __xhr(method, url, responseType__. +// A simple async XMLHttpRequest call. +// Returns a promise with the response. +let xhr = function (method, url, responseType) { + return new Promise(function (resolve, reject) { + let xhr = new XMLHttpRequest(); + xhr.open(method, url, true); + xhr.onload = function () { + resolve(xhr.response); + }; + xhr.onerror = function() { + resolve(null); + }; + xhr.responseType = responseType; + xhr.send(); + }); +}; + +let jarURL = "jar:http://mochi.test:8888/tests/modules/libjar/test/mochitest/bug403331.zip!/test.html"; + +// Test behavior when blocking is deactivated and activated. +add_task(function* () { + for (let shouldBlock of [false, true]) { + yield pushPref("network.jar.block-remote-files", shouldBlock); + let response = yield xhr("GET", jarURL, "document"); + ok(shouldBlock === (response === null), + "Remote jars should be blocked if and only if the 'network.jar.block-remote-files' pref is active."); + } +}); + +</script> +</pre> + +</body> +</html> diff --git a/modules/libjar/test/mochitest/test_bug403331.html b/modules/libjar/test/mochitest/test_bug403331.html new file mode 100644 index 000000000..b292c4c9b --- /dev/null +++ b/modules/libjar/test/mochitest/test_bug403331.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=403331 +--> +<head> + <title>Test for Bug 403331</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> + +<iframe id="testFrame"></iframe> + +<pre id="test"> +<script class="testbody" type="text/javascript"> + +/** Test for Bug 403331 **/ + +SimpleTest.waitForExplicitFinish(); + +function runTest() { + var testFrame = document.getElementById('testFrame'); + + // Try a redirected load from another domain to this one. + + testFrame.onload = function() { + // If properly redirected, we'll be able to access elements in the loaded + // document. + var item = testFrame.contentDocument.getElementById('testitem'); + is(item.textContent, "testcontents", "Should be able to access the child document"); + + SimpleTest.finish(); + } + + testFrame.src = "jar:http://example.org:80/tests/modules/libjar/test/mochitest/openredirect.sjs?http://mochi.test:8888/tests/modules/libjar/test/mochitest/bug403331.zip!/test.html"; +} + +addLoadEvent(function() { + SpecialPowers.pushPrefEnv({"set": [["network.jar.block-remote-files", false]]}, runTest); +}); + +</script> +</pre> + +</body> +</html> |