diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /netwerk/test/browser/browser_103_redirect.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'netwerk/test/browser/browser_103_redirect.js')
-rw-r--r-- | netwerk/test/browser/browser_103_redirect.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/netwerk/test/browser/browser_103_redirect.js b/netwerk/test/browser/browser_103_redirect.js new file mode 100644 index 0000000000..d396813d50 --- /dev/null +++ b/netwerk/test/browser/browser_103_redirect.js @@ -0,0 +1,52 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +Services.prefs.setBoolPref("network.early-hints.enabled", true); + +const { test_hint_preload, request_count_checking } = + ChromeUtils.importESModule( + "resource://testing-common/early_hint_preload_test_helper.sys.mjs" + ); + +// Early hint to redirect to same origin in secure context +add_task(async function test_103_redirect_same_origin() { + await test_hint_preload( + "test_103_redirect_same_origin", + "https://example.com", + "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?https://example.com/browser/netwerk/test/browser/early_hint_pixel.sjs", + { hinted: 2, normal: 0 } // successful preload of redirect and resulting image + ); +}); + +// Early hint to redirect to cross origin in secure context +add_task(async function test_103_redirect_cross_origin() { + await test_hint_preload( + "test_103_redirect_cross_origin", + "https://example.com", + "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?https://example.net/browser/netwerk/test/browser/early_hint_pixel.sjs", + { hinted: 2, normal: 0 } + ); +}); + +// Early hint to redirect to cross origin in insecure context +add_task(async function test_103_redirect_insecure_cross_origin() { + await test_hint_preload( + "test_103_redirect_insecure_cross_origin", + "https://example.com", + "https://example.com/browser/netwerk/test/browser/early_hint_redirect.sjs?http://mochi.test:8888/browser/netwerk/test/browser/early_hint_pixel.sjs", + { hinted: 2, normal: 0 } + ); +}); + +// Cross origin preload from secure context to redirected insecure context on same domain +add_task(async function test_103_preload_redirect_mixed_content() { + await test_hint_preload( + "test_103_preload_redirect_mixed_content", + "https://example.org", + "https://example.org/browser/netwerk/test/browser/early_hint_redirect.sjs?http://example.org/browser/netwerk/test/browser/early_hint_pixel.sjs", + { hinted: 2, normal: 0 } + ); +}); |