forked from mirrors/gecko-dev
Modify related test files to test documents with COOP headers enabled. There are some tests that fail when run with new COOP configurations without Fission enabled, prior to fixes that come in part 2. This means that some of the COOP behaviour was already broken. Since fixing non-Fission COOP behaviour prior to this patch is out of scope, I skipped calling `addCoopTask` to test COOP documents in non Fission cases for such tests. Even with COOP headers disabled, some tests fail when the document they load is served over httpS and not http. For a single test where this behaviour was occuring prior to fixes in part 2, I skipped testing an HTTPS non-COOP document and filed 1703351 to fix such behaviour. Differential Revision: https://phabricator.services.mozilla.com/D110993
30 lines
995 B
JavaScript
30 lines
995 B
JavaScript
function handleRequest(request, response) {
|
|
Components.utils.importGlobalProperties(["URLSearchParams"]);
|
|
Components.utils.import("resource://gre/modules/NetUtil.jsm");
|
|
let query = new URLSearchParams(request.queryString);
|
|
|
|
response.setHeader("Cross-Origin-Opener-Policy", "same-origin", false);
|
|
response.setHeader("Cross-Origin-Embedder-Policy", "require-corp", false);
|
|
|
|
var fileRoot = query.get("fileRoot");
|
|
|
|
// Get the desired file
|
|
var file;
|
|
getObjectState("SERVER_ROOT", function(serverRoot) {
|
|
file = serverRoot.getFile(fileRoot);
|
|
});
|
|
|
|
// Set up the file streams to read in the file as UTF-8
|
|
let fstream = Components.classes["@mozilla.org/network/file-input-stream;1"].
|
|
createInstance(Components.interfaces.nsIFileInputStream);
|
|
|
|
fstream.init(file, -1, 0, 0);
|
|
|
|
// Read the file
|
|
let available = fstream.available();
|
|
let data =
|
|
available > 0 ? NetUtil.readInputStreamToString(fstream, available) : "";
|
|
fstream.close();
|
|
|
|
response.write(data);
|
|
}
|