summaryrefslogtreecommitdiffstats
path: root/dom/security/test/referrer-policy
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/security/test/referrer-policy
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/security/test/referrer-policy')
-rw-r--r--dom/security/test/referrer-policy/browser.toml4
-rw-r--r--dom/security/test/referrer-policy/browser_session_history.js (renamed from dom/security/test/referrer-policy/browser_fragment_navigation.js)17
-rw-r--r--dom/security/test/referrer-policy/file_session_history.sjs (renamed from dom/security/test/referrer-policy/file_fragment_navigation.sjs)14
-rw-r--r--dom/security/test/referrer-policy/referrer_helper.js4
-rw-r--r--dom/security/test/referrer-policy/test_img_referrer.html4
5 files changed, 32 insertions, 11 deletions
diff --git a/dom/security/test/referrer-policy/browser.toml b/dom/security/test/referrer-policy/browser.toml
index 325b6a3f49..a77046c85b 100644
--- a/dom/security/test/referrer-policy/browser.toml
+++ b/dom/security/test/referrer-policy/browser.toml
@@ -1,8 +1,8 @@
[DEFAULT]
support-files = ["referrer_page.sjs"]
-["browser_fragment_navigation.js"]
-support-files = ["file_fragment_navigation.sjs"]
+["browser_session_history.js"]
+support-files = ["file_session_history.sjs"]
["browser_referrer_disallow_cross_site_relaxing.js"]
diff --git a/dom/security/test/referrer-policy/browser_fragment_navigation.js b/dom/security/test/referrer-policy/browser_session_history.js
index c3d5e62854..b480ce4ff0 100644
--- a/dom/security/test/referrer-policy/browser_fragment_navigation.js
+++ b/dom/security/test/referrer-policy/browser_session_history.js
@@ -4,7 +4,7 @@
"use strict";
const TEST_FILE =
- "https://example.com/browser/dom/security/test/referrer-policy/file_fragment_navigation.sjs";
+ "https://example.com/browser/dom/security/test/referrer-policy/file_session_history.sjs";
add_task(async function test_browser_navigation() {
await BrowserTestUtils.withNewTab(TEST_FILE, async browser => {
@@ -37,6 +37,21 @@ add_task(async function test_browser_navigation() {
content.document.getElementById("ok"),
"Page should load when checking referrer after fragment navigation and reload"
);
+
+ info("Clicking on push_state button");
+ content.document.getElementById("push_state").click();
+ });
+
+ info("Reloading tab");
+ loadPromise = BrowserTestUtils.browserLoaded(browser);
+ await BrowserTestUtils.reloadTab(gBrowser.selectedTab);
+ await loadPromise;
+
+ await SpecialPowers.spawn(browser, [], () => {
+ ok(
+ content.document.getElementById("ok"),
+ "Page should load when checking referrer after history.pushState and reload"
+ );
});
});
});
diff --git a/dom/security/test/referrer-policy/file_fragment_navigation.sjs b/dom/security/test/referrer-policy/file_session_history.sjs
index 5fb6f0d826..3d5f06b026 100644
--- a/dom/security/test/referrer-policy/file_fragment_navigation.sjs
+++ b/dom/security/test/referrer-policy/file_session_history.sjs
@@ -6,16 +6,22 @@ function handleRequest(request, response) {
request.queryString === "check_referrer" &&
(!request.hasHeader("referer") ||
request.getHeader("referer") !==
- "https://example.com/browser/dom/security/test/referrer-policy/file_fragment_navigation.sjs")
+ "https://example.com/browser/dom/security/test/referrer-policy/file_session_history.sjs")
) {
response.setStatusLine(request.httpVersion, 400, "Bad Request");
response.write("Did not receive referrer");
} else {
response.setHeader("Content-Type", "text/html");
response.write(
- `<span id="ok">OK</span>
-<a id="check_referrer" href="?check_referrer">check_referrer</a>
-<a id="fragment" href="#fragment">fragment</a>`
+ `<span id="ok">OK</span>
+ <a id="check_referrer" href="?check_referrer">check_referrer</a>
+ <a id="fragment" href="#fragment">fragment</a>
+ <script>
+ function pushState(){
+ history.pushState({}, "", location);
+ }
+ </script>
+ <button id="push_state" onclick="pushState();" >push_state</button>`
);
}
}
diff --git a/dom/security/test/referrer-policy/referrer_helper.js b/dom/security/test/referrer-policy/referrer_helper.js
index b892017eef..92593fa907 100644
--- a/dom/security/test/referrer-policy/referrer_helper.js
+++ b/dom/security/test/referrer-policy/referrer_helper.js
@@ -61,7 +61,7 @@ function checkIndividualResults(aTestname, aExpectedReferrer, aName) {
);
advance();
};
- var onerror = xhr => {
+ var onerror = () => {
ok(false, "Can't get results from the counter server.");
SimpleTest.finish();
};
@@ -69,7 +69,7 @@ function checkIndividualResults(aTestname, aExpectedReferrer, aName) {
}
function resetState() {
- doXHR(RESET_STATE, advance, function (xhr) {
+ doXHR(RESET_STATE, advance, function () {
ok(false, "error in reset state");
SimpleTest.finish();
});
diff --git a/dom/security/test/referrer-policy/test_img_referrer.html b/dom/security/test/referrer-policy/test_img_referrer.html
index fcc80929d2..5e3a2e6ddf 100644
--- a/dom/security/test/referrer-policy/test_img_referrer.html
+++ b/dom/security/test/referrer-policy/test_img_referrer.html
@@ -64,7 +64,7 @@ function checkIndividualResults(aTestname, aExpectedImg, aName) {
advance();
},
- function(xhr) {
+ function() {
ok(false, "Can't get results from the counter server.");
SimpleTest.finish();
});
@@ -73,7 +73,7 @@ function checkIndividualResults(aTestname, aExpectedImg, aName) {
function resetState() {
doXHR('/tests/dom/security/test/referrer-policy/img_referrer_testserver.sjs?action=resetState',
advance,
- function(xhr) {
+ function() {
ok(false, "error in reset state");
SimpleTest.finish();
});