Skip to content

Commit

Permalink
Bug 1813489: Remove pref dom.security.secFetch.enabled, r=dveditz
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Kerschbaumer committed Jan 31, 2023
1 parent c9c81d4 commit 0866d5a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 55 deletions.
5 changes: 0 additions & 5 deletions dom/security/SecFetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<nsIURI> uri;
nsresult rv = aHTTPChannel->GetURI(getter_AddRefs(uri));
if (NS_WARN_IF(NS_FAILED(rv))) {
Expand Down
8 changes: 0 additions & 8 deletions dom/security/test/sec-fetch/browser_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ let gExpectedHeader = {};

async function setup() {
waitForExplicitFinish();

await SpecialPowers.pushPrefEnv({
set: [["dom.security.secFetch.enabled", true]],
});
}

function checkSecFetchUser(subject, topic, data) {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@

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);

</script>
</body>
Expand Down
8 changes: 3 additions & 5 deletions dom/security/test/sec-fetch/test_iframe_src_metaRedirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@
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);

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@
SimpleTest.finish();
});

SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => {
let frame = document.createElement("iframe");
frame.srcdoc = `<meta http-equiv="refresh" content="0; url='${REQUEST_URL}?meta'">`;
document.body.appendChild(frame);
});
let frame = document.createElement("iframe");
frame.srcdoc = `<meta http-equiv="refresh" content="0; url='${REQUEST_URL}?meta'">`;
document.body.appendChild(frame);

</script>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@
SimpleTest.finish();
});

SpecialPowers.pushPrefEnv({set: [["dom.security.secFetch.enabled", true]]}, async () => {
testWindow = window.open(REQUEST_URL + "?meta");
});
testWindow = window.open(REQUEST_URL + "?meta");

</script>
</body>
Expand Down
22 changes: 8 additions & 14 deletions dom/security/test/sec-fetch/test_websocket.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,14 @@
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");
};

</script>
</body>
Expand Down
7 changes: 0 additions & 7 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion testing/web-platform/meta/fetch/metadata/__dir__.ini
Original file line number Diff line number Diff line change
@@ -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]
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
prefs: [dom.security.secFetch.enabled:true]
lsan-disabled: true
leak-threshold: [tab:51200]

0 comments on commit 0866d5a

Please sign in to comment.