Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2021-11-10 09:12:40 +08:00
commit eedc02ee94
16 changed files with 110 additions and 194 deletions

View file

@ -50,50 +50,3 @@ endif
libs:: $(srcdir)/profile/channel-prefs.js
$(NSINSTALL) -D $(DIST)/bin/defaults/pref
$(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
ifdef MOZ_DEBUG
MAC_APP_NAME := $(MAC_APP_NAME)Debug
endif
AB_CD = $(MOZ_UI_LOCALE)
ifeq (zh-TW,$(AB_CD))
LPROJ_ROOT := $(subst -,_,$(AB_CD))
else
LPROJ_ROOT := $(firstword $(subst -, ,$(AB_CD)))
endif
LPROJ := Contents/Resources/$(LPROJ_ROOT).lproj
clean clobber repackage::
$(RM) -r $(dist_dest)
MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
.PHONY: repackage
tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME)
$(MKDIR) -p '$(dist_dest)/Contents/MacOS'
$(MKDIR) -p '$(dist_dest)/$(LPROJ)'
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents '$(dist_dest)' --exclude English.lproj
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ '$(dist_dest)/$(LPROJ)'
sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' $(srcdir)/macbuild/Contents/Info.plist.in > '$(dist_dest)/Contents/Info.plist'
sed -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > '$(dist_dest)/$(LPROJ)/InfoPlist.strings'
rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
# MacOS-files-copy.in is a list of files that should be copies rather
# than symlinks and placed in .app/Contents/MacOS.
rsync -aL --include-from='$(srcdir)/macbuild/Contents/MacOS-files-copy.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
$(RM) '$(dist_dest)/Contents/MacOS/$(MOZ_APP_NAME)'
rsync -aL $(DIST)/bin/$(MOZ_APP_NAME) '$(dist_dest)/Contents/MacOS'
cp -RL $(DIST)/branding/firefox.icns '$(dist_dest)/Contents/Resources/firefox.icns'
cp -RL $(DIST)/branding/document.icns '$(dist_dest)/Contents/Resources/document.icns'
ifdef MOZ_UPDATER
$(MKDIR) -p '$(dist_dest)/Contents/Library/LaunchServices'
mv -f '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater' '$(dist_dest)/Contents/Library/LaunchServices'
ln -s ../../../../Library/LaunchServices/org.mozilla.updater '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater'
endif
printf APPLMOZB > '$(dist_dest)/Contents/PkgInfo'
endif

View file

@ -61,51 +61,10 @@ libs:: $(srcdir)/profile/channel-prefs.js
$(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
ifdef MOZ_DEBUG
MAC_APP_NAME := $(MAC_APP_NAME)Debug
endif
AB_CD = $(MOZ_UI_LOCALE)
AB := $(firstword $(subst -, ,$(AB_CD)))
clean clobber repackage::
$(RM) -r $(dist_dest)
MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
.PHONY: repackage
tools repackage:: $(PROGRAM)
$(MKDIR) -p '$(dist_dest)/Contents/MacOS'
$(MKDIR) -p '$(dist_dest)/Contents/Resources/$(AB).lproj'
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents '$(dist_dest)' --exclude English.lproj
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ '$(dist_dest)/Contents/Resources/$(AB).lproj'
sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' $(srcdir)/macbuild/Contents/Info.plist.in > '$(dist_dest)/Contents/Info.plist'
sed -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > '$(dist_dest)/Contents/Resources/$(AB).lproj/InfoPlist.strings'
rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ '$(dist_dest)/Contents/Resources'
rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
# MacOS-files-copy.in is a list of files that should be copies rather
# than symlinks and placed in .app/Contents/MacOS.
rsync -aL --include-from='$(srcdir)/macbuild/Contents/MacOS-files-copy.in' --exclude '*' $(DIST)/bin/ '$(dist_dest)/Contents/MacOS'
$(RM) '$(dist_dest)/Contents/MacOS/$(PROGRAM)'
rsync -aL $(PROGRAM) '$(dist_dest)/Contents/MacOS'
cp -RL $(DIST)/branding/firefox.icns '$(dist_dest)/Contents/Resources/firefox.icns'
cp -RL $(DIST)/branding/document.icns '$(dist_dest)/Contents/Resources/document.icns'
printf APPLMOZB > '$(dist_dest)/Contents/PkgInfo'
endif
ifdef LIBXUL_SDK #{
ifndef SKIP_COPY_XULRUNNER #{
libs::
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{
rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework '$(dist_dest)/Contents/Frameworks'
else
$(NSINSTALL) -D $(DIST)/bin/xulrunner
(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
endif #} cocoa
endif #} SKIP_COPY_XULRUNNER
endif #} LIBXUL_SDK

View file

@ -202,7 +202,7 @@ const gXPInstallObserver = {
label: gNavigatorBundle.getString("addonInstallRestartButton"),
accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"),
callback: function() {
Application.restart();
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
};
} else {
@ -368,7 +368,7 @@ var LightWeightThemeWebInstaller = {
label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"),
accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"),
callback: function () {
Application.restart();
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}
};

View file

@ -3353,8 +3353,8 @@
<!-- Deprecated stuff, implemented for backwards compatibility. -->
<method name="enterTabbedMode">
<body>
Application.console.log("enterTabbedMode is an obsolete method and " +
"will be removed in a future release.");
console.log("enterTabbedMode is an obsolete method and " +
"will be removed in a future release.");
</body>
</method>
<field name="mTabbedMode" readonly="true">true</field>

View file

@ -124,7 +124,7 @@ var FormValidationHandler =
let tabBrowser = aWindow.gBrowser;
this._anchor = tabBrowser.popupAnchor;
this._anchor.left = aPanelData.contentRect.left;
this._anchor.top = aPanelData.contentRect.top;
this._anchor.top = Math.max(0, aPanelData.contentRect.top);
this._anchor.width = aPanelData.contentRect.width;
this._anchor.height = aPanelData.contentRect.height;
this._anchor.hidden = false;

View file

@ -74,6 +74,7 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsINode *aSourceNode)
aNewDoc->Reset(channel, loadGroup);
aNewDoc->SetPrincipal(sourcePrincipal);
aNewDoc->SetBaseURI(sourceDoc->GetDocBaseURI());
aNewDoc->SetSandboxFlags(sourceDoc->GetSandboxFlags());
// Copy charset
aNewDoc->SetDocumentCharacterSetSource(

View file

@ -297,22 +297,9 @@ typedef long ssize_t;
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifndef MOZ_MEMORY_DARWIN
#include <strings.h>
#endif
#include <unistd.h>
#ifdef MOZ_MEMORY_DARWIN
#include <libkern/OSAtomic.h>
#include <mach/mach_error.h>
#include <mach/mach_init.h>
#include <mach/vm_map.h>
#include <malloc/malloc.h>
#ifndef _pthread_self
#define _pthread_self() pthread_self()
#endif
#endif
#endif
#include "jemalloc_types.h"

View file

@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set ts=4 sw=4 et cindent: */
/* 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/. */
@ -2153,7 +2152,9 @@ nsSocketTransport::OpenInputStream(uint32_t flags,
mInputClosed = false;
rv = PostEvent(MSG_ENSURE_CONNECT);
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) {
return rv;
}
result.forget(aResult);
return NS_OK;
@ -2173,6 +2174,7 @@ nsSocketTransport::OpenOutputStream(uint32_t flags,
nsresult rv;
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
nsCOMPtr<nsIOutputStream> result;
if (!(flags & OPEN_UNBUFFERED) || (flags & OPEN_BLOCKING)) {
// XXX if the caller wants blocking, then the caller also gets buffered!
//bool openBuffered = !(flags & OPEN_UNBUFFERED);

View file

@ -306,6 +306,9 @@ private:
uint16_t SocketPort() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyPort : mPort; }
const nsCString &SocketHost() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyHost : mHost; }
Atomic<bool> mInputClosed{true};
Atomic<bool> mOutputClosed{true};
//-------------------------------------------------------------------------
// members accessible only on the socket transport thread:
// (the exception being initialization/shutdown time)
@ -314,8 +317,6 @@ private:
// socket state vars:
uint32_t mState; // STATE_??? flags
bool mAttached;
bool mInputClosed;
bool mOutputClosed;
// The platform-specific network interface id that this socket
// associated with.
@ -455,7 +456,7 @@ private:
int32_t mKeepaliveRetryIntervalS;
int32_t mKeepaliveProbeCount;
bool mDoNotRetryToConnect;
Atomic<bool> mDoNotRetryToConnect{false};
};
} // namespace net

View file

@ -554,37 +554,76 @@ nsStandardURL::NormalizeIPv4(const nsCSubstring &host, nsCString &result)
return NS_OK;
}
/**
* Returns |true| if |aString| contains only ASCII characters according
* to our CRT.
*
* @param aString an 8-bit wide string to scan
*/
inline bool IsAsciiString(mozilla::Span<const char> aString) {
for (char c : aString) {
if (!nsCRT::IsAscii(c)) {
return false;
}
}
return true;
}
nsresult
nsStandardURL::NormalizeIDN(const nsCSubstring &host, nsCString &result)
{
// If host is ACE, then convert to UTF-8. Else, if host is already UTF-8,
// then make sure it is normalized per IDN.
// this function returns true if normalization succeeds.
// NOTE: As a side-effect this function sets mHostEncoding. While it would
// be nice to avoid side-effects in this function, the implementation of
// this function is already somewhat bound to the behavior of the
// callsites. Anyways, this function exists to avoid code duplication, so
// side-effects abound :-/
NS_ASSERTION(mHostEncoding == eEncoding_ASCII, "unexpected default encoding");
bool isASCII;
nsresult rv = NS_ERROR_UNEXPECTED;
// Clear result even if we bail.
result.Truncate();
if (!gIDN) {
nsCOMPtr<nsIIDNService> serv(do_GetService(NS_IDNSERVICE_CONTRACTID));
if (serv) {
NS_ADDREF(gIDN = serv.get());
}
}
if (!gIDN) {
return NS_ERROR_UNEXPECTED;
}
result.Truncate();
nsresult rv = NS_ERROR_UNEXPECTED;
if (gIDN) {
rv = gIDN->ConvertToDisplayIDN(host, &isASCII, result);
if (NS_SUCCEEDED(rv) && !isASCII) {
mHostEncoding = eEncoding_UTF8;
}
NS_ASSERTION(mHostEncoding == eEncoding_ASCII, "unexpected default encoding");
bool isASCII;
nsAutoCString normalized;
// If the input is ASCII, and not ACE encoded, then there's no processing
// needed. This is needed because we want to allow ascii labels longer than
// 64 characters for some schemes.
bool isACE = false;
if (IsAsciiString(host) && NS_SUCCEEDED(gIDN->IsACE(host, &isACE)) && !isACE) {
result = host;
return NS_OK;
}
// If the input is an ACE encoded string it MUST be ASCII or it's malformed
// according to the spec.
if (!IsAsciiString(host) && isACE) {
return NS_ERROR_MALFORMED_URI;
}
// Even if it's already ACE, we must still call ConvertUTF8toACE in order
// for the input normalization to take place.
rv = gIDN->ConvertUTF8toACE(host, normalized);
if (NS_FAILED(rv)) {
return rv;
}
// If the ASCII representation doesn't contain the xn-- token then we don't
// need to call ConvertToDisplayIDN as that would not change anything.
if (!StringBeginsWith(normalized, NS_LITERAL_CSTRING("xn--")) &&
normalized.Find(NS_LITERAL_CSTRING(".xn--")) == kNotFound) {
return NS_OK;
}
// Finally, convert to IDN
rv = gIDN->ConvertToDisplayIDN(normalized, &isASCII, result);
if (NS_SUCCEEDED(rv) && !isASCII) {
mHostEncoding = eEncoding_UTF8;
}
return rv;

View file

@ -202,7 +202,13 @@ nsIDNService::IDNA2008StringPrep(const nsAString& input,
return NS_OK;
}
if (info.errors != 0) {
uint32_t ignoredErrors = 0;
if (flag == eStringPrepForDNS) {
ignoredErrors = UIDNA_ERROR_LEADING_HYPHEN | UIDNA_ERROR_TRAILING_HYPHEN |
UIDNA_ERROR_HYPHEN_3_4;
}
if ((info.errors & ~ignoredErrors) != 0) {
if (flag == eStringPrepForDNS) {
output.Truncate();
}
@ -309,18 +315,40 @@ nsresult nsIDNService::ACEtoUTF8(const nsACString & input, nsACString & _retval,
return NS_OK;
}
/**
* Returns |true| if |aString| contains only ASCII characters according
* to our CRT.
*
* @param aString an 8-bit wide string to scan
*/
inline bool IsAsciiString(mozilla::Span<const char> aString) {
for (char c : aString) {
if (!nsCRT::IsAscii(c)) {
return false;
}
}
return true;
}
NS_IMETHODIMP nsIDNService::IsACE(const nsACString & input, bool *_retval)
{
const char *data = input.BeginReading();
uint32_t dataLen = input.Length();
// look for the ACE prefix in the input string. it may occur
// at the beginning of any segment in the domain name. for
// example: "www.xn--ENCODED.com"
if (!IsAsciiString(input)) {
*_retval = false;
return NS_OK;
}
auto stringContains = [](const nsACString& haystack,
const nsACString& needle) {
return std::search(haystack.BeginReading(), haystack.EndReading(),
needle.BeginReading(),
needle.EndReading()) != haystack.EndReading();
};
const char *p = PL_strncasestr(data, kACEPrefix, dataLen);
*_retval = p && (p == data || *(p - 1) == '.');
*_retval = StringBeginsWith(input, NS_LITERAL_CSTRING("xn--")) ||
(!input.IsEmpty() && input[0] != '.' &&
stringContains(input, NS_LITERAL_CSTRING(".xn--")));
return NS_OK;
}

View file

@ -826,15 +826,6 @@ nsHttpHandler::InitUserAgentComponents()
PR_smprintf_free(buf);
}
}
#elif defined (XP_MACOSX)
#if defined(__ppc__)
mOscpu.AssignLiteral("PPC Mac OS X");
#elif defined(__i386__) || defined(__x86_64__)
mOscpu.AssignLiteral("Intel Mac OS X");
#endif
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
mOscpu += nsPrintfCString(" %d.%d", majorVersion, minorVersion);
#elif defined (XP_UNIX)
struct utsname name;

View file

@ -111,7 +111,7 @@ const NEW_LINES = /(\r\n|\r|\n)/;
// Set an arbitrary cap on the maximum icon size. Without this, large icons can
// cause big delays when loading them at startup.
const MAX_ICON_SIZE = 10000;
const MAX_ICON_SIZE = 32768;
// Default charset to use for sending search parameters. ISO-8859-1 is used to
// match previous nsInternetSearchService behavior.

View file

@ -49,21 +49,6 @@ enum class OperatingSystem {
Windows8_1,
Windows10,
Linux,
OSX,
OSX10_5,
OSX10_6,
OSX10_7,
OSX10_8,
OSX10_9,
OSX10_10,
OSX10_11,
OSX10_12,
OSX10_13,
OSX10_14,
OSX10_15,
OSX10_16,
OSX11_0,
Ios
};
enum VersionComparisonOp {

View file

@ -263,30 +263,6 @@ BlacklistOSToOperatingSystem(const nsAString& os)
return OperatingSystem::Windows10;
else if (os.EqualsLiteral("Linux"))
return OperatingSystem::Linux;
else if (os.EqualsLiteral("Darwin 9"))
return OperatingSystem::OSX10_5;
else if (os.EqualsLiteral("Darwin 10"))
return OperatingSystem::OSX10_6;
else if (os.EqualsLiteral("Darwin 11"))
return OperatingSystem::OSX10_7;
else if (os.EqualsLiteral("Darwin 12"))
return OperatingSystem::OSX10_8;
else if (os.EqualsLiteral("Darwin 13"))
return OperatingSystem::OSX10_9;
else if (os.EqualsLiteral("Darwin 14"))
return OperatingSystem::OSX10_10;
else if (os.EqualsLiteral("Darwin 15"))
return OperatingSystem::OSX10_11;
else if (os.EqualsLiteral("Darwin 16"))
return OperatingSystem::OSX10_12;
else if (os.EqualsLiteral("Darwin 17"))
return OperatingSystem::OSX10_13;
else if (os.EqualsLiteral("Darwin 18"))
return OperatingSystem::OSX10_14;
else if (os.EqualsLiteral("Darwin 19"))
return OperatingSystem::OSX10_15;
else if (os.EqualsLiteral("Darwin 20"))
return OperatingSystem::OSX11_0;
// For historical reasons, "All" in blocklist means "All Windows"
else if (os.EqualsLiteral("All"))
return OperatingSystem::Windows;

View file

@ -539,12 +539,6 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
info.dwMinorVersion);
}
#pragma warning(pop)
#elif defined(MOZ_WIDGET_COCOA)
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
majorVersion,
minorVersion);
#elif defined(MOZ_WIDGET_GTK)
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld",
gtk_major_version,