зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1907304) for causing failures in browser_net_offline_mode.js CLOSED TREE
Backed out changeset 17ad7316a6df (bug 1907304) Backed out changeset c872b365b709 (bug 1907304)
This commit is contained in:
Родитель
971c9b0a9f
Коммит
23d824ce11
|
@ -512,8 +512,6 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
|
|||
|
||||
["browser_net_throttle.js"]
|
||||
|
||||
["browser_net_throttling_cached.js"]
|
||||
|
||||
["browser_net_throttling_profiles.js"]
|
||||
|
||||
["browser_net_timeline_ticks.js"]
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
profiles,
|
||||
PROFILE_CONSTANTS,
|
||||
} = require("resource://devtools/client/shared/components/throttling/profiles.js");
|
||||
|
||||
const offlineProfile = profiles.find(
|
||||
profile => profile.id === PROFILE_CONSTANTS.OFFLINE
|
||||
);
|
||||
|
||||
const CACHED_URL = STATUS_CODES_SJS + "?sts=ok&cached&test_cached";
|
||||
|
||||
add_setup(async function () {
|
||||
await pushPref("devtools.cache.disabled", false);
|
||||
});
|
||||
|
||||
add_task(async function () {
|
||||
const { monitor } = await initNetMonitor(SIMPLE_URL, { requestCount: 1 });
|
||||
const { connector } = monitor.panelWin;
|
||||
const { updateNetworkThrottling } = connector;
|
||||
|
||||
// Throttle the network before entering the content process
|
||||
await updateNetworkThrottling(true, offlineProfile);
|
||||
|
||||
// The request is blocked since the profile is offline
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[CACHED_URL],
|
||||
async url => {
|
||||
try {
|
||||
await content.fetch(url);
|
||||
ok(false, "Should not load since tab is offline");
|
||||
} catch (err) {
|
||||
is(err.name, "TypeError", "Should fail since profile is offline");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Disable throttling
|
||||
await updateNetworkThrottling(false);
|
||||
|
||||
// Fetch to prime the cache
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[CACHED_URL],
|
||||
async url => {
|
||||
await content.fetch(url);
|
||||
}
|
||||
);
|
||||
|
||||
// Set profile to offline again
|
||||
await updateNetworkThrottling(true, offlineProfile);
|
||||
|
||||
// Check that cached resource loaded
|
||||
await SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[CACHED_URL],
|
||||
async url => {
|
||||
await content.fetch(url);
|
||||
}
|
||||
);
|
||||
|
||||
await teardown(monitor);
|
||||
});
|
|
@ -665,6 +665,12 @@ nsresult nsHttpChannel::OnBeforeConnect() {
|
|||
// SecurityInfo.sys.mjs
|
||||
mLoadInfo->SetHstsStatus(isSecureURI);
|
||||
|
||||
RefPtr<mozilla::dom::BrowsingContext> bc;
|
||||
mLoadInfo->GetBrowsingContext(getter_AddRefs(bc));
|
||||
if (bc && bc->Top()->GetForceOffline()) {
|
||||
return NS_ERROR_OFFLINE;
|
||||
}
|
||||
|
||||
// At this point it is no longer possible to call
|
||||
// HttpBaseChannel::UpgradeToSecure.
|
||||
StoreUpgradableToSecure(false);
|
||||
|
@ -767,12 +773,7 @@ nsresult nsHttpChannel::MaybeUseHTTPSRRForUpgrade(bool aShouldUpgrade,
|
|||
return aStatus;
|
||||
}
|
||||
|
||||
RefPtr<mozilla::dom::BrowsingContext> bc;
|
||||
mLoadInfo->GetBrowsingContext(getter_AddRefs(bc));
|
||||
bool forceOffline = bc && bc->Top()->GetForceOffline();
|
||||
|
||||
if (mURI->SchemeIs("https") || aShouldUpgrade || !LoadUseHTTPSSVC() ||
|
||||
forceOffline) {
|
||||
if (mURI->SchemeIs("https") || aShouldUpgrade || !LoadUseHTTPSSVC()) {
|
||||
return ContinueOnBeforeConnect(aShouldUpgrade, aStatus);
|
||||
}
|
||||
|
||||
|
@ -1225,12 +1226,6 @@ nsresult nsHttpChannel::ContinueConnect() {
|
|||
return NS_ERROR_DOCUMENT_NOT_CACHED;
|
||||
}
|
||||
|
||||
RefPtr<mozilla::dom::BrowsingContext> bc;
|
||||
mLoadInfo->GetBrowsingContext(getter_AddRefs(bc));
|
||||
if (bc && bc->Top()->GetForceOffline()) {
|
||||
return NS_ERROR_OFFLINE;
|
||||
}
|
||||
|
||||
// hit the net...
|
||||
nsresult rv = DoConnect(mTransactionSticky);
|
||||
mTransactionSticky = nullptr;
|
||||
|
@ -4139,10 +4134,10 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(bool isHttps) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool forceOffline = bc && bc->Top()->GetForceOffline();
|
||||
if (offline || (mLoadFlags & INHIBIT_CACHING) || forceOffline) {
|
||||
if (offline || (mLoadFlags & INHIBIT_CACHING) ||
|
||||
(bc && bc->Top()->GetForceOffline())) {
|
||||
if (BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass()) &&
|
||||
!offline && !forceOffline) {
|
||||
!offline) {
|
||||
return NS_OK;
|
||||
}
|
||||
cacheEntryOpenFlags = nsICacheStorage::OPEN_READONLY;
|
||||
|
|
Загрузка…
Ссылка в новой задаче