From 0866d5a7c5f8abe9a80a03b3d5d83a153eb8b337 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Tue, 31 Jan 2023 15:47:07 +0000 Subject: [PATCH] Bug 1813489: Remove pref dom.security.secFetch.enabled, r=dveditz Differential Revision: https://phabricator.services.mozilla.com/D168229 --- dom/security/SecFetch.cpp | 5 ----- .../test/sec-fetch/browser_navigation.js | 8 ------- .../test_iframe_history_manipulation.html | 9 +++----- .../test_iframe_src_metaRedirect.html | 8 +++---- .../test_iframe_srcdoc_metaRedirect.html | 8 +++---- .../test_iframe_window_open_metaRedirect.html | 4 +--- .../test/sec-fetch/test_websocket.html | 22 +++++++------------ modules/libpref/init/StaticPrefList.yaml | 7 ------ .../meta/fetch/metadata/__dir__.ini | 1 - .../meta/fetch/metadata/redirect/__dir__.ini | 1 - 10 files changed, 18 insertions(+), 55 deletions(-) diff --git a/dom/security/SecFetch.cpp b/dom/security/SecFetch.cpp index 8ed850ee3420..5e8572972231 100644 --- a/dom/security/SecFetch.cpp +++ b/dom/security/SecFetch.cpp @@ -379,11 +379,6 @@ void mozilla::dom::SecFetch::AddSecFetchUser(nsIHttpChannel* aHTTPChannel) { } void mozilla::dom::SecFetch::AddSecFetchHeader(nsIHttpChannel* aHTTPChannel) { - // if sec-fetch-* is prefed off, then there is nothing to do - if (!StaticPrefs::dom_security_secFetch_enabled()) { - return; - } - nsCOMPtr uri; nsresult rv = aHTTPChannel->GetURI(getter_AddRefs(uri)); if (NS_WARN_IF(NS_FAILED(rv))) { diff --git a/dom/security/test/sec-fetch/browser_navigation.js b/dom/security/test/sec-fetch/browser_navigation.js index bb2490fd7c97..d35442081eb1 100644 --- a/dom/security/test/sec-fetch/browser_navigation.js +++ b/dom/security/test/sec-fetch/browser_navigation.js @@ -8,10 +8,6 @@ let gExpectedHeader = {}; async function setup() { waitForExplicitFinish(); - - await SpecialPowers.pushPrefEnv({ - set: [["dom.security.secFetch.enabled", true]], - }); } function checkSecFetchUser(subject, topic, data) { @@ -166,10 +162,6 @@ async function testNavigations() { add_task(async function() { waitForExplicitFinish(); - await SpecialPowers.pushPrefEnv({ - set: [["dom.security.secFetch.enabled", true]], - }); - await testNavigations(); // If fission is enabled we also want to test the navigations with the bfcache diff --git a/dom/security/test/sec-fetch/test_iframe_history_manipulation.html b/dom/security/test/sec-fetch/test_iframe_history_manipulation.html index 5d89c3c04add..5ec749bf4d5c 100644 --- a/dom/security/test/sec-fetch/test_iframe_history_manipulation.html +++ b/dom/security/test/sec-fetch/test_iframe_history_manipulation.html @@ -76,12 +76,9 @@ function iframeAction(test) { SimpleTest.waitForExplicitFinish(); -SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => { - testFrame = document.createElement('iframe'); - testFrame.src = `https://example.org/${REQUEST_PATH}?test`; - document.body.appendChild(testFrame); -}); - +testFrame = document.createElement('iframe'); +testFrame.src = `https://example.org/${REQUEST_PATH}?test`; +document.body.appendChild(testFrame); diff --git a/dom/security/test/sec-fetch/test_iframe_src_metaRedirect.html b/dom/security/test/sec-fetch/test_iframe_src_metaRedirect.html index c58d95233e97..28eae802268e 100644 --- a/dom/security/test/sec-fetch/test_iframe_src_metaRedirect.html +++ b/dom/security/test/sec-fetch/test_iframe_src_metaRedirect.html @@ -86,11 +86,9 @@ script.addMessageListener("test-pass", async () => { SimpleTest.finish(); }); -SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => { - let frame = document.createElement("iframe"); - frame.src = REQUEST_URL + "?meta"; - document.body.appendChild(frame); -}); +let frame = document.createElement("iframe"); +frame.src = REQUEST_URL + "?meta"; +document.body.appendChild(frame); diff --git a/dom/security/test/sec-fetch/test_iframe_srcdoc_metaRedirect.html b/dom/security/test/sec-fetch/test_iframe_srcdoc_metaRedirect.html index e44700541dab..adee5afe84fc 100644 --- a/dom/security/test/sec-fetch/test_iframe_srcdoc_metaRedirect.html +++ b/dom/security/test/sec-fetch/test_iframe_srcdoc_metaRedirect.html @@ -86,11 +86,9 @@ script.addMessageListener("test-pass", async () => { SimpleTest.finish(); }); -SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => { - let frame = document.createElement("iframe"); - frame.srcdoc = ``; - document.body.appendChild(frame); -}); +let frame = document.createElement("iframe"); +frame.srcdoc = ``; +document.body.appendChild(frame); diff --git a/dom/security/test/sec-fetch/test_iframe_window_open_metaRedirect.html b/dom/security/test/sec-fetch/test_iframe_window_open_metaRedirect.html index b45ed25a6b26..b532baeb5e09 100644 --- a/dom/security/test/sec-fetch/test_iframe_window_open_metaRedirect.html +++ b/dom/security/test/sec-fetch/test_iframe_window_open_metaRedirect.html @@ -91,9 +91,7 @@ script.addMessageListener("test-pass", async () => { SimpleTest.finish(); }); -SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => { - testWindow = window.open(REQUEST_URL + "?meta"); -}); +testWindow = window.open(REQUEST_URL + "?meta"); diff --git a/dom/security/test/sec-fetch/test_websocket.html b/dom/security/test/sec-fetch/test_websocket.html index 640ccaaf7068..33053ff20a09 100644 --- a/dom/security/test/sec-fetch/test_websocket.html +++ b/dom/security/test/sec-fetch/test_websocket.html @@ -60,20 +60,14 @@ script.addMessageListener("test-end", () => { checkTestsDone(); }); -function test_sec_fetch_websocket() { - var wssSocket = new WebSocket("wss://example.com/tests/dom/security/test/sec-fetch/file_websocket"); - wssSocket.onopen = function(e) { - ok(true, "sanity: wssSocket onopen"); - checkTestsDone(); - }; - wssSocket.onerror = function(e) { - ok(false, "sanity: wssSocket onerror"); - }; -} - -SpecialPowers.pushPrefEnv({ - set: [["dom.security.secFetch.enabled", true]] -}, test_sec_fetch_websocket); +var wssSocket = new WebSocket("wss://example.com/tests/dom/security/test/sec-fetch/file_websocket"); +wssSocket.onopen = function(e) { + ok(true, "sanity: wssSocket onopen"); + checkTestsDone(); +}; +wssSocket.onerror = function(e) { + ok(false, "sanity: wssSocket onerror"); +}; diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 46e14af92616..f3687f125855 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -3599,13 +3599,6 @@ value: false mirror: always -# This pref enables Sec-Fetch-* logic and causes corresponding -# request headers to be set. -- name: dom.security.secFetch.enabled - type: RelaxedAtomicBool - value: true - mirror: always - # This pref enables the featurePolicy header support. - name: dom.security.featurePolicy.header.enabled type: bool diff --git a/testing/web-platform/meta/fetch/metadata/__dir__.ini b/testing/web-platform/meta/fetch/metadata/__dir__.ini index 889ab8587196..e045b640ba98 100644 --- a/testing/web-platform/meta/fetch/metadata/__dir__.ini +++ b/testing/web-platform/meta/fetch/metadata/__dir__.ini @@ -1,3 +1,2 @@ -prefs: [dom.security.secFetch.enabled:true] lsan-allowed: [Alloc, Create, MakeUnique, Malloc, PLDHashTable::ChangeTable, PLDHashTable::MakeEntryHandle, Realloc, allocate, createTable, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::Permission::Create, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::dom::BrowsingContext::Attach, mozilla::dom::BrowsingContext::CreateChildSHistory, mozilla::dom::BrowsingContext::CreateDetached, mozilla::dom::CanonicalBrowsingContext::GetSecureBrowserUI, mozilla::dom::ContentParent::CreateBrowser, mozilla::dom::Performance::CreateForMainThread, mozilla::dom::PerformanceMainThread::CreateNavigationTimingEntry, mozilla::dom::ReferrerInfo::Clone, mozilla::dom::ServiceWorker::Create, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::HttpBaseChannel::CloneLoadInfoForRedirect, mozilla::net::HttpBaseChannel::HttpBaseChannel, mozilla::net::nsStandardURL::TemplatedMutator, nsDynamicAtom::Create, nsHashPropertyBagBase::SetPropertyAsInterface, operator] leak-threshold: [default:51200, tab:358400] diff --git a/testing/web-platform/meta/fetch/metadata/redirect/__dir__.ini b/testing/web-platform/meta/fetch/metadata/redirect/__dir__.ini index 6dd9fd95e011..e3cf82e1a218 100644 --- a/testing/web-platform/meta/fetch/metadata/redirect/__dir__.ini +++ b/testing/web-platform/meta/fetch/metadata/redirect/__dir__.ini @@ -1,3 +1,2 @@ -prefs: [dom.security.secFetch.enabled:true] lsan-disabled: true leak-threshold: [tab:51200]