const HTTP_ORIGIN = "http://example.com"; const SECOND_ORIGIN = "http://example.org"; const URI_PATH = "/browser/browser/components/originattributes/test/browser/"; const LINK_PATH = `${URI_PATH}file_saveAs.sjs`; // Reusing existing ogv file for testing. const VIDEO_PATH = `${URI_PATH}file_thirdPartyChild.video.ogv`; // Reusing existing png file for testing. const IMAGE_PATH = `${URI_PATH}file_favicon.png`; const FRAME_PATH = `${SECOND_ORIGIN}${URI_PATH}file_saveAs.sjs?image=1`; Cu.importGlobalProperties(["URLSearchParams"]); function handleRequest(aRequest, aResponse) { var params = new URLSearchParams(aRequest.queryString); aResponse.setStatusLine(aRequest.httpVersion, 200); aResponse.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); let contentBody = ""; if (params.has("link")) { contentBody = `this is a link`; } else if (params.has("video")) { contentBody = ``; } else if (params.has("image")) { contentBody = ``; } else if (params.has("page")) { // We need at least one resource, like a img, a link or a script, to trigger // downloading resources in "Save Page As". Otherwise, it will output the // document directly without any network request. contentBody = ``; } else if (params.has("frame")) { // Like "Save Page As", we need to put at least one resource in the frame. // Here we also use a image. contentBody = ``; } else if (params.has("pageinfo")) { contentBody = ` `; } aResponse.write(`${contentBody}`); }