author | Olivier Tilloy <olivier@tilloy.net> |
Thu, 22 Sep 2022 18:52:44 +0000 | |
changeset 636137 | 2d4419b5c1dfb8d6ae096cfb5c01dc75f33dffe8 |
parent 636136 | f16cd526cef2ee33827a6b8dbdca0c2f9a5a474a |
child 636138 | 092fe5f401f345a04c7412e22a5327e32773e6e2 |
push id | 170212 |
push user | mozilla@kaply.com |
push date | Thu, 22 Sep 2022 18:55:08 +0000 |
treeherder | autoland@2d4419b5c1df [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mkaply, necko-reviewers |
bugs | 1789310 |
milestone | 107.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/.eslintrc-test-paths.js +++ b/.eslintrc-test-paths.js @@ -197,16 +197,17 @@ const extraBrowserTestPaths = [ "dom/url/tests/", "dom/workers/test/", "dom/xhr/tests/", "editor/libeditor/tests/", "extensions/permissions/test/", "layout/base/tests/", "layout/style/test/", "layout/xul/test/", + "netwerk/test/useragent/", "parser/htmlparser/tests/mochitest/", "security/sandbox/test/", "testing/mochitest/baselinecoverage/browser_chrome/", "testing/mochitest/tests/python/files/", "toolkit/components/alerts/test/", "toolkit/components/mozprotocol/tests/", "toolkit/components/narrate/test/", "toolkit/components/pdfjs/test/",
--- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -86,16 +86,20 @@ #include "TRRServiceChannel.h" #include <bitset> #if defined(XP_UNIX) # include <sys/utsname.h> #endif +#if defined(MOZ_WIDGET_GTK) +# include "mozilla/WidgetUtilsGtk.h" +#endif + #if defined(XP_WIN) # include <windows.h> # include "mozilla/WindowsVersion.h" #endif #if defined(XP_MACOSX) # include <CoreServices/CoreServices.h> # include "nsCocoaFeatures.h" @@ -154,16 +158,35 @@ static nsCString GetDeviceModelId() { deviceString.Trim(" ", true, true); deviceString.ReplaceSubstring("%DEVICEID%"_ns, deviceModelId); return std::move(deviceString); } return std::move(deviceModelId); } #endif +#ifdef XP_UNIX +static bool IsRunningUnderUbuntuSnap() { +# if defined(MOZ_WIDGET_GTK) + if (!widget::IsRunningUnderSnap()) { + return false; + } + + char version[100]; + if (PR_GetSystemInfo(PR_SI_RELEASE_BUILD, version, sizeof(version)) == + PR_SUCCESS) { + if (strstr(version, "Ubuntu")) { + return true; + } + } +# endif + return false; +} +#endif + //----------------------------------------------------------------------------- // nsHttpHandler <public> //----------------------------------------------------------------------------- StaticRefPtr<nsHttpHandler> gHttpHandler; /* static */ already_AddRefed<nsHttpHandler> nsHttpHandler::GetInstance() { @@ -822,16 +845,22 @@ void nsHttpHandler::InitUserAgentCompone // We historically have always had X11 here, // and there seems little a webpage can sensibly do // based on it being something else, so use X11 for // backwards compatibility in all cases. "X11" #endif ); +#ifdef XP_UNIX + if (IsRunningUnderUbuntuSnap()) { + mPlatform.AppendLiteral("; Ubuntu"); + } +#endif + #ifdef ANDROID nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1"); MOZ_ASSERT(infoService, "Could not find a system info service"); nsresult rv; // Add the Android version number to the Fennec platform identifier. nsAutoString androidVersion; rv = infoService->GetPropertyAsAString(u"release_version"_ns, androidVersion);
--- a/netwerk/test/moz.build +++ b/netwerk/test/moz.build @@ -1,17 +1,21 @@ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- # vim: set filetype=python: # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. TEST_DIRS += ["httpserver", "gtest", "http3server"] -BROWSER_CHROME_MANIFESTS += ["browser/browser.ini"] +BROWSER_CHROME_MANIFESTS += [ + "browser/browser.ini", + "useragent/nonsnap.ini", + "useragent/snap.ini", +] MOCHITEST_MANIFESTS += ["mochitests/mochitest.ini"] XPCSHELL_TESTS_MANIFESTS += [ "unit/xpcshell.ini", "unit_ipc/xpcshell.ini", ] TESTING_JS_MODULES += [
new file mode 100644 --- /dev/null +++ b/netwerk/test/useragent/browser_ua_nonsnap.js @@ -0,0 +1,10 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +add_task(function test_ua_nonsnap() { + ok(navigator.userAgent.match(/X11; Linux/)); +});
new file mode 100644 --- /dev/null +++ b/netwerk/test/useragent/browser_ua_snap_ubuntu.js @@ -0,0 +1,10 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +add_task(function test_ua_snap_ubuntu() { + ok(navigator.userAgent.match(/X11; Ubuntu; Linux/)); +});
new file mode 100644 --- /dev/null +++ b/netwerk/test/useragent/nonsnap.ini @@ -0,0 +1,4 @@ +[DEFAULT] + +[browser_ua_nonsnap.js] +skip-if = os != "linux"
new file mode 100644 --- /dev/null +++ b/netwerk/test/useragent/snap.ini @@ -0,0 +1,6 @@ +[DEFAULT] +environment = SNAP_INSTANCE_NAME=firefox + +[browser_ua_snap_ubuntu.js] +skip-if = + os != "linux" || !is_ubuntu
--- a/python/mozbuild/mozbuild/mozinfo.py +++ b/python/mozbuild/mozbuild/mozinfo.py @@ -4,16 +4,17 @@ # This module produces a JSON file that provides basic build info and # configuration metadata. from __future__ import absolute_import, print_function, unicode_literals import json import os +import platform import re import six def build_dict(config, env=os.environ): """ Build a dict containing data about the build configuration from the environment. @@ -140,16 +141,18 @@ def build_dict(config, env=os.environ): d["buildtype_guess"] = guess_buildtype() if ( d.get("buildapp", "") == "mobile/android" and "MOZ_ANDROID_MIN_SDK_VERSION" in substs ): d["android_min_sdk"] = substs["MOZ_ANDROID_MIN_SDK_VERSION"] + d["is_ubuntu"] = "Ubuntu" in platform.version() + return d def write_mozinfo(file, config, env=os.environ): """Write JSON data about the configuration specified in config and an environment variable dict to ``|file|``, which may be a filename or file-like object. See build_dict for information about what environment variables are used,