Merge autoland to mozilla-central. a=merge

This commit is contained in:
Norisz Fay 2022-03-17 11:27:35 +02:00
commit 656c0068e5
19 changed files with 119 additions and 349 deletions

View File

@ -9,7 +9,6 @@ with Files("**"):
BROWSER_CHROME_MANIFESTS += [
"test/browser/browser.ini",
"test/browser/experiment-useragent/browser.ini",
]
MOCHITEST_MANIFESTS += [

View File

@ -417,88 +417,3 @@ add_task(async function runOverrideTest() {
// Pop privacy.resistFingerprinting
await SpecialPowers.popPrefEnv();
});
const VERSION_100_UA_OS = {
linux: "X11; Linux x86_64",
win: cpuArch == "x86_64" ? "Windows NT 10.0; Win64; x64" : "Windows NT 10.0",
macosx: "Macintosh; Intel Mac OS X 10.15",
android: "Android 10; Mobile",
};
const VERSION_100_UA = `Mozilla/5.0 (${
VERSION_100_UA_OS[AppConstants.platform]
}; rv:100.0) Gecko/20100101 Firefox/100.0`;
// Only test the Firefox and Gecko experiment prefs on desktop.
if (AppConstants.platform != "android") {
add_task(async function testForceVersion100() {
await SpecialPowers.pushPrefEnv({
set: [["general.useragent.forceVersion100", true]],
});
expectedResults = {
testDesc: "forceVersion100",
appVersion: DEFAULT_APPVERSION[AppConstants.platform],
hardwareConcurrency: navigator.hardwareConcurrency,
mimeTypesLength: 2,
oscpu: DEFAULT_OSCPU[AppConstants.platform],
platform: DEFAULT_PLATFORM[AppConstants.platform],
pluginsLength: 5,
userAgentNavigator: VERSION_100_UA,
userAgentHeader: VERSION_100_UA,
};
await testNavigator();
await testUserAgentHeader();
await testWorkerNavigator();
// Pop general.useragent.override etc
await SpecialPowers.popPrefEnv();
});
add_task(async function setupFirefoxVersionExperiment() {
// In Test Verify mode, this test is run multiple times so we need to
// reset the experiment enrollment prefs as if experiment enrollment
// never happend.
await SpecialPowers.pushPrefEnv({
set: [
["general.useragent.forceVersion100", false],
["general.useragent.handledVersionExperimentEnrollment", false],
],
});
// Mock Nimbus experiment settings
const { ExperimentFakes } = ChromeUtils.import(
"resource://testing-common/NimbusTestUtils.jsm"
);
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "firefox100",
value: { firefoxVersion: 100 },
});
expectedResults = {
testDesc: "FirefoxVersionExperimentTest",
appVersion: DEFAULT_APPVERSION[AppConstants.platform],
hardwareConcurrency: navigator.hardwareConcurrency,
mimeTypesLength: 2,
oscpu: DEFAULT_OSCPU[AppConstants.platform],
platform: DEFAULT_PLATFORM[AppConstants.platform],
pluginsLength: 5,
userAgentNavigator: VERSION_100_UA,
userAgentHeader: VERSION_100_UA,
};
await testNavigator();
// Skip worker tests due to intermittent bug 1713764. This is unlikely to be
// a scenario that affects users enrolled in our "Firefox 100" experiment.
// await testWorkerNavigator();
await testUserAgentHeader();
// Clear Nimbus experiment prefs and session data
await doExperimentCleanup();
});
}

View File

@ -1,9 +0,0 @@
[DEFAULT]
support-files =
../browser_navigator_header.sjs
prefs =
nimbus.syncdatastore.firefox100.firefoxVersion=100
[browser_experiment_useragent_startup.js]
skip-if = os == "android"
https_first_disabled = true

View File

@ -1,25 +0,0 @@
add_task(async function firefoxVersionExperimentOnStartup() {
const BASE =
"http://mochi.test:8888/browser/browser/components/resistfingerprinting/test/browser/";
const TEST_TARGET_URL = `${BASE}browser_navigator_header.sjs?`;
let tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
TEST_TARGET_URL
);
let result = await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
return content.document.body.textContent;
});
ok(
result.includes("rv:100.0"),
"User-Agent string does include the rv:100.0 segment"
);
ok(
result.includes("Firefox/100.0"),
"User-Agent string does include the Firefox/100.0 segment"
);
BrowserTestUtils.removeTab(tab);
});

View File

@ -29,8 +29,7 @@ namespace mozilla::camera {
CamerasSingleton::CamerasSingleton()
: mCamerasMutex("CamerasSingleton::mCamerasMutex"),
mCameras(nullptr),
mCamerasChildThread(nullptr),
mInShutdown(false) {
mCamerasChildThread(nullptr) {
LOG(("CamerasSingleton: %p", this));
}
@ -149,7 +148,7 @@ template <class T = int>
class LockAndDispatch {
public:
LockAndDispatch(CamerasChild* aCamerasChild, const char* aRequestingFunc,
nsIRunnable* aRunnable, const T& aFailureValue,
nsIRunnable* aRunnable, T aFailureValue,
const T& aSuccessValue)
: mCamerasChild(aCamerasChild),
mRequestingFunc(aRequestingFunc),
@ -198,21 +197,17 @@ bool CamerasChild::DispatchToParent(nsIRunnable* aRunnable,
CamerasSingleton::Mutex().AssertCurrentThreadOwns();
mReplyMonitor.AssertCurrentThreadOwns();
CamerasSingleton::Thread()->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
// We can't see if the send worked, so we need to be able to bail
// out on shutdown (when it failed and we won't get a reply).
if (!mIPCIsAlive) {
return false;
}
// Guard against spurious wakeups.
mReceivedReply = false;
// Wait for a reply
do {
// If the parent has been shut down, then we won't receive a reply.
if (!mIPCIsAlive) {
return false;
}
aMonitor.Wait();
} while (!mReceivedReply && mIPCIsAlive);
if (!mReplySuccess) {
return false;
}
return true;
} while (!mReceivedReply);
return mReplySuccess;
}
int CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine,
@ -430,21 +425,6 @@ int CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) {
return dispatcher.ReturnValue();
}
void Shutdown(void) {
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
CamerasSingleton::StartShutdown();
CamerasChild* child = CamerasSingleton::Child();
if (!child) {
// We don't want to cause everything to get fired up if we're
// really already shut down.
LOG(("Shutdown when already shut down"));
return;
}
child->ShutdownAll();
}
class ShutdownRunnable : public Runnable {
public:
explicit ShutdownRunnable(already_AddRefed<Runnable>&& aReplyEvent)
@ -452,6 +432,7 @@ class ShutdownRunnable : public Runnable {
NS_IMETHOD Run() override {
LOG(("Closing BackgroundChild"));
// This will also destroy the CamerasChild.
ipc::BackgroundChild::CloseForCurrentThread();
NS_DispatchToMainThread(mReplyEvent.forget());
@ -463,37 +444,21 @@ class ShutdownRunnable : public Runnable {
RefPtr<Runnable> mReplyEvent;
};
void CamerasChild::ShutdownAll() {
// Called with CamerasSingleton::Mutex() held
ShutdownParent();
ShutdownChild();
}
void Shutdown(void) {
// Called from both MediaEngineWebRTC::Shutdown() on the MediaManager thread
// and DeallocPCamerasChild() on the dedicated IPC thread.
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
void CamerasChild::ShutdownParent() {
// Called with CamerasSingleton::Mutex() held
{
MonitorAutoLock monitor(mReplyMonitor);
mIPCIsAlive = false;
monitor.NotifyAll();
CamerasChild* child = CamerasSingleton::Child();
if (!child) {
// We don't want to cause everything to get fired up if we're
// really already shut down.
LOG(("Shutdown when already shut down"));
return;
}
if (CamerasSingleton::Thread()) {
LOG(("Dispatching actor deletion"));
// Delete the parent actor.
// CamerasChild (this) will remain alive and is only deleted by the
// IPC layer when SendAllDone returns.
nsCOMPtr<nsIRunnable> deleteRunnable = mozilla::NewRunnableMethod(
"camera::PCamerasChild::SendAllDone", this, &CamerasChild::SendAllDone);
CamerasSingleton::Thread()->Dispatch(deleteRunnable, NS_DISPATCH_NORMAL);
} else {
LOG(("ShutdownParent called without PBackground thread"));
}
}
void CamerasChild::ShutdownChild() {
// Called with CamerasSingleton::Mutex() held
if (CamerasSingleton::Thread()) {
LOG(("PBackground thread exists, dispatching close"));
// Dispatch closing the IPC thread back to us when the
// The IPC thread is shut down on the main thread after the
// BackgroundChild is closed.
RefPtr<ShutdownRunnable> runnable = new ShutdownRunnable(
NewRunnableMethod("nsIThread::Shutdown", CamerasSingleton::Thread(),
@ -527,6 +492,7 @@ mozilla::ipc::IPCResult CamerasChild::RecvDeviceChange() {
}
void CamerasChild::ActorDestroy(ActorDestroyReason aWhy) {
LOG(("ActorDestroy"));
MonitorAutoLock monitor(mReplyMonitor);
mIPCIsAlive = false;
// Hopefully prevent us from getting stuck
@ -551,16 +517,7 @@ CamerasChild::CamerasChild()
CamerasChild::~CamerasChild() {
LOG(("~CamerasChild: %p", this));
if (!CamerasSingleton::InShutdown()) {
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
// In normal circumstances we've already shut down and the
// following does nothing. But on fatal IPC errors we will
// get destructed immediately, and should not try to reach
// the parent.
ShutdownChild();
}
CamerasSingleton::AssertNoChild();
MOZ_COUNT_DTOR(CamerasChild);
}

View File

@ -79,10 +79,9 @@ class CamerasSingleton {
Mutex().AssertCurrentThreadOwns();
return singleton().mCamerasChildThread;
}
static bool InShutdown() { return singleton().mInShutdown; }
static void StartShutdown() { singleton().mInShutdown = true; }
// The mutex is not held because mCameras is known not to be modified
// concurrently when this is asserted.
static void AssertNoChild() { MOZ_ASSERT(!singleton().mCameras); }
private:
CamerasSingleton();
@ -106,7 +105,6 @@ class CamerasSingleton {
// will be before actual destruction.
CamerasChild* mCameras;
nsCOMPtr<nsIThread> mCamerasChildThread;
Atomic<bool> mInShutdown;
};
// Get a pointer to a CamerasChild object we can use to do IPC with.
@ -191,7 +189,6 @@ class CamerasChild final : public PCamerasChild {
char* unique_idUTF8,
const unsigned int unique_idUTF8Length,
bool* scary = nullptr);
void ShutdownAll();
int EnsureInitialized(CaptureEngine aCapEngine);
template <typename This>
@ -226,8 +223,6 @@ class CamerasChild final : public PCamerasChild {
void AddCallback(const CaptureEngine aCapEngine, const int capture_id,
FrameRelay* render);
void RemoveCallback(const CaptureEngine aCapEngine, const int capture_id);
void ShutdownParent();
void ShutdownChild();
nsTArray<CapturerElement> mCallbacks;
// Protects the callback arrays

View File

@ -208,8 +208,8 @@ nsresult CamerasParent::DispatchToVideoCaptureThread(RefPtr<Runnable> event) {
void CamerasParent::StopVideoCapture() {
LOG("%s", __PRETTY_FUNCTION__);
// We are called from the main thread (xpcom-shutdown) or
// from PBackground (when the Actor shuts down).
// Called when the actor is destroyed.
ipc::AssertIsOnBackgroundThread();
// Shut down the WebRTC stack (on the capture thread)
RefPtr<CamerasParent> self(this);
DebugOnly<nsresult> rv =
@ -1044,17 +1044,6 @@ void CamerasParent::StopIPC() {
mDestroyed = true;
}
mozilla::ipc::IPCResult CamerasParent::RecvAllDone() {
LOG("%s", __PRETTY_FUNCTION__);
// Don't try to send anything to the child now
mChildIsAlive = false;
IProtocol* mgr = Manager();
if (!Send__delete__(this)) {
return IPC_FAIL_NO_REASON(mgr);
}
return IPC_OK();
}
void CamerasParent::ActorDestroy(ActorDestroyReason aWhy) {
// No more IPC from here
LOG("%s", __PRETTY_FUNCTION__);
@ -1072,7 +1061,13 @@ nsString CamerasParent::GetNewName() {
}
NS_IMETHODIMP CamerasParent::BlockShutdown(nsIAsyncShutdownClient*) {
StopVideoCapture();
mPBackgroundEventTarget->Dispatch(
NS_NewRunnableFunction(__func__, [self = RefPtr(this)]() {
// Send__delete() can return failure if AddBlocker() registered this
// CamerasParent while RecvPCamerasConstructor() called Send__delete()
// because it noticed that AppShutdown had started.
(void)Send__delete__(self);
}));
return NS_OK;
}

View File

@ -95,7 +95,6 @@ class CamerasParent final : public PCamerasParent,
mozilla::ipc::IPCResult RecvStopCapture(const CaptureEngine&,
const int&) override;
mozilla::ipc::IPCResult RecvReleaseFrame(mozilla::ipc::Shmem&&) override;
mozilla::ipc::IPCResult RecvAllDone() override;
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvEnsureInitialized(const CaptureEngine&) override;

View File

@ -85,8 +85,6 @@ parent:
// transfers frame back
async ReleaseFrame(Shmem s);
// Ask parent to delete us
async AllDone();
// setup camera engine
async EnsureInitialized(CaptureEngine engine);
};

View File

@ -5640,21 +5640,45 @@ static FrameTarget GetSelectionClosestFrameForBlock(nsIFrame* aFrame,
return DrillDownToSelectionFrame(aFrame, true, aFlags);
}
// Use frame edge for grid, flex, table, and non-draggable & non-editable
// image frames.
// Use frame edge for grid, flex, table, and non-editable images. Choose the
// edge based on the point position past the frame rect. If past the middle,
// caret should be at end, otherwise at start. This behavior matches Blink.
//
// TODO(emilio): Can we use this code path for other replaced elements other
// than images? Or even all other frames? We only get there when we didn't find
// selectable children... At least one XUL test fails if we make this apply to
// XUL labels. Also, editable images need _not_ to use the frame edge, see
// below.
static bool UseFrameEdge(nsIFrame* aFrame) {
if (aFrame->IsFlexOrGridContainer() || aFrame->IsTableFrame()) {
return true;
}
if (static_cast<nsImageFrame*>(do_QueryFrame(aFrame))) {
return !nsContentUtils::ContentIsDraggable(aFrame->GetContent()) &&
!aFrame->GetContent()->IsEditable();
const nsImageFrame* image = do_QueryFrame(aFrame);
if (image && !aFrame->GetContent()->IsEditable()) {
// Editable images are a special-case because editing relies on clicking on
// an editable image selecting it, for it to show resizers.
return true;
}
return false;
}
static FrameTarget LastResortFrameTargetForFrame(nsIFrame* aFrame) {
return {aFrame, UseFrameEdge(aFrame), false};
static FrameTarget LastResortFrameTargetForFrame(nsIFrame* aFrame,
const nsPoint& aPoint) {
if (!UseFrameEdge(aFrame)) {
return {aFrame, false, false};
}
const auto& rect = aFrame->GetRectRelativeToSelf();
nscoord reference;
nscoord middle;
if (aFrame->GetWritingMode().IsVertical()) {
reference = aPoint.y;
middle = rect.Height() / 2;
} else {
reference = aPoint.x;
middle = rect.Width() / 2;
}
const bool afterFrame = reference > middle;
return {aFrame, true, afterFrame};
}
// GetSelectionClosestFrame is the helper function that calculates the closest
@ -5663,7 +5687,8 @@ static FrameTarget LastResortFrameTargetForFrame(nsIFrame* aFrame) {
// restricted environments.
// Cannot handle overlapping frames correctly, so it should receive the output
// of GetFrameForPoint
// Guaranteed to return a valid FrameTarget
// Guaranteed to return a valid FrameTarget.
// aPoint is relative to aFrame.
static FrameTarget GetSelectionClosestFrame(nsIFrame* aFrame,
const nsPoint& aPoint,
uint32_t aFlags) {
@ -5687,7 +5712,7 @@ static FrameTarget GetSelectionClosestFrame(nsIFrame* aFrame,
}
}
return LastResortFrameTargetForFrame(aFrame);
return LastResortFrameTargetForFrame(aFrame, aPoint);
}
static nsIFrame::ContentOffsets OffsetsForSingleFrame(nsIFrame* aFrame,

View File

@ -108,6 +108,7 @@ support-files =
frame_visibility_in_iframe_child.html
[test_image_selection.html]
[test_image_selection_2.html]
[test_image_selection_3.html]
[test_image_selection_in_contenteditable.html]
[test_intrinsic_size_on_loading.html]
[test_movement_by_characters.html]

View File

@ -0,0 +1,48 @@
<!doctype html>
<title>Test for bug 1754459</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
<style>
/* This avoids the draggable image check that our code does to avoid handling the mousedown. */
img { pointer-events: none }
</style>
<div id="block">
Some text <img width="100" height="100" id="image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAyAQMAAACQ%2B%2Bz9AAAAA1BMVEUA%2FwA0XsCoAAAAD0lEQVQoFWNgGAWjYGgCAAK8AAEb3eOQAAAAAElFTkSuQmCC"> and more.
</div>
<script>
const image = document.getElementById("image");
const block = document.getElementById("block");
const selection = window.getSelection();
function clickOnImage(x, y) {
synthesizeMouse(image, x, y, {});
}
add_task(async function test_click_pointer_events_none() {
await SimpleTest.promiseFocus(window);
clickOnImage(10, 10);
ok(selection.isCollapsed, "Should be collapsed");
is(selection.focusNode, block, "Should be at block");
is(selection.focusOffset, 1, "Should be at start of image");
clickOnImage(60, 10);
ok(selection.isCollapsed, "Should be collapsed");
is(selection.focusNode, block, "Should be at block");
is(selection.focusOffset, 2, "Should be at end of image");
});
add_task(async function test_click_pointer_events_none_vertical() {
block.style.writingMode = "vertical-lr";
block.getBoundingClientRect();
clickOnImage(10, 10);
ok(selection.isCollapsed, "Should be collapsed");
is(selection.focusNode, block, "Should be at start of image");
is(selection.focusOffset, 1, "Should be at start of image");
clickOnImage(10, 60);
ok(selection.isCollapsed, "Should be collapsed");
is(selection.focusNode, block, "Should be at block");
is(selection.focusOffset, 2, "Should be at end of image");
});
</script>

View File

@ -2680,11 +2680,6 @@ class nsDisplayItem {
const nsRect& GetBuildingRect() const { return mBuildingRect; }
void SetBuildingRect(const nsRect& aBuildingRect) {
if (aBuildingRect == mBuildingRect) {
// Avoid unnecessary paint rect recompution when the
// building rect is staying the same.
return;
}
mBuildingRect = aBuildingRect;
}

View File

@ -30,5 +30,5 @@ video {
}
video:focus {
outline-width: 0;
outline-style: none;
}

View File

@ -5058,21 +5058,6 @@
value: 5000
mirror: always
# Temporary pref to test website compatibility with Firefox 100 UA string. This
# pref will be removed in Firefox 100 because it will no longer needed.
- name: general.useragent.forceVersion100
type: bool
value: false
mirror: always
# Temporary pref to remember whether we have handled the Nimbus enrollment
# event for the Firefox 100 UA experiment. This pref will be removed in Firefox
# 100 because the experiment will have ended.
- name: general.useragent.handledVersionExperimentEnrollment
type: bool
value: false
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "geo."
#---------------------------------------------------------------------------
@ -8885,7 +8870,7 @@
# Allow ffmpeg decoder to decode directly onto shmem buffer
- name: media.ffmpeg.customized-buffer-allocation
type: RelaxedAtomicBool
value: @IS_NIGHTLY_BUILD@
value: true
mirror: always
#ifdef MOZ_FFMPEG

View File

@ -213,6 +213,3 @@ if CONFIG["OS_TARGET"] == "Darwin":
DEFINES["HAS_CONNECTX"] = True
include("/tools/fuzzing/libfuzzer-config.mozbuild")
if CONFIG["MOZ_BUILD_APP"] == "browser":
DEFINES["MOZ_BUILD_APP_IS_BROWSER"] = True

View File

@ -30,7 +30,6 @@
#include "mozilla/Components.h"
#include "mozilla/Printf.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StaticPrefs_general.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_privacy.h"
#include "mozilla/StoragePrincipalHelper.h"
@ -102,8 +101,6 @@
# include "nsCocoaFeatures.h"
#endif
#include "mozilla/browser/NimbusFeatures.h"
//-----------------------------------------------------------------------------
#include "mozilla/net/HttpChannelChild.h"
@ -130,9 +127,6 @@
#define NS_HTTP_PROTOCOL_FLAGS \
(URI_STD | ALLOWS_PROXY | ALLOWS_PROXY_HTTP | URI_LOADABLE_BY_ANYONE)
#define UA_EXPERIMENT_NAME "firefox100"_ns
#define UA_EXPERIMENT_VAR "firefoxVersion"_ns
//-----------------------------------------------------------------------------
using mozilla::dom::Promise;
@ -141,58 +135,6 @@ namespace mozilla::net {
LazyLogModule gHttpLog("nsHttp");
static void HandleVersionExperimentEnrollment(const char* /* aNimbusPref */,
void* /* aUserData */) {
MOZ_ASSERT(XRE_IsParentProcess());
int experimentBranch =
NimbusFeatures::GetInt(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR, -1);
// Only set the forceVersion100 pref if the user was enrolled in the
// treatment (100) branch and the pref is not already set. If the user
// already set the forceVersion100 pref manually (by checking the
// "Firefox 100 User-Agent String" option in about:preferences), we don't
// want subsequent enrollment in the control branch to clear the pref and
// surprise the user by resetting their UA from version 100 UA to the
// default version.
if (experimentBranch == 100 &&
!mozilla::StaticPrefs::general_useragent_forceVersion100()) {
Preferences::SetBool("general.useragent.forceVersion100", true);
}
Preferences::SetBool("general.useragent.handledVersionExperimentEnrollment",
true);
}
static void GetExperimentUserAgent(nsACString* aExperimentUserAgent) {
if (!mozilla::StaticPrefs::general_useragent_forceVersion100()) {
aExperimentUserAgent->SetIsVoid(true);
return;
}
const char uaFormat[] =
#ifdef XP_WIN
# ifdef HAVE_64BIT_BUILD
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 "
"Firefox/100.0"
# else
"Mozilla/5.0 (Windows NT 10.0; rv:100.0) Gecko/20100101 Firefox/100.0"
# endif
#elif defined(XP_MACOSX)
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 "
"Firefox/100.0"
#elif defined(ANDROID)
"Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0"
#else
// Linux, FreeBSD, etc
"Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0"
#endif
;
aExperimentUserAgent->Assign(uaFormat);
}
#ifdef ANDROID
static nsCString GetDeviceModelId() {
// Assumed to be running on the main thread
@ -288,8 +230,6 @@ nsHttpHandler::nsHttpHandler()
mUserAgentOverride.SetIsVoid(true);
mExperimentUserAgent.SetIsVoid(true);
MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!");
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
@ -411,26 +351,6 @@ nsresult nsHttpHandler::Init() {
};
mHttp3QlogDir = initQLogDir();
// monitor Firefox Version Experiment enrollment
if (XRE_IsParentProcess()) {
int experimentBranch =
NimbusFeatures::GetInt(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR, -1);
if (experimentBranch == -1) {
// The user has not been enrolled in the experiment yet, so listen for
// a Nimbus enrollment event.
NimbusFeatures::OnUpdate(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR,
HandleVersionExperimentEnrollment, nullptr);
} else if (!mozilla::StaticPrefs::
general_useragent_handledVersionExperimentEnrollment()) {
// The user was enrolled in the experiment before the forceVersion100
// pref was created, so call the Nimbus enrollment callback now to
// update the forceVersion100 and handledVersionExperimentEnrollment
// prefs.
HandleVersionExperimentEnrollment(nullptr, nullptr);
}
}
// monitor some preference changes
Preferences::RegisterPrefixCallbacks(nsHttpHandler::PrefsChanged,
gCallbackPrefs, this);
@ -803,12 +723,6 @@ const nsCString& nsHttpHandler::UserAgent() {
return mUserAgentOverride;
}
if (!mExperimentUserAgent.IsVoid()) {
LOG(("using Firefox 100 Experiment User-Agent : %s\n",
mExperimentUserAgent.get()));
return mExperimentUserAgent;
}
if (mUserAgentIsDirty) {
BuildUserAgent();
mUserAgentIsDirty = false;
@ -1089,14 +1003,6 @@ void nsHttpHandler::PrefsChanged(const char* pref) {
mUserAgentIsDirty = true;
}
// general.useragent.forceVersion100
if (PREF_CHANGED(UA_PREF("forceVersion100"))) {
// mExperimentUserAgent (if it's not void) will override the constructed
// UA. We don't need to set mUserAgentIsDirty because we don't need to
// reconstruct the UA.
GetExperimentUserAgent(&mExperimentUserAgent);
}
// general.useragent.override
if (PREF_CHANGED(UA_PREF("override"))) {
Preferences::GetCString(UA_PREF("override"), mUserAgentOverride);

View File

@ -641,9 +641,6 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
nsCString mUserAgent;
nsCString mSpoofedUserAgent;
nsCString mUserAgentOverride;
nsCString mExperimentUserAgent;
bool mUserAgentIsDirty{true}; // true if mUserAgent should be rebuilt
bool mAcceptLanguagesIsDirty{true};

View File

@ -165,14 +165,6 @@ abouthomecache:
type: boolean
fallbackPref: browser.startup.homepage.abouthome_cache.enabled
description: Is the feature enabled?
firefox100:
description: Firefox User-Agent version
hasExposure: false
isEarlyStartup: true
variables:
firefoxVersion:
type: int
description: Firefox version to spoof (or `0` to use default version)
newtab:
description: "The about:newtab page"
hasExposure: true