Backed out 2 changesets (bug 1156659) for causing dt failures on browser_net_throttle.js CLOSED TREE

Backed out changeset af64e5a0109a (bug 1156659)
Backed out changeset 7e9b86bce76b (bug 1156659)
This commit is contained in:
Norisz Fay 2023-10-02 16:11:21 +03:00
parent aba9a1b03c
commit 338171a737
16 changed files with 5 additions and 149 deletions

View File

@ -512,9 +512,6 @@ class Connector {
async updateNetworkThrottling(enabled, profile) {
if (!enabled) {
this.networkFront.clearNetworkThrottling();
await this.commands.targetConfigurationCommand.updateConfiguration({
setTabOffline: false,
});
} else {
// The profile can be either a profile id which is used to
// search the predefined throttle profiles or a profile object
@ -523,9 +520,6 @@ class Connector {
profile = throttlingProfiles.find(({ id }) => id == profile);
}
const { download, upload, latency } = profile;
await this.commands.targetConfigurationCommand.updateConfiguration({
setTabOffline: !download,
});
await this.networkFront.setNetworkThrottling({
downloadThroughput: download,
uploadThroughput: upload,

View File

@ -99,12 +99,6 @@ const profiles = [
upload: 15 * MBps,
latency: 2,
},
{
id: "Offline",
download: 0,
upload: 0,
latency: 5,
},
].map(profile => new ThrottlingProfile(profile));
module.exports = profiles;

View File

@ -32,7 +32,6 @@ The table below lists the numbers associated with each network type, but please
Regular 4G/LTE, 4 Mbps, 3 Mbps, 20
DSL, 2 Mbps, 1 Mbps, 5
Wi-Fi, 30 Mbps, 15 Mbps, 2
Offline, 0 Mbps, 0 Mbps, 5
Network Monitor Features
************************

View File

@ -202,11 +202,6 @@ The table below lists the numbers associated with each network type, but please
- 15 Mb/s
- 2
* - Offline
- 0 Mb/s
- 0 Mb/s
- 5
To select a network, click the list box that's initially labeled "No throttling":
.. image:: rdm_throttling.png

View File

@ -47,8 +47,6 @@ const SUPPORTED_OPTIONS = {
restoreFocus: true,
// Enable service worker testing over HTTP (instead of HTTPS only).
serviceWorkersTestingEnabled: true,
// Set the current tab offline
setTabOffline: true,
// Enable touch events simulation
touchEventsOverride: true,
// Use simplified highlighters when prefers-reduced-motion is enabled.
@ -268,9 +266,6 @@ class TargetConfigurationActor extends Actor {
case "cacheDisabled":
this._setCacheDisabled(value);
break;
case "setTabOffline":
this._setTabOffline(value);
break;
}
}
@ -287,7 +282,6 @@ class TargetConfigurationActor extends Actor {
this._setServiceWorkersTestingEnabled(false);
this._setPrintSimulationEnabled(false);
this._setCacheDisabled(false);
this._setTabOffline(false);
// Restore the color scheme simulation only if it was explicitly updated
// by this actor. This will avoid side effects caused when destroying additional
@ -459,17 +453,6 @@ class TargetConfigurationActor extends Actor {
}
}
/**
* Set the browsing context to offline.
*
* @param {Boolean} offline: Whether the network throttling is set to offline
*/
_setTabOffline(offline) {
if (!this._browsingContext.isDiscarded) {
this._browsingContext.forceOffline = offline;
}
}
destroy() {
Services.obs.removeObserver(
this._onBrowsingContextAttached,

View File

@ -62,34 +62,6 @@ add_task(async function () {
"Option colorSchemeSimulation was set, with a string value"
);
await targetConfigurationCommand.updateConfiguration({
setTabOffline: true,
});
compareOptions(
targetConfigurationCommand.configuration,
{
cacheDisabled: false,
colorSchemeSimulation: "dark",
javascriptEnabled: false,
setTabOffline: true,
},
"Option setTabOffline was set on"
);
await targetConfigurationCommand.updateConfiguration({
setTabOffline: false,
});
compareOptions(
targetConfigurationCommand.configuration,
{
setTabOffline: false,
cacheDisabled: false,
colorSchemeSimulation: "dark",
javascriptEnabled: false,
},
"Option setTabOffline was set off"
);
targetCommand.destroy();
await commands.destroy();
});

View File

@ -23,7 +23,6 @@ types.addDictType("target-configuration.configuration", {
reloadOnTouchSimulationToggle: "nullable:boolean",
restoreFocus: "nullable:boolean",
serviceWorkersTestingEnabled: "nullable:boolean",
setTabOffline: "nullable:boolean",
touchEventsOverride: "nullable:string",
});

View File

@ -3529,11 +3529,6 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_IsUnderHiddenEmbedderElement>,
return true;
}
bool BrowsingContext::CanSet(FieldIndex<IDX_ForceOffline>, bool aNewValue,
ContentParent* aSource) {
return XRE_IsParentProcess() && !aSource;
}
void BrowsingContext::DidSet(FieldIndex<IDX_IsUnderHiddenEmbedderElement>,
bool aOldValue) {
nsIDocShell* shell = GetDocShell();

View File

@ -267,9 +267,7 @@ struct EmbedderColorSchemes {
* a content process. */ \
FIELD(EmbeddedInContentDocument, bool) \
/* If true, this browsing context is within a hidden embedded document. */ \
FIELD(IsUnderHiddenEmbedderElement, bool) \
/* If true, this browsing context is offline */ \
FIELD(ForceOffline, bool)
FIELD(IsUnderHiddenEmbedderElement, bool)
// BrowsingContext, in this context, is the cross process replicated
// environment in which information about documents is stored. In
@ -613,8 +611,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
aRv);
}
bool ForceOffline() const { return GetForceOffline(); }
bool ForceDesktopViewport() const { return GetForceDesktopViewport(); }
bool AuthorStyleDisabledDefault() const {
@ -1233,9 +1229,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
const bool& aIsUnderHiddenEmbedderElement,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_ForceOffline>, bool aNewValue,
ContentParent* aSource);
bool CanSet(FieldIndex<IDX_EmbeddedInContentDocument>, bool,
ContentParent* aSource) {
return CheckOnlyEmbedderCanSet(aSource);

View File

@ -320,7 +320,6 @@ void CanonicalBrowsingContext::ReplacedBy(
txn.SetEmbedderColorSchemes(GetEmbedderColorSchemes());
txn.SetHasRestoreData(GetHasRestoreData());
txn.SetShouldDelayMediaFromStart(GetShouldDelayMediaFromStart());
txn.SetForceOffline(GetForceOffline());
// Propagate some settings on BrowsingContext replacement so they're not lost
// on bfcached navigations. These are important for GeckoView (see bug

View File

@ -561,17 +561,7 @@ bool Navigator::CookieEnabled() {
return granted;
}
bool Navigator::OnLine() {
if (mWindow) {
// Check if this tab is set to be offline.
BrowsingContext* bc = mWindow->GetBrowsingContext();
if (bc && bc->Top()->GetForceOffline()) {
return false;
}
}
// Return the default browser value
return !NS_IsOffline();
}
bool Navigator::OnLine() { return !NS_IsOffline(); }
void Navigator::GetBuildID(nsAString& aBuildID, CallerType aCallerType,
ErrorResult& aRv) const {

View File

@ -129,12 +129,6 @@ interface BrowsingContext {
[SetterThrows] attribute boolean isActive;
/**
* When set to true all channels in this browsing context or its children will report navigator.onLine = false,
* and HTTP requests created from these browsing context will fail with NS_ERROR_OFFLINE.
*/
[SetterThrows] attribute boolean forceOffline;
/**
* Sets whether this is an app tab. Non-same-origin link navigations from app
* tabs may be forced to open in new contexts, rather than in the same context.

View File

@ -560,12 +560,6 @@ nsresult nsHttpChannel::OnBeforeConnect() {
// Save that on the loadInfo so it can later be consumed by SecurityInfo.jsm
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);
@ -1037,12 +1031,8 @@ void nsHttpChannel::SpeculativeConnect() {
// don't speculate if we are offline, when doing http upgrade (i.e.
// websockets bootstrap), or if we can't do keep-alive (because then we
// couldn't reuse the speculative connection anyhow).
RefPtr<mozilla::dom::BrowsingContext> bc;
mLoadInfo->GetBrowsingContext(getter_AddRefs(bc));
if (gIOService->IsOffline() || mUpgradeProtocolCallback ||
!(mCaps & NS_HTTP_ALLOW_KEEPALIVE) ||
(bc && bc->Top()->GetForceOffline())) {
!(mCaps & NS_HTTP_ALLOW_KEEPALIVE)) {
return;
}
@ -3682,9 +3672,6 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(bool isHttps) {
uint32_t cacheEntryOpenFlags;
bool offline = gIOService->IsOffline();
RefPtr<mozilla::dom::BrowsingContext> bc;
mLoadInfo->GetBrowsingContext(getter_AddRefs(bc));
bool maybeRCWN = false;
nsAutoCString cacheControlRequestHeader;
@ -3695,8 +3682,7 @@ nsresult nsHttpChannel::OpenCacheEntryInternal(bool isHttps) {
return NS_OK;
}
if (offline || (mLoadFlags & INHIBIT_CACHING) ||
(bc && bc->Top()->GetForceOffline())) {
if (offline || (mLoadFlags & INHIBIT_CACHING)) {
if (BYPASS_LOCAL_CACHE(mLoadFlags, LoadPreferCacheLoadOverBypass()) &&
!offline) {
return NS_OK;

View File

@ -145,4 +145,3 @@ support-files =
[browser_103_private_window.js]
[browser_speculative_connection_link_header.js]
[browser_103_assets_extension.js]
[browser_test_offline_tab.js]

View File

@ -1,36 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_set_tab_offline() {
await BrowserTestUtils.withNewTab("https://example.com", async browser => {
// Set the tab to offline
gBrowser.selectedBrowser.browsingContext.forceOffline = true;
await SpecialPowers.spawn(browser, [], async () => {
try {
await content.fetch("https://example.com/empty.html");
ok(false, "Should not load since tab is offline");
} catch (err) {
is(err.name, "TypeError", "Should fail since tab is offline");
}
});
});
});
add_task(async function test_set_tab_online() {
await BrowserTestUtils.withNewTab("https://example.com", async browser => {
// Set the tab to online
gBrowser.selectedBrowser.browsingContext.forceOffline = false;
await SpecialPowers.spawn(browser, [], async () => {
try {
await content.fetch("https://example.com/empty.html");
ok(true, "Should load since tab is online");
} catch (err) {
ok(false, "Should not fail since tab is online");
}
});
});
});

View File

@ -2353,7 +2353,7 @@ devtools.main:
release_channel_collection: opt-out
expiry_version: never
extra_keys:
mode: No throttling, GPRS, Regular 2G, Good 2G, Regular 3G, Good 3G, Regular 4G / LTE, DSL, WI-FI, or Offline.
mode: No throttling, GPRS, Regular 2G, Good 2G, Regular 3G, Good 3G, Regular 4G / LTE, DSL or WI-FI.
session_id: The toolbox session start time e.g. 13963.
tool_timer:
objects: ["animationinspector", "compatibilityview", "computedview", "changesview", "fontinspector", "layoutview", "ruleview"]