From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../originattributes/test/browser/file_saveAs.sjs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 browser/components/originattributes/test/browser/file_saveAs.sjs (limited to 'browser/components/originattributes/test/browser/file_saveAs.sjs') diff --git a/browser/components/originattributes/test/browser/file_saveAs.sjs b/browser/components/originattributes/test/browser/file_saveAs.sjs new file mode 100644 index 0000000000..6be46daa6a --- /dev/null +++ b/browser/components/originattributes/test/browser/file_saveAs.sjs @@ -0,0 +1,40 @@ +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}`); +} -- cgit v1.2.3