Bug 1519636 - Reformat recent changes to the Google coding style r=geckoview-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,nalexander,gstoll,tcampbell,janv,julienw

Updated with clang-format version 19.1.7 (taskcluster-DYvBxDZJRVqTi8E7pTSJAQ)

Differential Revision: https://phabricator.services.mozilla.com/D249880
This commit is contained in:
Sylvestre Ledru
2025-05-17 19:07:22 +00:00
committed by sledru@mozilla.com
parent 1df22ac023
commit 8ae54ea4f9
331 changed files with 2084 additions and 2460 deletions

View File

@@ -56,12 +56,8 @@ class xpcAccessibilityService : public nsIAccessibilityService {
// for component registration // for component registration
// {3b265b69-f813-48ff-880d-d88d101af404} // {3b265b69-f813-48ff-880d-d88d101af404}
#define NS_ACCESSIBILITY_SERVICE_CID \ #define NS_ACCESSIBILITY_SERVICE_CID \
{ \ {0x3b265b69, 0xf813, 0x48ff, {0x88, 0x0d, 0xd8, 0x8d, 0x10, 0x1a, 0xf4, 0x04}}
0x3b265b69, 0xf813, 0x48ff, { \
0x88, 0x0d, 0xd8, 0x8d, 0x10, 0x1a, 0xf4, 0x04 \
} \
}
extern nsresult NS_GetAccessibilityService(nsIAccessibilityService** aResult); extern nsresult NS_GetAccessibilityService(nsIAccessibilityService** aResult);

View File

@@ -5,37 +5,24 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef XP_WIN #ifdef XP_WIN
# define NS_WINIEHISTORYENUMERATOR_CID \ # define NS_WINIEHISTORYENUMERATOR_CID \
{ \ {0x93480624, \
0x93480624, 0x806e, 0x4756, { \ 0x806e, \
0xb7, 0xcb, 0x0f, 0xb7, 0xdd, 0x74, 0x6a, 0x8f \ 0x4756, \
} \ {0xb7, 0xcb, 0x0f, 0xb7, 0xdd, 0x74, 0x6a, 0x8f}}
}
# define NS_IEHISTORYENUMERATOR_CONTRACTID \ # define NS_IEHISTORYENUMERATOR_CONTRACTID \
"@mozilla.org/profile/migrator/iehistoryenumerator;1" "@mozilla.org/profile/migrator/iehistoryenumerator;1"
#endif #endif
#define NS_SHELLSERVICE_CID \ #define NS_SHELLSERVICE_CID \
{ \ {0x63c7b9f4, 0xcc8, 0x43f8, {0xb6, 0x66, 0xa, 0x66, 0x16, 0x55, 0xcb, 0x73}}
0x63c7b9f4, 0xcc8, 0x43f8, { \
0xb6, 0x66, 0xa, 0x66, 0x16, 0x55, 0xcb, 0x73 \
} \
}
#define NS_SHELLSERVICE_CONTRACTID "@mozilla.org/browser/shell-service;1" #define NS_SHELLSERVICE_CONTRACTID "@mozilla.org/browser/shell-service;1"
#define NS_RDF_FORWARDPROXY_INFER_DATASOURCE_CID \ #define NS_RDF_FORWARDPROXY_INFER_DATASOURCE_CID \
{ \ {0x7a024bcf, 0xedd5, 0x4d9a, {0x86, 0x14, 0xd4, 0x4b, 0xe1, 0xda, 0xda, 0xd3}}
0x7a024bcf, 0xedd5, 0x4d9a, { \
0x86, 0x14, 0xd4, 0x4b, 0xe1, 0xda, 0xda, 0xd3 \
} \
}
// 136e2c4d-c5a4-477c-b131-d93d7d704f64 // 136e2c4d-c5a4-477c-b131-d93d7d704f64
#define NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID \ #define NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID \
{ \ {0x136e2c4d, 0xc5a4, 0x477c, {0xb1, 0x31, 0xd9, 0x3d, 0x7d, 0x70, 0x4f, 0x64}}
0x136e2c4d, 0xc5a4, 0x477c, { \
0xb1, 0x31, 0xd9, 0x3d, 0x7d, 0x70, 0x4f, 0x64 \
} \
}

View File

@@ -274,7 +274,7 @@ void DBusHandleResultMetas(
static void ActivateResultID( static void ActivateResultID(
RefPtr<nsGNOMEShellHistorySearchResult> aSearchResult, RefPtr<nsGNOMEShellHistorySearchResult> aSearchResult,
const char* aResultID, uint32_t aTimeStamp) { const char* aResultID, uint32_t aTimeStamp) {
mozilla::UniquePtr<char[]>commandLine; mozilla::UniquePtr<char[]> commandLine;
int len; int len;
if (strncmp(aResultID, KEYWORD_SEARCH_STRING, KEYWORD_SEARCH_STRING_LEN) == if (strncmp(aResultID, KEYWORD_SEARCH_STRING, KEYWORD_SEARCH_STRING_LEN) ==

View File

@@ -69,8 +69,7 @@ struct RelR : public Elf<bits> {
using Elf_Verneed = typename Elf<bits>::Verneed; using Elf_Verneed = typename Elf<bits>::Verneed;
using Elf_Vernaux = typename Elf<bits>::Vernaux; using Elf_Vernaux = typename Elf<bits>::Vernaux;
#define TAG_NAME(t) \ #define TAG_NAME(t) {t, #t}
{ t, #t }
class DynInfo { class DynInfo {
public: public:
using Tag = decltype(Elf_Dyn::d_tag); using Tag = decltype(Elf_Dyn::d_tag);

View File

@@ -6,11 +6,11 @@
/* Recent binutils would put .ctors content into a .init_array section */ /* Recent binutils would put .ctors content into a .init_array section */
__attribute__((section(".manual_ctors"), used)) static void (*ctors[])() = { __attribute__((section(".manual_ctors"), used)) static void (*ctors[])() = {
(void (*)()) - 1, end_test, test, NULL}; (void (*)())-1, end_test, test, NULL};
__attribute__((section(".init"))) void _init() { __attribute__((section(".init"))) void _init() {
void (**func)() = &ctors[sizeof(ctors) / sizeof(void (*)()) - 1]; void (**func)() = &ctors[sizeof(ctors) / sizeof(void (*)()) - 1];
while (*(--func) != (void (*)()) - 1) { while (*(--func) != (void (*)())-1) {
(*func)(); (*func)();
} }
} }

View File

@@ -85,11 +85,7 @@ class ContentPrincipal final : public BasePrincipal {
} // namespace mozilla } // namespace mozilla
#define NS_PRINCIPAL_CID \ #define NS_PRINCIPAL_CID \
{ \ {0x653e0e4d, 0x3ee4, 0x45fa, {0xb2, 0x72, 0x97, 0xc2, 0x0b, 0xc0, 0x1e, 0xb8}}
0x653e0e4d, 0x3ee4, 0x45fa, { \
0xb2, 0x72, 0x97, 0xc2, 0x0b, 0xc0, 0x1e, 0xb8 \
} \
}
#endif // mozilla_ContentPrincipal_h #endif // mozilla_ContentPrincipal_h

View File

@@ -90,11 +90,7 @@ class ExpandedPrincipal : public nsIExpandedPrincipal,
MOZ_GUARDED_BY(mozilla::sMainThreadCapability); MOZ_GUARDED_BY(mozilla::sMainThreadCapability);
}; };
#define NS_EXPANDEDPRINCIPAL_CID \ #define NS_EXPANDEDPRINCIPAL_CID \
{ \ {0xe8ee88b0, 0x5571, 0x4086, {0xa4, 0x5b, 0x39, 0xa7, 0x16, 0x90, 0x6b, 0xdb}}
0xe8ee88b0, 0x5571, 0x4086, { \
0xa4, 0x5b, 0x39, 0xa7, 0x16, 0x90, 0x6b, 0xdb \
} \
}
#endif // ExpandedPrincipal_h #endif // ExpandedPrincipal_h

View File

@@ -22,12 +22,8 @@
class nsIDocShell; class nsIDocShell;
class nsIURI; class nsIURI;
#define NS_NULLPRINCIPAL_CID \ #define NS_NULLPRINCIPAL_CID \
{ \ {0xbd066e5f, 0x146f, 0x4472, {0x83, 0x31, 0x7b, 0xfd, 0x05, 0xb1, 0xed, 0x90}}
0xbd066e5f, 0x146f, 0x4472, { \
0x83, 0x31, 0x7b, 0xfd, 0x05, 0xb1, 0xed, 0x90 \
} \
}
#define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal" #define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"

View File

@@ -14,12 +14,8 @@
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#define NS_SYSTEMPRINCIPAL_CID \ #define NS_SYSTEMPRINCIPAL_CID \
{ \ {0x4a6212db, 0xaccb, 0x11d3, {0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb}}
0x4a6212db, 0xaccb, 0x11d3, { \
0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb \
} \
}
#define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1" #define NS_SYSTEMPRINCIPAL_CONTRACTID "@mozilla.org/systemprincipal;1"
class nsScriptSecurityManager; class nsScriptSecurityManager;

View File

@@ -12,8 +12,8 @@ TEST(PrincipalHash, DocumentDomain)
nsCOMPtr<nsIScriptSecurityManager> ssm = nsCOMPtr<nsIScriptSecurityManager> ssm =
nsScriptSecurityManager::GetScriptSecurityManager(); nsScriptSecurityManager::GetScriptSecurityManager();
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;
nsresult rv = nsresult rv = ssm->CreateContentPrincipalFromOrigin(
ssm->CreateContentPrincipalFromOrigin("https://sub.mozilla.org"_ns, getter_AddRefs(principal)); "https://sub.mozilla.org"_ns, getter_AddRefs(principal));
EXPECT_NS_SUCCEEDED(rv); EXPECT_NS_SUCCEEDED(rv);
const auto hash = principal->GetHashValue(); const auto hash = principal->GetHashValue();
@@ -23,5 +23,6 @@ TEST(PrincipalHash, DocumentDomain)
EXPECT_NS_SUCCEEDED(rv); EXPECT_NS_SUCCEEDED(rv);
principal->SetDomain(domain); principal->SetDomain(domain);
ASSERT_EQ(principal->GetHashValue(), hash) << "Principal hash shouldn't change"; ASSERT_EQ(principal->GetHashValue(), hash)
<< "Principal hash shouldn't change";
} }

View File

@@ -10,12 +10,12 @@
#include "nsWeakReference.h" #include "nsWeakReference.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#define NS_CHROMEPROTOCOLHANDLER_CID \ #define NS_CHROMEPROTOCOLHANDLER_CID \
{ /* 61ba33c0-3031-11d3-8cd0-0060b0fc14a3 */ \ {/* 61ba33c0-3031-11d3-8cd0-0060b0fc14a3 */ \
0x61ba33c0, 0x3031, 0x11d3, { \ 0x61ba33c0, \
0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3 \ 0x3031, \
} \ 0x11d3, \
} {0x8c, 0xd0, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3}}
class nsChromeProtocolHandler final : public nsIProtocolHandler, class nsChromeProtocolHandler final : public nsIProtocolHandler,
public nsSupportsWeakReference { public nsSupportsWeakReference {

View File

@@ -29,12 +29,8 @@ class nsIURL;
// for component registration // for component registration
// {47049e42-1d87-482a-984d-56ae185e367a} // {47049e42-1d87-482a-984d-56ae185e367a}
#define NS_CHROMEREGISTRY_CID \ #define NS_CHROMEREGISTRY_CID \
{ \ {0x47049e42, 0x1d87, 0x482a, {0x98, 0x4d, 0x56, 0xae, 0x18, 0x5e, 0x36, 0x7a}}
0x47049e42, 0x1d87, 0x482a, { \
0x98, 0x4d, 0x56, 0xae, 0x18, 0x5e, 0x36, 0x7a \
} \
}
class nsChromeRegistry : public nsIToolkitChromeRegistry, class nsChromeRegistry : public nsIToolkitChromeRegistry,
public nsIObserver, public nsIObserver,

View File

@@ -13,12 +13,8 @@
#define JSDEBUGGER_CONTRACTID "@mozilla.org/jsdebugger;1" #define JSDEBUGGER_CONTRACTID "@mozilla.org/jsdebugger;1"
#define JSDEBUGGER_CID \ #define JSDEBUGGER_CID \
{ \ {0x0365cbd5, 0xd46e, 0x4e94, {0xa3, 0x9f, 0x83, 0xb6, 0x3c, 0xd1, 0xa9, 0x63}}
0x0365cbd5, 0xd46e, 0x4e94, { \
0xa3, 0x9f, 0x83, 0xb6, 0x3c, 0xd1, 0xa9, 0x63 \
} \
}
namespace mozilla::jsdebugger { namespace mozilla::jsdebugger {

View File

@@ -11,12 +11,8 @@
#define JSINSPECTOR_CONTRACTID "@mozilla.org/jsinspector;1" #define JSINSPECTOR_CONTRACTID "@mozilla.org/jsinspector;1"
#define JSINSPECTOR_CID \ #define JSINSPECTOR_CID \
{ \ {0xec5aa99c, 0x7abb, 0x4142, {0xac, 0x5f, 0xaa, 0xb2, 0x41, 0x9e, 0x38, 0xe2}}
0xec5aa99c, 0x7abb, 0x4142, { \
0xac, 0x5f, 0xaa, 0xb2, 0x41, 0x9e, 0x38, 0xe2 \
} \
}
namespace mozilla { namespace mozilla {
namespace jsinspector { namespace jsinspector {

View File

@@ -119,7 +119,7 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS}, nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS},
#ifdef MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_ANDROID
{"home", "about:blank", {"home", "about:blank",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS | nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
nsIAboutModule::URI_MUST_LOAD_IN_CHILD}, nsIAboutModule::URI_MUST_LOAD_IN_CHILD},
#endif #endif

View File

@@ -18,6 +18,7 @@ namespace mozilla {
template <typename AnimationPtrType> template <typename AnimationPtrType>
class AnimationPtrComparator { class AnimationPtrComparator {
mutable nsContentUtils::NodeIndexCache mCache; mutable nsContentUtils::NodeIndexCache mCache;
public: public:
bool Equals(const AnimationPtrType& a, const AnimationPtrType& b) const { bool Equals(const AnimationPtrType& a, const AnimationPtrType& b) const {
return a == b; return a == b;

View File

@@ -2652,8 +2652,7 @@ void ChromeUtils::AndroidMoveTaskToBack(GlobalObject& aGlobal) {
already_AddRefed<nsIContentSecurityPolicy> ChromeUtils::CreateCSPFromHeader( already_AddRefed<nsIContentSecurityPolicy> ChromeUtils::CreateCSPFromHeader(
GlobalObject& aGlobal, const nsAString& aHeader, nsIURI* aSelfURI, GlobalObject& aGlobal, const nsAString& aHeader, nsIURI* aSelfURI,
nsIPrincipal* aLoadingPrincipal, ErrorResult& aRv) { nsIPrincipal* aLoadingPrincipal, ErrorResult& aRv) {
return CSP_CreateFromHeader(aHeader, aSelfURI, aLoadingPrincipal, return CSP_CreateFromHeader(aHeader, aSelfURI, aLoadingPrincipal, aRv);
aRv);
} }
} // namespace mozilla::dom } // namespace mozilla::dom

View File

@@ -15014,8 +15014,8 @@ void Document::HandleEscKey() {
if (RefPtr dialogElement = HTMLDialogElement::FromNodeOrNull(element)) { if (RefPtr dialogElement = HTMLDialogElement::FromNodeOrNull(element)) {
if (StaticPrefs::dom_dialog_light_dismiss_enabled()) { if (StaticPrefs::dom_dialog_light_dismiss_enabled()) {
if (dialogElement->GetClosedBy() != HTMLDialogElement::ClosedBy::None) { if (dialogElement->GetClosedBy() != HTMLDialogElement::ClosedBy::None) {
const mozilla::dom::Optional<nsAString> returnValue; const mozilla::dom::Optional<nsAString> returnValue;
dialogElement->RequestClose(returnValue); dialogElement->RequestClose(returnValue);
} }
} else { } else {
dialogElement->QueueCancelDialog(); dialogElement->QueueCancelDialog();
@@ -20370,8 +20370,8 @@ already_AddRefed<Document> Document::ParseHTML(GlobalObject& aGlobal,
// Step 4. Let sanitizer be the result of calling get a sanitizer instance // Step 4. Let sanitizer be the result of calling get a sanitizer instance
// from options with options and true. // from options with options and true.
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
RefPtr<Sanitizer> sanitizer = RefPtr<Sanitizer> sanitizer = Sanitizer::GetInstance(
Sanitizer::GetInstance(global, aOptions.mSanitizer, /* aSafe */ true, aError); global, aOptions.mSanitizer, /* aSafe */ true, aError);
if (aError.Failed()) { if (aError.Failed()) {
return nullptr; return nullptr;
} }

View File

@@ -63,8 +63,8 @@ struct ChangesToFlush {
: mFlushType(aFlushType), : mFlushType(aFlushType),
mFlushAnimations(aFlushAnimations), mFlushAnimations(aFlushAnimations),
mUpdateRelevancy(aUpdateRelevancy) { mUpdateRelevancy(aUpdateRelevancy) {
MOZ_ASSERT_IF(mUpdateRelevancy, mFlushType >= FlushType::Layout); MOZ_ASSERT_IF(mUpdateRelevancy, mFlushType >= FlushType::Layout);
} }
FlushType mFlushType; FlushType mFlushType;
bool mFlushAnimations; bool mFlushAnimations;

View File

@@ -140,7 +140,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE_AND_DESTROY(nsIContent,
LastRelease(), LastRelease(),
Destroy()) Destroy())
nsIContent* nsIContent::FindFirstNonChromeOnlyAccessContent() const { nsIContent*
nsIContent::FindFirstNonChromeOnlyAccessContent() const {
// This handles also nested native anonymous content. // This handles also nested native anonymous content.
// Oops, this function signature allows casting const to non-const. (Then // Oops, this function signature allows casting const to non-const. (Then
// again, so does GetFirstChild()->GetParent().) // again, so does GetFirstChild()->GetParent().)

View File

@@ -1557,8 +1557,7 @@ int32_t nsAttrValue::EnumTableEntryToValue(EnumTableSpan aEnumTable,
return value; return value;
} }
bool nsAttrValue::ParseEnumValue(const nsAString& aValue, bool nsAttrValue::ParseEnumValue(const nsAString& aValue, EnumTableSpan aTable,
EnumTableSpan aTable,
bool aCaseSensitive, bool aCaseSensitive,
const EnumTableEntry* aDefaultValue) { const EnumTableEntry* aDefaultValue) {
ResetIfSet(); ResetIfSet();

View File

@@ -9,19 +9,19 @@
#include "nsISupports.h" #include "nsISupports.h"
#define NS_DOM_SCRIPT_OBJECT_FACTORY_CID \ #define NS_DOM_SCRIPT_OBJECT_FACTORY_CID \
{ /* 9eb760f0-4380-11d2-b328-00805f8a3859 */ \ {/* 9eb760f0-4380-11d2-b328-00805f8a3859 */ \
0x9eb760f0, 0x4380, 0x11d2, { \ 0x9eb760f0, \
0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59 \ 0x4380, \
} \ 0x11d2, \
} {0xb3, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0x38, 0x59}}
#define NS_SCRIPT_NAMESET_REGISTRY_CID \ #define NS_SCRIPT_NAMESET_REGISTRY_CID \
{ /* 45f27d10-987b-11d2-bd40-00105aa45e89 */ \ {/* 45f27d10-987b-11d2-bd40-00105aa45e89 */ \
0x45f27d10, 0x987b, 0x11d2, { \ 0x45f27d10, \
0xbd, 0x40, 0x00, 0x10, 0x5a, 0xa4, 0x5e, 0x89 \ 0x987b, \
} \ 0x11d2, \
} {0xbd, 0x40, 0x00, 0x10, 0x5a, 0xa4, 0x5e, 0x89}}
#define NS_XPATH_EVALUATOR_CONTRACTID "@mozilla.org/dom/xpath-evaluator;1" #define NS_XPATH_EVALUATOR_CONTRACTID "@mozilla.org/dom/xpath-evaluator;1"

View File

@@ -14,12 +14,8 @@
#define nsDataDocumentContentPolicy_h__ #define nsDataDocumentContentPolicy_h__
/* 1147d32c-215b-4014-b180-07fe7aedf915 */ /* 1147d32c-215b-4014-b180-07fe7aedf915 */
#define NS_DATADOCUMENTCONTENTPOLICY_CID \ #define NS_DATADOCUMENTCONTENTPOLICY_CID \
{ \ {0x1147d32c, 0x215b, 0x4014, {0xb1, 0x80, 0x07, 0xfe, 0x7a, 0xed, 0xf9, 0x15}}
0x1147d32c, 0x215b, 0x4014, { \
0xb1, 0x80, 0x07, 0xfe, 0x7a, 0xed, 0xf9, 0x15 \
} \
}
#define NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID \ #define NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID \
"@mozilla.org/data-document-content-policy;1" "@mozilla.org/data-document-content-policy;1"

View File

@@ -50,8 +50,7 @@ using mozilla::dom::ServiceWorkerRegistration;
using mozilla::dom::ServiceWorkerRegistrationDescriptor; using mozilla::dom::ServiceWorkerRegistrationDescriptor;
using mozilla::dom::VoidFunction; using mozilla::dom::VoidFunction;
nsIGlobalObject::nsIGlobalObject() nsIGlobalObject::nsIGlobalObject() : mIsDying(false), mIsInnerWindow(false) {}
: mIsDying(false), mIsInnerWindow(false) {}
bool nsIGlobalObject::IsScriptForbidden(JSObject* aCallback, bool nsIGlobalObject::IsScriptForbidden(JSObject* aCallback,
bool aIsJSImplementedWebIDL) const { bool aIsJSImplementedWebIDL) const {

View File

@@ -14,12 +14,8 @@
#define nsNoDataProtocolContentPolicy_h__ #define nsNoDataProtocolContentPolicy_h__
/* ac9e3e82-bfbd-4f26-941e-f58c8ee178c1 */ /* ac9e3e82-bfbd-4f26-941e-f58c8ee178c1 */
#define NS_NODATAPROTOCOLCONTENTPOLICY_CID \ #define NS_NODATAPROTOCOLCONTENTPOLICY_CID \
{ \ {0xac9e3e82, 0xbfbd, 0x4f26, {0x94, 0x1e, 0xf5, 0x8c, 0x8e, 0xe1, 0x78, 0xc1}}
0xac9e3e82, 0xbfbd, 0x4f26, { \
0x94, 0x1e, 0xf5, 0x8c, 0x8e, 0xe1, 0x78, 0xc1 \
} \
}
#define NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID \ #define NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID \
"@mozilla.org/no-data-protocol-content-policy;1" "@mozilla.org/no-data-protocol-content-policy;1"

View File

@@ -16,12 +16,12 @@ class nsIVariant;
#define NS_STRUCTUREDCLONECONTAINER_CONTRACTID \ #define NS_STRUCTUREDCLONECONTAINER_CONTRACTID \
"@mozilla.org/docshell/structured-clone-container;1" "@mozilla.org/docshell/structured-clone-container;1"
#define NS_STRUCTUREDCLONECONTAINER_CID \ #define NS_STRUCTUREDCLONECONTAINER_CID \
{ /* 38bd0634-0fd4-46f0-b85f-13ced889eeec */ \ {/* 38bd0634-0fd4-46f0-b85f-13ced889eeec */ \
0x38bd0634, 0x0fd4, 0x46f0, { \ 0x38bd0634, \
0xb8, 0x5f, 0x13, 0xce, 0xd8, 0x89, 0xee, 0xec \ 0x0fd4, \
} \ 0x46f0, \
} {0xb8, 0x5f, 0x13, 0xce, 0xd8, 0x89, 0xee, 0xec}}
class nsStructuredCloneContainer final class nsStructuredCloneContainer final
: public nsIStructuredCloneContainer, : public nsIStructuredCloneContainer,

View File

@@ -344,4 +344,6 @@ TEST(TestScheduler, Idle)
} }
TEST(TestScheduler, NonIdle) TEST(TestScheduler, NonIdle)
{ EXPECT_TRUE(BasicScenario(scheduler, &gc, &ccNonIdle)); } {
EXPECT_TRUE(BasicScenario(scheduler, &gc, &ccNonIdle));
}

View File

@@ -906,46 +906,46 @@ namespace binding_detail {
template <typename Union, typename UnionMemberType, typename = int> template <typename Union, typename UnionMemberType, typename = int>
struct ApplyToTypedArray; struct ApplyToTypedArray;
#define APPLY_IMPL(type) \ #define APPLY_IMPL(type) \
template <typename Union> \ template <typename Union> \
struct ApplyToTypedArray<Union, type, decltype((void)&Union::Is##type, 0)> { \ struct ApplyToTypedArray<Union, type, decltype((void)&Union::Is##type, 0)> { \
/* Return type of calling the lambda with a TypedArray 'type'. */ \ /* Return type of calling the lambda with a TypedArray 'type'. */ \
template <typename F> \ template <typename F> \
using FunReturnType = decltype(std::declval<F>()(std::declval<type>())); \ using FunReturnType = decltype(std::declval<F>()(std::declval<type>())); \
\ \
/* Whether the return type of calling the lambda with a TypedArray */ \ /* Whether the return type of calling the lambda with a TypedArray */ \
/* 'type' is void. */ \ /* 'type' is void. */ \
template <typename F> \ template <typename F> \
static constexpr bool FunReturnsVoid = \ static constexpr bool FunReturnsVoid = \
std::is_same_v<FunReturnType<F>, void>; \ std::is_same_v<FunReturnType<F>, void>; \
\ \
/* The return type of calling Apply with a union that has 'type' as */ \ /* The return type of calling Apply with a union that has 'type' as */ \
/* one of its union member types depends on the return type of */ \ /* one of its union member types depends on the return type of */ \
/* calling the lambda. This return type will be bool if the lambda */ \ /* calling the lambda. This return type will be bool if the lambda */ \
/* returns void, or it will be a Maybe<…> with the inner type being */ \ /* returns void, or it will be a Maybe<…> with the inner type being */ \
/* the actual return type of calling the lambda. If the union */ \ /* the actual return type of calling the lambda. If the union */ \
/* contains a value of the right type, then calling Apply will return */ \ /* contains a value of the right type, then calling Apply will return */ \
/* either 'true', or 'Some(…)' containing the return value of calling */ \ /* either 'true', or 'Some(…)' containing the return value of calling */ \
/* the lambda. If the union does not contain a value of the right */ \ /* the lambda. If the union does not contain a value of the right */ \
/* type, then calling Apply will return either 'false', or */ \ /* type, then calling Apply will return either 'false', or */ \
/* 'Nothing()'. */ \ /* 'Nothing()'. */ \
template <typename F> \ template <typename F> \
using ApplyReturnType = \ using ApplyReturnType = \
std::conditional_t<FunReturnsVoid<F>, bool, Maybe<FunReturnType<F>>>; \ std::conditional_t<FunReturnsVoid<F>, bool, Maybe<FunReturnType<F>>>; \
\ \
public: \ public: \
template <typename F> \ template <typename F> \
static ApplyReturnType<F> Apply(const Union& aUnion, F&& aFun) { \ static ApplyReturnType<F> Apply(const Union& aUnion, F&& aFun) { \
if (!aUnion.Is##type()) { \ if (!aUnion.Is##type()) { \
return ApplyReturnType<F>(); /* false or Nothing() */ \ return ApplyReturnType<F>(); /* false or Nothing() */ \
} \ } \
if constexpr (FunReturnsVoid<F>) { \ if constexpr (FunReturnsVoid<F>) { \
std::forward<F>(aFun)(aUnion.GetAs##type()); \ std::forward<F>(aFun)(aUnion.GetAs##type()); \
return true; \ return true; \
} else { \ } else { \
return Some(std::forward<F>(aFun)(aUnion.GetAs##type())); \ return Some(std::forward<F>(aFun)(aUnion.GetAs##type())); \
} \ } \
} \ } \
}; };
APPLY_IMPL(Int8Array) APPLY_IMPL(Int8Array)

View File

@@ -57,7 +57,7 @@ static Maybe<ImageBitmapFormat> GetImageBitmapFormatFromPlanarYCbCrData(
uintptr_t(aData->mYChannel), uintptr_t(aData->mYChannel),
uintptr_t(aData->mYChannel) + ySize.height * aData->mYStride), uintptr_t(aData->mYChannel) + ySize.height * aData->mYStride),
CbInterval( CbInterval(
uintptr_t(aData->mCbChannel), uintptr_t(aData -> mCbChannel),
uintptr_t(aData->mCbChannel) + cbcrSize.height * aData->mCbCrStride), uintptr_t(aData->mCbChannel) + cbcrSize.height * aData->mCbCrStride),
CrInterval( CrInterval(
uintptr_t(aData->mCrChannel), uintptr_t(aData->mCrChannel),

View File

@@ -677,12 +677,8 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext* host,
LOCAL_GL_FRAGMENT_SHADER, LOCAL_GL_FRAGMENT_SHADER,
}; };
constexpr GLenum PRECISIONS[] = { constexpr GLenum PRECISIONS[] = {
LOCAL_GL_LOW_FLOAT, LOCAL_GL_LOW_FLOAT, LOCAL_GL_MEDIUM_FLOAT, LOCAL_GL_HIGH_FLOAT,
LOCAL_GL_MEDIUM_FLOAT, LOCAL_GL_LOW_INT, LOCAL_GL_MEDIUM_INT, LOCAL_GL_HIGH_INT,
LOCAL_GL_HIGH_FLOAT,
LOCAL_GL_LOW_INT,
LOCAL_GL_MEDIUM_INT,
LOCAL_GL_HIGH_INT,
}; };
for (const auto& shaderType : SHADER_TYPES) { for (const auto& shaderType : SHADER_TYPES) {
for (const auto& precisionType : PRECISIONS) { for (const auto& precisionType : PRECISIONS) {
@@ -701,8 +697,10 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext* host,
} }
if (webgl->mDisableFragHighP) { if (webgl->mDisableFragHighP) {
out->shaderPrecisions->at({LOCAL_GL_FRAGMENT_SHADER, LOCAL_GL_HIGH_FLOAT}) = {}; out->shaderPrecisions->at(
out->shaderPrecisions->at({LOCAL_GL_FRAGMENT_SHADER, LOCAL_GL_HIGH_INT}) = {}; {LOCAL_GL_FRAGMENT_SHADER, LOCAL_GL_HIGH_FLOAT}) = {};
out->shaderPrecisions->at(
{LOCAL_GL_FRAGMENT_SHADER, LOCAL_GL_HIGH_INT}) = {};
} }
// - // -

View File

@@ -806,14 +806,10 @@ struct InitContextResult final {
Limits limits; Limits limits;
EnumMask<layers::SurfaceDescriptor::Type> uploadableSdTypes; EnumMask<layers::SurfaceDescriptor::Type> uploadableSdTypes;
// Padded because of "Android 5.0 ARMv7" builds: // Padded because of "Android 5.0 ARMv7" builds:
Padded< Padded<std::unordered_map<GetShaderPrecisionFormatArgs, ShaderPrecisionFormat,
std::unordered_map< TupleStdHash<GetShaderPrecisionFormatArgs>>,
GetShaderPrecisionFormatArgs, 64>
ShaderPrecisionFormat, shaderPrecisions;
TupleStdHash<GetShaderPrecisionFormatArgs>
>,
64
> shaderPrecisions;
auto MutTiedFields() { auto MutTiedFields() {
return std::tie(error, options, vendor, optionalRenderableFormatBits, return std::tie(error, options, vendor, optionalRenderableFormatBits,
@@ -1412,10 +1408,9 @@ inline std::string ToStringWithCommas(uint64_t v) {
// https://en.cppreference.com/w/cpp/container/array/to_array // https://en.cppreference.com/w/cpp/container/array/to_array
namespace detail { namespace detail {
template<class T, size_t N, size_t... I> template <class T, size_t N, size_t... I>
constexpr std::array<std::remove_cv_t<T>, N> constexpr std::array<std::remove_cv_t<T>, N> to_array_impl(
to_array_impl(T (&a)[N], std::index_sequence<I...>) T (&a)[N], std::index_sequence<I...>) {
{
return {{a[I]...}}; return {{a[I]...}};
} }
@@ -1426,9 +1421,9 @@ constexpr std::array<std::remove_cv_t<T>, N> to_array_impl(
} }
} // namespace detail } // namespace detail
template<class T, size_t N> template <class T, size_t N>
constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) { constexpr std::array<std::remove_cv_t<T>, N> to_array(T (&a)[N]) {
return detail::to_array_impl(a, std::make_index_sequence<N>{}); return detail::to_array_impl(a, std::make_index_sequence<N>{});
} }
template <class T, size_t N> template <class T, size_t N>

View File

@@ -818,7 +818,8 @@ static bool IsUncancelableIfOnlyPassiveListeners(const WidgetEvent* aEvent) {
// There might be non-passive listeners in the remote document // There might be non-passive listeners in the remote document
// So return false if we are in the parent process with remote target // So return false if we are in the parent process with remote target
nsCOMPtr<nsIContent> target = nsIContent::FromEventTargetOrNull(aEvent->mOriginalTarget); nsCOMPtr<nsIContent> target =
nsIContent::FromEventTargetOrNull(aEvent->mOriginalTarget);
return !(XRE_IsParentProcess() && BrowserParent::GetFrom(target)); return !(XRE_IsParentProcess() && BrowserParent::GetFrom(target));
} }

View File

@@ -1852,16 +1852,20 @@ bool EventListenerManager::HasNonPassiveListenersFor(
// After dispatching wheel, legacy mouse scroll events are dispatched // After dispatching wheel, legacy mouse scroll events are dispatched
// and listeners on those can also default prevent the behavior. // and listeners on those can also default prevent the behavior.
if (aEvent->mMessage == eWheel) { if (aEvent->mMessage == eWheel) {
if (const auto& listeners = mListenerMap.GetListenersForType(nsGkAtoms::onDOMMouseScroll)) { if (const auto& listeners =
mListenerMap.GetListenersForType(nsGkAtoms::onDOMMouseScroll)) {
for (const Listener& listener : listeners->NonObservingRange()) { for (const Listener& listener : listeners->NonObservingRange()) {
if (!listener.mFlags.mPassive && ListenerCanHandle(&listener, aEvent)) { if (!listener.mFlags.mPassive &&
ListenerCanHandle(&listener, aEvent)) {
return true; return true;
} }
} }
} }
if (const auto& listeners = mListenerMap.GetListenersForType(nsGkAtoms::onMozMousePixelScroll)) { if (const auto& listeners = mListenerMap.GetListenersForType(
nsGkAtoms::onMozMousePixelScroll)) {
for (const Listener& listener : listeners->NonObservingRange()) { for (const Listener& listener : listeners->NonObservingRange()) {
if (!listener.mFlags.mPassive && ListenerCanHandle(&listener, aEvent)) { if (!listener.mFlags.mPassive &&
ListenerCanHandle(&listener, aEvent)) {
return true; return true;
} }
} }

View File

@@ -4368,20 +4368,22 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// events after they have been processed. When determining if // events after they have been processed. When determining if
// a swipe should occur, we should not prefer the current wheel // a swipe should occur, we should not prefer the current wheel
// transaction. // transaction.
nsIFrame* lastScrollFrame = WheelTransaction::GetScrollTargetFrame(); nsIFrame* lastScrollFrame =
WheelTransaction::GetScrollTargetFrame();
bool wheelTransactionHandlesInput = false; bool wheelTransactionHandlesInput = false;
if (lastScrollFrame) { if (lastScrollFrame) {
ScrollContainerFrame* scrollContainerFrame = lastScrollFrame->GetScrollTargetFrame(); ScrollContainerFrame* scrollContainerFrame =
lastScrollFrame->GetScrollTargetFrame();
if (scrollContainerFrame->IsRootScrollFrameOfDocument()) { if (scrollContainerFrame->IsRootScrollFrameOfDocument()) {
// If the current wheel transaction target is the root scroll // If the current wheel transaction target is the root scroll
// frame and is not scrollable on the x-axis, all delta is // frame and is not scrollable on the x-axis, all delta is
// overflown and swipe-to-nav may occur. // overflown and swipe-to-nav may occur.
wheelTransactionHandlesInput = true; wheelTransactionHandlesInput = true;
allDeltaOverflown = !WheelHandlingUtils::CanScrollOn(scrollContainerFrame, allDeltaOverflown = !WheelHandlingUtils::CanScrollOn(
wheelEvent->mDeltaX, 0.0); scrollContainerFrame, wheelEvent->mDeltaX, 0.0);
} else if(WheelHandlingUtils::CanScrollOn(scrollContainerFrame, } else if (WheelHandlingUtils::CanScrollOn(
wheelEvent->mDeltaX, scrollContainerFrame, wheelEvent->mDeltaX,
wheelEvent->mDeltaY)) { wheelEvent->mDeltaY)) {
// If the current wheel transaction target is not the root // If the current wheel transaction target is not the root
// scroll frame, ensure that swipe to nav does not occur if // scroll frame, ensure that swipe to nav does not occur if
// the scroll frame is scrollable on the x or y axis. If the // the scroll frame is scrollable on the x or y axis. If the

View File

@@ -429,7 +429,7 @@ gboolean LinuxGamepadService::OnGamepadData(GIOChannel* source,
} }
while (true) { while (true) {
struct input_event event {}; struct input_event event{};
gsize count; gsize count;
GError* err = nullptr; GError* err = nullptr;
if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count, if (g_io_channel_read_chars(source, (gchar*)&event, sizeof(event), &count,

View File

@@ -282,7 +282,8 @@ void HTMLDialogElement::Show(ErrorResult& aError) {
} }
bool HTMLDialogElement::Open() const { bool HTMLDialogElement::Open() const {
MOZ_ASSERT(GetBoolAttr(nsGkAtoms::open) == State().HasState(ElementState::OPEN)); MOZ_ASSERT(GetBoolAttr(nsGkAtoms::open) ==
State().HasState(ElementState::OPEN));
return State().HasState(ElementState::OPEN); return State().HasState(ElementState::OPEN);
} }
@@ -369,7 +370,8 @@ void HTMLDialogElement::ShowModal(ErrorResult& aError) {
// 3. If subject's node document is not fully active, then throw an // 3. If subject's node document is not fully active, then throw an
// "InvalidStateError" DOMException. // "InvalidStateError" DOMException.
if (!OwnerDoc()->IsFullyActive()) { if (!OwnerDoc()->IsFullyActive()) {
return aError.ThrowInvalidStateError("The owner document is not fully active"); return aError.ThrowInvalidStateError(
"The owner document is not fully active");
} }
// 4. If subject is not connected, then throw an "InvalidStateError" // 4. If subject is not connected, then throw an "InvalidStateError"

View File

@@ -629,7 +629,7 @@ CSSIntSize HTMLImageElement::NaturalSize() {
return {}; return {};
} }
CSSIntSize size; // defaults to 0,0 CSSIntSize size; // defaults to 0,0
if (!StaticPrefs::image_natural_size_fallback_enabled()) { if (!StaticPrefs::image_natural_size_fallback_enabled()) {
size.width = intrinsicSize.mWidth.valueOr(0); size.width = intrinsicSize.mWidth.valueOr(0);
size.height = intrinsicSize.mHeight.valueOr(0); size.height = intrinsicSize.mHeight.valueOr(0);

View File

@@ -613,8 +613,10 @@ void nsHTMLDocument::NamedGetter(JSContext* aCx, const nsAString& aName,
} }
} }
// To limit the possible performance/memory impact, only collect at most 10 properties. // To limit the possible performance/memory impact, only collect at most 10
if (mShadowedHTMLDocumentProperties.Length() <= 10 && HTMLDocument_Binding::InterfaceHasNonEventHandlerProperty(aName)) { // properties.
if (mShadowedHTMLDocumentProperties.Length() <= 10 &&
HTMLDocument_Binding::InterfaceHasNonEventHandlerProperty(aName)) {
if (!mShadowedHTMLDocumentProperties.Contains(aName)) { if (!mShadowedHTMLDocumentProperties.Contains(aName)) {
mShadowedHTMLDocumentProperties.AppendElement(aName); mShadowedHTMLDocumentProperties.AppendElement(aName);
} }

View File

@@ -297,8 +297,8 @@ template <typename T>
class CheckedUnsafePtr; class CheckedUnsafePtr;
template <typename T> template <typename T>
SafeRefPtr(const CheckedUnsafePtr<T>&, SafeRefPtr(const CheckedUnsafePtr<T>&, const AcquireStrongRefFromRawPtr&)
const AcquireStrongRefFromRawPtr&) -> SafeRefPtr<T>; -> SafeRefPtr<T>;
template <typename T> template <typename T>
SafeRefPtr<T>::SafeRefPtr(T* aRawPtr, detail::InitialConstructionTag) SafeRefPtr<T>::SafeRefPtr(T* aRawPtr, detail::InitialConstructionTag)

View File

@@ -1624,8 +1624,8 @@ void MaybeLogBlockShutdownDiagnostics(ContentParent* aSelf, const char* aMsg,
if (aSelf->IsBlockingShutdown()) { if (aSelf->IsBlockingShutdown()) {
MOZ_LOG( MOZ_LOG(
ContentParent::GetLog(), LogLevel::Info, ContentParent::GetLog(), LogLevel::Info,
("ContentParent: id=%p childID=%" PRIu64 " pid=%d - %s at %s(%d)", aSelf, ("ContentParent: id=%p childID=%" PRIu64 " pid=%d - %s at %s(%d)",
(uint64_t)aSelf->ChildID(), aSelf->Pid(), aMsg, aFile, aLine)); aSelf, (uint64_t)aSelf->ChildID(), aSelf->Pid(), aMsg, aFile, aLine));
} }
#else #else
Unused << aSelf; Unused << aSelf;

View File

@@ -326,7 +326,8 @@ bool MathMLElement::ParseNumericValue(const nsString& aString,
return true; return true;
} else { } else {
uint8_t unitType = SVGLength::GetUnitTypeForString(unit); uint8_t unitType = SVGLength::GetUnitTypeForString(unit);
if (unitType == SVGLength_Binding::SVG_LENGTHTYPE_UNKNOWN) { // unexpected unit if (unitType ==
SVGLength_Binding::SVG_LENGTHTYPE_UNKNOWN) { // unexpected unit
if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) { if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) {
ReportLengthParseError(aString, aDocument); ReportLengthParseError(aString, aDocument);
} }

View File

@@ -14,8 +14,7 @@ namespace mozilla {
BaseMediaMgrError::BaseMediaMgrError(Name aName, const nsACString& aMessage, BaseMediaMgrError::BaseMediaMgrError(Name aName, const nsACString& aMessage,
const nsAString& aConstraint) const nsAString& aConstraint)
: mMessage(aMessage), mConstraint(aConstraint), mName(aName) { : mMessage(aMessage), mConstraint(aConstraint), mName(aName) {
#define MAP_MEDIAERR(name, msg) \ #define MAP_MEDIAERR(name, msg) {Name::name, #name, msg}
{ Name::name, #name, msg }
static struct { static struct {
Name mName; Name mName;

View File

@@ -47,8 +47,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MediaStreamTrackSource)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
auto MediaStreamTrackSource::ApplyConstraints( auto MediaStreamTrackSource::ApplyConstraints(
const dom::MediaTrackConstraints& aConstraints, const dom::MediaTrackConstraints& aConstraints, CallerType aCallerType)
CallerType aCallerType) -> RefPtr<ApplyConstraintsPromise> { -> RefPtr<ApplyConstraintsPromise> {
return ApplyConstraintsPromise::CreateAndReject( return ApplyConstraintsPromise::CreateAndReject(
MakeRefPtr<MediaMgrError>(MediaMgrError::Name::OverconstrainedError, ""), MakeRefPtr<MediaMgrError>(MediaMgrError::Name::OverconstrainedError, ""),
__func__); __func__);

View File

@@ -328,7 +328,8 @@ static bool IsMFCDMAllowedByOrigin(const Maybe<nsCString>& aOrigin) {
for (const auto& entry : sOriginStatusEntries) { for (const auto& entry : sOriginStatusEntries) {
// Check if the given origin matches the entry, or if it's a suborigin. // Check if the given origin matches the entry, or if it's a suborigin.
if (FindInReadable(entry.origin(), *aOrigin)) { if (FindInReadable(entry.origin(), *aOrigin)) {
isAllowed = entry.status() == isAllowed =
entry.status() ==
nsIWindowsMediaFoundationCDMOriginsListService::ORIGIN_ALLOWED; nsIWindowsMediaFoundationCDMOriginsListService::ORIGIN_ALLOWED;
isFound = true; isFound = true;
break; break;
@@ -337,7 +338,8 @@ static bool IsMFCDMAllowedByOrigin(const Maybe<nsCString>& aOrigin) {
EME_LOG( EME_LOG(
"MediaKeySystemAccess::IsMFCDMAllowedByOrigin, origin (%s) " "MediaKeySystemAccess::IsMFCDMAllowedByOrigin, origin (%s) "
"is %s to use MFCDM %s(Remote)", "is %s to use MFCDM %s(Remote)",
aOrigin->get(), isAllowed ? "ALLOWED" : "BLOCKED", isFound ? "" : "by default "); aOrigin->get(), isAllowed ? "ALLOWED" : "BLOCKED",
isFound ? "" : "by default ");
return isAllowed; return isAllowed;
} }
#endif #endif

View File

@@ -76,16 +76,24 @@ static void TestAudioCompactor(size_t aBytes) {
} }
TEST(Media, AudioCompactor_4000) TEST(Media, AudioCompactor_4000)
{ TestAudioCompactor(4000); } {
TestAudioCompactor(4000);
}
TEST(Media, AudioCompactor_4096) TEST(Media, AudioCompactor_4096)
{ TestAudioCompactor(4096); } {
TestAudioCompactor(4096);
}
TEST(Media, AudioCompactor_5000) TEST(Media, AudioCompactor_5000)
{ TestAudioCompactor(5000); } {
TestAudioCompactor(5000);
}
TEST(Media, AudioCompactor_5256) TEST(Media, AudioCompactor_5256)
{ TestAudioCompactor(5256); } {
TestAudioCompactor(5256);
}
TEST(Media, AudioCompactor_NativeCopy) TEST(Media, AudioCompactor_NativeCopy)
{ {

View File

@@ -276,8 +276,11 @@ void MFMediaEngineParent::NotifyError(MF_MEDIA_ENGINE_ERR aError,
// A special error requires to reset the hareware context, not a real error. // A special error requires to reset the hareware context, not a real error.
if (aResult == DRM_E_TEE_INVALID_HWDRM_STATE) { if (aResult == DRM_E_TEE_INVALID_HWDRM_STATE) {
LOG("Notify error 'DRM_E_TEE_INVALID_HWDRM_STATE', hr=%lx", aResult); LOG("Notify error 'DRM_E_TEE_INVALID_HWDRM_STATE', hr=%lx", aResult);
ENGINE_MARKER("MFMediaEngineParent,Received 'DRM_E_TEE_INVALID_HWDRM_STATE'"); ENGINE_MARKER(
auto* proxy = mContentProtectionManager ? mContentProtectionManager->GetCDMProxy() : nullptr; "MFMediaEngineParent,Received 'DRM_E_TEE_INVALID_HWDRM_STATE'");
auto* proxy = mContentProtectionManager
? mContentProtectionManager->GetCDMProxy()
: nullptr;
if (proxy) { if (proxy) {
proxy->OnHardwareContextReset(); proxy->OnHardwareContextReset();
} }

View File

@@ -99,10 +99,10 @@ using MFMediaEngineError = MF_MEDIA_ENGINE_ERR;
text) text)
#ifdef MOZ_WMF_CDM #ifdef MOZ_WMF_CDM
// This eror can happen during OS sleep/resume, or moving video to different // This eror can happen during OS sleep/resume, or moving video to different
// graphics adapters. // graphics adapters.
inline constexpr HRESULT DRM_E_TEE_INVALID_HWDRM_STATE = inline constexpr HRESULT DRM_E_TEE_INVALID_HWDRM_STATE =
static_cast<HRESULT>(0x8004CD12); static_cast<HRESULT>(0x8004CD12);
#endif #endif
const char* MediaEventTypeToStr(MediaEventType aType); const char* MediaEventTypeToStr(MediaEventType aType);

View File

@@ -192,8 +192,8 @@ RefPtr<GenericNonExclusivePromise> RDDProcessManager::LaunchRDDProcess() {
} }
auto RDDProcessManager::EnsureRDDProcessAndCreateBridge( auto RDDProcessManager::EnsureRDDProcessAndCreateBridge(
ipc::EndpointProcInfo aOtherProcess, ipc::EndpointProcInfo aOtherProcess, dom::ContentParentId aParentId)
dom::ContentParentId aParentId) -> RefPtr<EnsureRDDPromise> { -> RefPtr<EnsureRDDPromise> {
return InvokeAsync( return InvokeAsync(
GetMainThreadSerialEventTarget(), __func__, GetMainThreadSerialEventTarget(), __func__,
[aOtherProcess, aParentId, this]() -> RefPtr<EnsureRDDPromise> { [aOtherProcess, aParentId, this]() -> RefPtr<EnsureRDDPromise> {

View File

@@ -316,8 +316,7 @@ Result<H265SPS, nsresult> H265::DecodeSPSFromSPSNALU(const H265NALU& aSPSNALU) {
return Err(NS_ERROR_FAILURE); return Err(NS_ERROR_FAILURE);
} }
IN_RANGE_OR_RETURN(width.value(), 0, sps.pic_width_in_luma_samples); IN_RANGE_OR_RETURN(width.value(), 0, sps.pic_width_in_luma_samples);
CheckedUint32 height = CheckedUint32 height = sps.pic_height_in_luma_samples;
sps.pic_height_in_luma_samples;
height -= height -=
sps.subHeightC * (sps.conf_win_bottom_offset - sps.conf_win_top_offset); sps.subHeightC * (sps.conf_win_bottom_offset - sps.conf_win_top_offset);
if (!height.isValid()) { if (!height.isValid()) {

View File

@@ -12,4 +12,6 @@
using namespace mozilla; using namespace mozilla;
TEST(CanCreateMFTDecoder, NoIPC) TEST(CanCreateMFTDecoder, NoIPC)
{ EXPECT_TRUE(WMFDecoderModule::CanCreateMFTDecoder(WMFStreamType::H264)); } {
EXPECT_TRUE(WMFDecoderModule::CanCreateMFTDecoder(WMFStreamType::H264));
}

View File

@@ -45,7 +45,8 @@ inline bool FuzzyEqual(double v1, double v2) { return fabs(v1 - v2) < 1e-7; }
*/ */
inline float ConvertLinearToDecibels(float aLinearValue, float aMinDecibels) { inline float ConvertLinearToDecibels(float aLinearValue, float aMinDecibels) {
MOZ_ASSERT(aLinearValue >= 0); MOZ_ASSERT(aLinearValue >= 0);
return aLinearValue > 0.0f ? 20.0f * fdlibm_log10f(aLinearValue) : aMinDecibels; return aLinearValue > 0.0f ? 20.0f * fdlibm_log10f(aLinearValue)
: aMinDecibels;
} }
/** /**

View File

@@ -26,7 +26,7 @@ class NormalizedConstraintSet {
protected: protected:
class BaseRange { class BaseRange {
protected: protected:
typedef BaseRange NormalizedConstraintSet::*MemberPtrType; typedef BaseRange NormalizedConstraintSet::* MemberPtrType;
BaseRange(MemberPtrType aMemberPtr, const char* aName, BaseRange(MemberPtrType aMemberPtr, const char* aName,
nsTArray<MemberPtrType>* aList) nsTArray<MemberPtrType>* aList)
@@ -44,7 +44,7 @@ class NormalizedConstraintSet {
const char* mName; const char* mName;
}; };
typedef BaseRange NormalizedConstraintSet::*MemberPtrType; typedef BaseRange NormalizedConstraintSet::* MemberPtrType;
public: public:
template <class ValueType> template <class ValueType>
@@ -133,7 +133,7 @@ class NormalizedConstraintSet {
}; };
struct LongRange : public Range<int32_t> { struct LongRange : public Range<int32_t> {
typedef LongRange NormalizedConstraintSet::*LongPtrType; typedef LongRange NormalizedConstraintSet::* LongPtrType;
LongRange(LongPtrType aMemberPtr, const char* aName, LongRange(LongPtrType aMemberPtr, const char* aName,
const dom::Optional<dom::OwningLongOrConstrainLongRange>& aOther, const dom::Optional<dom::OwningLongOrConstrainLongRange>& aOther,
@@ -141,14 +141,14 @@ class NormalizedConstraintSet {
}; };
struct LongLongRange : public Range<int64_t> { struct LongLongRange : public Range<int64_t> {
typedef LongLongRange NormalizedConstraintSet::*LongLongPtrType; typedef LongLongRange NormalizedConstraintSet::* LongLongPtrType;
LongLongRange(LongLongPtrType aMemberPtr, const char* aName, LongLongRange(LongLongPtrType aMemberPtr, const char* aName,
const long long& aOther, nsTArray<MemberPtrType>* aList); const long long& aOther, nsTArray<MemberPtrType>* aList);
}; };
struct DoubleRange : public Range<double> { struct DoubleRange : public Range<double> {
typedef DoubleRange NormalizedConstraintSet::*DoublePtrType; typedef DoubleRange NormalizedConstraintSet::* DoublePtrType;
DoubleRange( DoubleRange(
DoublePtrType aMemberPtr, const char* aName, DoublePtrType aMemberPtr, const char* aName,
@@ -157,7 +157,7 @@ class NormalizedConstraintSet {
}; };
struct BooleanRange : public Range<bool> { struct BooleanRange : public Range<bool> {
typedef BooleanRange NormalizedConstraintSet::*BooleanPtrType; typedef BooleanRange NormalizedConstraintSet::* BooleanPtrType;
BooleanRange( BooleanRange(
BooleanPtrType aMemberPtr, const char* aName, BooleanPtrType aMemberPtr, const char* aName,
@@ -176,7 +176,7 @@ class NormalizedConstraintSet {
typedef std::set<nsString> ValueType; typedef std::set<nsString> ValueType;
ValueType mExact, mIdeal; ValueType mExact, mIdeal;
typedef StringRange NormalizedConstraintSet::*StringPtrType; typedef StringRange NormalizedConstraintSet::* StringPtrType;
StringRange( StringRange(
StringPtrType aMemberPtr, const char* aName, StringPtrType aMemberPtr, const char* aName,

View File

@@ -51,8 +51,8 @@ void RemoteTrackSource::Destroy() {
} }
auto RemoteTrackSource::ApplyConstraints( auto RemoteTrackSource::ApplyConstraints(
const dom::MediaTrackConstraints& aConstraints, const dom::MediaTrackConstraints& aConstraints, dom::CallerType aCallerType)
dom::CallerType aCallerType) -> RefPtr<ApplyConstraintsPromise> { -> RefPtr<ApplyConstraintsPromise> {
return ApplyConstraintsPromise::CreateAndReject( return ApplyConstraintsPromise::CreateAndReject(
MakeRefPtr<MediaMgrError>( MakeRefPtr<MediaMgrError>(
dom::MediaStreamError::Name::OverconstrainedError, ""), dom::MediaStreamError::Name::OverconstrainedError, ""),

View File

@@ -162,8 +162,9 @@ auto WebrtcGlobalStatsHistory::Entry::Prune(const DOMHighResTimeStamp aBefore)
// Note: we always keep the most recent SDP // Note: we always keep the most recent SDP
} }
auto WebrtcGlobalStatsHistory::InitHistory( auto WebrtcGlobalStatsHistory::InitHistory(const nsAString& aPcId,
const nsAString& aPcId, const bool aIsLongTermStatsDisabled) -> void { const bool aIsLongTermStatsDisabled)
-> void {
MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(XRE_IsParentProcess());
if (WebrtcGlobalStatsHistory::Get().MaybeGet(aPcId)) { if (WebrtcGlobalStatsHistory::Get().MaybeGet(aPcId)) {
return; return;

View File

@@ -57,4 +57,4 @@ webrtc::NtpTime CreateNtp(webrtc::Timestamp aTime) {
namespace webrtc { namespace webrtc {
int64_t SystemTimeNanos() { return mozilla::WebrtcSystemTime().us() * 1000; } int64_t SystemTimeNanos() { return mozilla::WebrtcSystemTime().us() * 1000; }
} // namespace rtc } // namespace webrtc

View File

@@ -28,7 +28,9 @@ class TestSimpleTokenBucket : public SimpleTokenBucket {
}; };
TEST(SimpleTokenBucketTest, TestConstruct) TEST(SimpleTokenBucketTest, TestConstruct)
{ TestSimpleTokenBucket b(10, 1); } {
TestSimpleTokenBucket b(10, 1);
}
TEST(SimpleTokenBucketTest, TestGet) TEST(SimpleTokenBucketTest, TestGet)
{ {

View File

@@ -11,12 +11,8 @@
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#define TCPSERVERSOCKETCHILD_CID \ #define TCPSERVERSOCKETCHILD_CID \
{ \ {0x41a77ec8, 0xfd86, 0x409e, {0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e}}
0x41a77ec8, 0xfd86, 0x409e, { \
0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e \
} \
}
class nsITCPServerSocketInternal; class nsITCPServerSocketInternal;

View File

@@ -13,12 +13,8 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "js/TypeDecls.h" #include "js/TypeDecls.h"
#define TCPSOCKETPARENT_CID \ #define TCPSOCKETPARENT_CID \
{ \ {0x4e7246c6, 0xa8b3, 0x426d, {0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a}}
0x4e7246c6, 0xa8b3, 0x426d, { \
0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a \
} \
}
namespace mozilla::dom { namespace mozilla::dom {

View File

@@ -11,12 +11,8 @@
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#define UDPSOCKETCHILD_CID \ #define UDPSOCKETCHILD_CID \
{ \ {0xb47e5a0f, 0xd384, 0x48ef, {0x88, 0x85, 0x42, 0x59, 0x79, 0x3d, 0x9c, 0xf0}}
0xb47e5a0f, 0xd384, 0x48ef, { \
0x88, 0x85, 0x42, 0x59, 0x79, 0x3d, 0x9c, 0xf0 \
} \
}
class nsIInputStream; class nsIInputStream;
class nsIPrincipal; class nsIPrincipal;

View File

@@ -614,7 +614,8 @@ nsresult Notification::ResolveIconURL(nsIGlobalObject* aGlobal,
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsAutoCString src; nsAutoCString src;
srcUri->GetSpec(src); srcUri->GetSpec(src);
// XXX(krosylight): We should be able to pass UTF8 as-is, or ideally the URI object itself. // XXX(krosylight): We should be able to pass UTF8 as-is, or ideally the URI
// object itself.
CopyUTF8toUTF16(src, aDecodedUrl); CopyUTF8toUTF16(src, aDecodedUrl);
} }

View File

@@ -194,7 +194,9 @@ class Notification : public DOMEventTargetHelper, public SupportsWeakPtr {
bool CreateActor(); bool CreateActor();
bool SendShow(Promise* aPromise); bool SendShow(Promise* aPromise);
static nsresult ResolveIconURL(nsIGlobalObject* aGlobal, const nsAString& aIconURL, nsString& aResolvedURL); static nsresult ResolveIconURL(nsIGlobalObject* aGlobal,
const nsAString& aIconURL,
nsString& aResolvedURL);
}; };
} // namespace mozilla::dom } // namespace mozilla::dom

View File

@@ -21,13 +21,11 @@ using std::begin;
using std::end; using std::end;
template <typename T, typename NestedRange> template <typename T, typename NestedRange>
auto Flatten(NestedRange&& aRange) auto Flatten(NestedRange&& aRange) -> std::enable_if_t<
-> std::enable_if_t< std::is_same_v<T, std::decay_t<typename decltype(begin(
std::is_same_v<T, std::declval<const NestedRange&>()))::value_type>>,
std::decay_t<typename decltype(begin( std::conditional_t<std::is_rvalue_reference_v<NestedRange>,
std::declval<const NestedRange&>()))::value_type>>, std::decay_t<NestedRange>, NestedRange>> {
std::conditional_t<std::is_rvalue_reference_v<NestedRange>,
std::decay_t<NestedRange>, NestedRange>> {
return std::forward<NestedRange>(aRange); return std::forward<NestedRange>(aRange);
} }
@@ -100,12 +98,11 @@ struct FlatRange {
}; };
template <typename T, typename NestedRange> template <typename T, typename NestedRange>
auto Flatten(NestedRange&& aRange) auto Flatten(NestedRange&& aRange) -> std::enable_if_t<
-> std::enable_if_t< !std::is_same_v<
!std::is_same_v<T, std::decay_t<typename decltype(begin( T, std::decay_t<typename decltype(begin(
std::declval<const std::decay_t< std::declval<const std::decay_t<NestedRange>&>()))::value_type>>,
NestedRange>&>()))::value_type>>, FlatRange<T, NestedRange>> {
FlatRange<T, NestedRange>> {
return FlatRange<T, NestedRange>{std::forward<NestedRange>(aRange)}; return FlatRange<T, NestedRange>{std::forward<NestedRange>(aRange)};
} }

View File

@@ -29,10 +29,8 @@ struct IsExclusiveMozPromise<
} // namespace detail } // namespace detail
template <typename T, typename U, typename F> template <typename T, typename U, typename F>
auto Map(RefPtr<U> aPromise, F&& aFunc) auto Map(RefPtr<U> aPromise, F&& aFunc) -> std::enable_if_t<
-> std::enable_if_t< detail::IsExclusiveMozPromise<RemoveSmartPointer<U>>::value, RefPtr<T>> {
detail::IsExclusiveMozPromise<RemoveSmartPointer<U>>::value,
RefPtr<T>> {
return aPromise->Then( return aPromise->Then(
GetCurrentSerialEventTarget(), __func__, GetCurrentSerialEventTarget(), __func__,
[func = [func =
@@ -48,10 +46,8 @@ auto Map(RefPtr<U> aPromise, F&& aFunc)
} }
template <typename T, typename U, typename F> template <typename T, typename U, typename F>
auto Map(RefPtr<U> aPromise, F&& aFunc) auto Map(RefPtr<U> aPromise, F&& aFunc) -> std::enable_if_t<
-> std::enable_if_t< !detail::IsExclusiveMozPromise<RemoveSmartPointer<U>>::value, RefPtr<T>> {
!detail::IsExclusiveMozPromise<RemoveSmartPointer<U>>::value,
RefPtr<T>> {
return aPromise->Then(GetCurrentSerialEventTarget(), __func__, return aPromise->Then(GetCurrentSerialEventTarget(), __func__,
[func = std::forward<F>(aFunc)]( [func = std::forward<F>(aFunc)](
const typename U::ResolveOrRejectValue& aValue) { const typename U::ResolveOrRejectValue& aValue) {

View File

@@ -1050,7 +1050,8 @@ auto OrElseIf(Result<V, E>&& aResult, P&& aPred, F&& aFunc) -> Result<V, E> {
return Err(NS_FAILED(_status) ? (_status) : (_rv)) return Err(NS_FAILED(_status) ? (_status) : (_rv))
#else #else
# define RECORD_IN_NIGHTLY(_dummy, _status) \ # define RECORD_IN_NIGHTLY(_dummy, _status) \
{} { \
}
# define OK_IN_NIGHTLY_PROPAGATE_IN_OTHERS QM_PROPAGATE # define OK_IN_NIGHTLY_PROPAGATE_IN_OTHERS QM_PROPAGATE
@@ -1142,8 +1143,8 @@ auto ErrToDefaultOk(const nsresult aValue) -> Result<V, nsresult> {
} }
template <typename MozPromiseType, typename RejectValueT = nsresult> template <typename MozPromiseType, typename RejectValueT = nsresult>
auto CreateAndRejectMozPromise(StaticString aFunc, auto CreateAndRejectMozPromise(StaticString aFunc, const RejectValueT& aRv)
const RejectValueT& aRv) -> decltype(auto) { -> decltype(auto) {
if constexpr (std::is_same_v<RejectValueT, nsresult>) { if constexpr (std::is_same_v<RejectValueT, nsresult>) {
return MozPromiseType::CreateAndReject(aRv, aFunc); return MozPromiseType::CreateAndReject(aRv, aFunc);
} else if constexpr (std::is_same_v<RejectValueT, QMResult>) { } else if constexpr (std::is_same_v<RejectValueT, QMResult>) {
@@ -1235,8 +1236,8 @@ auto Reduce(Range&& aRange, T aInit, const BinaryOp& aBinaryOp) {
} }
template <typename Range, typename Body> template <typename Range, typename Body>
auto CollectEachInRange(Range&& aRange, auto CollectEachInRange(Range&& aRange, const Body& aBody)
const Body& aBody) -> Result<mozilla::Ok, nsresult> { -> Result<mozilla::Ok, nsresult> {
for (auto&& element : aRange) { for (auto&& element : aRange) {
MOZ_TRY(aBody(element)); MOZ_TRY(aBody(element));
} }

View File

@@ -1088,7 +1088,7 @@ TEST(QuotaCommon_TryUnwrap, NonConstDecl)
TEST(QuotaCommon_TryUnwrap, RvalueDecl) TEST(QuotaCommon_TryUnwrap, RvalueDecl)
{ {
QM_TRY_UNWRAP(int32_t && x, (Result<int32_t, nsresult>{42}), QM_VOID); QM_TRY_UNWRAP(int32_t&& x, (Result<int32_t, nsresult>{42}), QM_VOID);
static_assert(std::is_same_v<decltype(x), int32_t&&>); static_assert(std::is_same_v<decltype(x), int32_t&&>);
@@ -1836,10 +1836,14 @@ TEST(QuotaCommon_ErrToDefaultOkOrErr, NsCOMPtr_Err)
} }
TEST(QuotaCommon_IsSpecificError, Match) TEST(QuotaCommon_IsSpecificError, Match)
{ EXPECT_TRUE(IsSpecificError<NS_ERROR_FAILURE>(NS_ERROR_FAILURE)); } {
EXPECT_TRUE(IsSpecificError<NS_ERROR_FAILURE>(NS_ERROR_FAILURE));
}
TEST(QuotaCommon_IsSpecificError, Mismatch) TEST(QuotaCommon_IsSpecificError, Mismatch)
{ EXPECT_FALSE(IsSpecificError<NS_ERROR_FAILURE>(NS_ERROR_UNEXPECTED)); } {
EXPECT_FALSE(IsSpecificError<NS_ERROR_FAILURE>(NS_ERROR_UNEXPECTED));
}
TEST(QuotaCommon_ErrToOk, Bool_True) TEST(QuotaCommon_ErrToOk, Bool_True)
{ {

View File

@@ -64,8 +64,7 @@ CSPViolationData::CSPViolationData(uint32_t aViolatedPolicyIndex,
BlockedContentSource::TrustedTypesPolicy) BlockedContentSource::TrustedTypesPolicy)
? nsString(aSample) ? nsString(aSample)
: MaybeTruncateSampleWithEllipsis(aSample)}, : MaybeTruncateSampleWithEllipsis(aSample)},
mHashSHA256{aHashSHA256} mHashSHA256{aHashSHA256} {}
{}
// Required for `mElement`, since its destructor requires a definition of // Required for `mElement`, since its destructor requires a definition of
// `Element`. // `Element`.

View File

@@ -47,7 +47,8 @@ struct CSPViolationData {
const CSPDirective aEffectiveDirective, const CSPDirective aEffectiveDirective,
const nsACString& aSourceFile, uint32_t aLineNumber, const nsACString& aSourceFile, uint32_t aLineNumber,
uint32_t aColumnNumber, Element* aElement, uint32_t aColumnNumber, Element* aElement,
const nsAString& aSample, const nsACString& aHashSHA256 = ""_ns); const nsAString& aSample,
const nsACString& aHashSHA256 = ""_ns);
~CSPViolationData(); ~CSPViolationData();

View File

@@ -16,12 +16,8 @@
#define REFERRERINFO_CONTRACTID "@mozilla.org/referrer-info;1" #define REFERRERINFO_CONTRACTID "@mozilla.org/referrer-info;1"
// 041a129f-10ce-4bda-a60d-e027a26d5ed0 // 041a129f-10ce-4bda-a60d-e027a26d5ed0
#define REFERRERINFO_CID \ #define REFERRERINFO_CID \
{ \ {0x041a129f, 0x10ce, 0x4bda, {0xa6, 0x0d, 0xe0, 0x27, 0xa2, 0x6d, 0x5e, 0xd0}}
0x041a129f, 0x10ce, 0x4bda, { \
0xa6, 0x0d, 0xe0, 0x27, 0xa2, 0x6d, 0x5e, 0xd0 \
} \
}
class nsIHttpChannel; class nsIHttpChannel;
class nsIURI; class nsIURI;

View File

@@ -597,11 +597,12 @@ void nsCSPContext::ReportInlineViolation(
nsAutoCString hashSHA256; nsAutoCString hashSHA256;
// We optionally include the hash to create more helpful error messages. // We optionally include the hash to create more helpful error messages.
nsCOMPtr<nsICryptoHash> hasher; nsCOMPtr<nsICryptoHash> hasher;
if (NS_SUCCEEDED(NS_NewCryptoHash(nsICryptoHash::SHA256, getter_AddRefs(hasher)))) { if (NS_SUCCEEDED(
NS_NewCryptoHash(nsICryptoHash::SHA256, getter_AddRefs(hasher)))) {
NS_ConvertUTF16toUTF8 source(aSourceCode); NS_ConvertUTF16toUTF8 source(aSourceCode);
if (NS_SUCCEEDED(hasher->Update( if (NS_SUCCEEDED(hasher->Update(
reinterpret_cast<const uint8_t*>(source.get()), source.Length()))) { reinterpret_cast<const uint8_t*>(source.get()), source.Length()))) {
(void) hasher->Finish(true, hashSHA256); (void)hasher->Finish(true, hashSHA256);
} }
} }
@@ -1693,8 +1694,9 @@ class CSPReportSenderRunnable final : public Runnable {
: "CSPInlineScriptViolation2"; : "CSPInlineScriptViolation2";
} }
AutoTArray<nsString, 3> params = {mViolatedDirectiveNameAndValue, AutoTArray<nsString, 3> params = {
effectiveDirective, NS_ConvertUTF8toUTF16(mCSPViolationData.mHashSHA256)}; mViolatedDirectiveNameAndValue, effectiveDirective,
NS_ConvertUTF8toUTF16(mCSPViolationData.mHashSHA256)};
mCSPContext->logToConsole( mCSPContext->logToConsole(
errorName, params, mCSPViolationData.mSourceFile, errorName, params, mCSPViolationData.mSourceFile,
mCSPViolationData.mSample, mCSPViolationData.mLineNumber, mCSPViolationData.mSample, mCSPViolationData.mLineNumber,

View File

@@ -13,12 +13,8 @@
#include "nsIChannelEventSink.h" #include "nsIChannelEventSink.h"
#define CSPSERVICE_CONTRACTID "@mozilla.org/cspservice;1" #define CSPSERVICE_CONTRACTID "@mozilla.org/cspservice;1"
#define CSPSERVICE_CID \ #define CSPSERVICE_CID \
{ \ {0x8d2f40b2, 0x4875, 0x4c95, {0x97, 0xd9, 0x3f, 0x7d, 0xca, 0x2c, 0xb4, 0x60}}
0x8d2f40b2, 0x4875, 0x4c95, { \
0x97, 0xd9, 0x3f, 0x7d, 0xca, 0x2c, 0xb4, 0x60 \
} \
}
class CSPService : public nsIContentPolicy, public nsIChannelEventSink { class CSPService : public nsIContentPolicy, public nsIChannelEventSink {
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS

View File

@@ -415,16 +415,16 @@ CSPDirective CSP_ContentTypeToDirective(nsContentPolicyType aType) {
return nsIContentSecurityPolicy::DEFAULT_SRC_DIRECTIVE; return nsIContentSecurityPolicy::DEFAULT_SRC_DIRECTIVE;
} }
already_AddRefed<nsIContentSecurityPolicy> CSP_CreateFromHeader(const nsAString& aHeaderValue, nsIURI* aSelfURI, already_AddRefed<nsIContentSecurityPolicy> CSP_CreateFromHeader(
nsIPrincipal* aLoadingPrincipal, const nsAString& aHeaderValue, nsIURI* aSelfURI,
ErrorResult& aRv) { nsIPrincipal* aLoadingPrincipal, ErrorResult& aRv) {
RefPtr<nsCSPContext> csp = new nsCSPContext(); RefPtr<nsCSPContext> csp = new nsCSPContext();
// Hard code some default values until we have a use case where we can provide // Hard code some default values until we have a use case where we can provide
// something else. // something else.
// When inheriting from this CSP, these values will be overwritten anyway. // When inheriting from this CSP, these values will be overwritten anyway.
aRv = csp->SetRequestContextWithPrincipal(aLoadingPrincipal, aSelfURI, aRv = csp->SetRequestContextWithPrincipal(aLoadingPrincipal, aSelfURI,
/* aReferrer */ ""_ns, /* aReferrer */ ""_ns,
/* aInnerWindowId */ 0); /* aInnerWindowId */ 0);
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }

View File

@@ -194,9 +194,9 @@ nsresult CSP_AppendCSPFromHeader(nsIContentSecurityPolicy* aCsp,
/* =============== Helpers ================== */ /* =============== Helpers ================== */
already_AddRefed<nsIContentSecurityPolicy> CSP_CreateFromHeader(const nsAString& aHeaderValue, nsIURI* aSelfURI, already_AddRefed<nsIContentSecurityPolicy> CSP_CreateFromHeader(
nsIPrincipal* aLoadingPrincipal, const nsAString& aHeaderValue, nsIURI* aSelfURI,
mozilla::ErrorResult& aRv); nsIPrincipal* aLoadingPrincipal, mozilla::ErrorResult& aRv);
class nsCSPHostSrc; class nsCSPHostSrc;

View File

@@ -19,12 +19,8 @@ class nsIStreamListener;
#define NS_CONTENTSECURITYMANAGER_CONTRACTID \ #define NS_CONTENTSECURITYMANAGER_CONTRACTID \
"@mozilla.org/contentsecuritymanager;1" "@mozilla.org/contentsecuritymanager;1"
// cdcc1ab8-3cea-4e6c-a294-a651fa35227f // cdcc1ab8-3cea-4e6c-a294-a651fa35227f
#define NS_CONTENTSECURITYMANAGER_CID \ #define NS_CONTENTSECURITYMANAGER_CID \
{ \ {0xcdcc1ab8, 0x3cea, 0x4e6c, {0xa2, 0x94, 0xa6, 0x51, 0xfa, 0x35, 0x22, 0x7f}}
0xcdcc1ab8, 0x3cea, 0x4e6c, { \
0xa2, 0x94, 0xa6, 0x51, 0xfa, 0x35, 0x22, 0x7f \
} \
}
class nsContentSecurityManager : public nsIContentSecurityManager, class nsContentSecurityManager : public nsIContentSecurityManager,
public nsIChannelEventSink { public nsIChannelEventSink {

View File

@@ -9,12 +9,8 @@
#define NS_MIXEDCONTENTBLOCKER_CONTRACTID "@mozilla.org/mixedcontentblocker;1" #define NS_MIXEDCONTENTBLOCKER_CONTRACTID "@mozilla.org/mixedcontentblocker;1"
/* daf1461b-bf29-4f88-8d0e-4bcdf332c862 */ /* daf1461b-bf29-4f88-8d0e-4bcdf332c862 */
#define NS_MIXEDCONTENTBLOCKER_CID \ #define NS_MIXEDCONTENTBLOCKER_CID \
{ \ {0xdaf1461b, 0xbf29, 0x4f88, {0x8d, 0x0e, 0x4b, 0xcd, 0xf3, 0x32, 0xc8, 0x62}}
0xdaf1461b, 0xbf29, 0x4f88, { \
0x8d, 0x0e, 0x4b, 0xcd, 0xf3, 0x32, 0xc8, 0x62 \
} \
}
// This enum defines type of content that is detected when an // This enum defines type of content that is detected when an
// nsMixedContentEvent fires // nsMixedContentEvent fires

View File

@@ -775,8 +775,10 @@ void Sanitizer::SanitizeChildren(nsINode* aNode, bool aSafe) {
child = next) { child = next) {
next = child->GetNextSibling(); next = child->GetNextSibling();
// Step 1.1. Assert: child implements Text, Comment, Element, or DocumentType. // Step 1.1. Assert: child implements Text, Comment, Element, or
MOZ_ASSERT(child->IsText() || child->IsComment() || child->IsElement() || child->NodeType() == nsINode::DOCUMENT_TYPE_NODE); // DocumentType.
MOZ_ASSERT(child->IsText() || child->IsComment() || child->IsElement() ||
child->NodeType() == nsINode::DOCUMENT_TYPE_NODE);
// Step 1.2. If child implements DocumentType, then continue. // Step 1.2. If child implements DocumentType, then continue.
if (child->NodeType() == nsINode::DOCUMENT_TYPE_NODE) { if (child->NodeType() == nsINode::DOCUMENT_TYPE_NODE) {

View File

@@ -137,8 +137,8 @@ class ViewTransition final : public nsISupports, public nsWrapperCache {
void ClearActiveTransition(bool aIsDocumentHidden); void ClearActiveTransition(bool aIsDocumentHidden);
void Timeout(); void Timeout();
MOZ_CAN_RUN_SCRIPT void Setup(); MOZ_CAN_RUN_SCRIPT void Setup();
[[nodiscard]] MOZ_CAN_RUN_SCRIPT [[nodiscard]] MOZ_CAN_RUN_SCRIPT Maybe<SkipTransitionReason>
Maybe<SkipTransitionReason> CaptureOldState(); CaptureOldState();
[[nodiscard]] Maybe<SkipTransitionReason> CaptureNewState(); [[nodiscard]] Maybe<SkipTransitionReason> CaptureNewState();
void SetupTransitionPseudoElements(); void SetupTransitionPseudoElements();
[[nodiscard]] bool UpdatePseudoElementStyles(bool aNeedsInvalidation); [[nodiscard]] bool UpdatePseudoElementStyles(bool aNeedsInvalidation);

View File

@@ -203,7 +203,8 @@ struct FeatureImplementationStatus {
return implemented(WGPUWEBGPU_FEATURE_TEXTURE_COMPRESSION_ASTC); return implemented(WGPUWEBGPU_FEATURE_TEXTURE_COMPRESSION_ASTC);
case dom::GPUFeatureName::Texture_compression_astc_sliced_3d: case dom::GPUFeatureName::Texture_compression_astc_sliced_3d:
return implemented(WGPUWEBGPU_FEATURE_TEXTURE_COMPRESSION_ASTC_SLICED_3D); return implemented(
WGPUWEBGPU_FEATURE_TEXTURE_COMPRESSION_ASTC_SLICED_3D);
case dom::GPUFeatureName::Timestamp_query: case dom::GPUFeatureName::Timestamp_query:
return implemented(WGPUWEBGPU_FEATURE_TIMESTAMP_QUERY); return implemented(WGPUWEBGPU_FEATURE_TIMESTAMP_QUERY);

View File

@@ -31,10 +31,14 @@
/** Magic constants that should match the entries in constants.ts's kBit.f64 */ /** Magic constants that should match the entries in constants.ts's kBit.f64 */
constexpr double kF64NegativeMin = std::bit_cast<double>(0xFFEFFFFFFFFFFFFFull); constexpr double kF64NegativeMin = std::bit_cast<double>(0xFFEFFFFFFFFFFFFFull);
constexpr double kF64NegativeMax = std::bit_cast<double>(0x8010000000000000ull); constexpr double kF64NegativeMax = std::bit_cast<double>(0x8010000000000000ull);
constexpr double kF64NegativeSubnormalMin = std::bit_cast<double>(0x800FFFFFFFFFFFFFull); constexpr double kF64NegativeSubnormalMin =
constexpr double kF64NegativeSubnormalMax = std::bit_cast<double>(0x8000000000000001ull); std::bit_cast<double>(0x800FFFFFFFFFFFFFull);
constexpr double kF64PositiveSubnormalMin = std::bit_cast<double>(0x0000000000000001ull); constexpr double kF64NegativeSubnormalMax =
constexpr double kF64PositiveSubnormalMax = std::bit_cast<double>(0x000FFFFFFFFFFFFFull); std::bit_cast<double>(0x8000000000000001ull);
constexpr double kF64PositiveSubnormalMin =
std::bit_cast<double>(0x0000000000000001ull);
constexpr double kF64PositiveSubnormalMax =
std::bit_cast<double>(0x000FFFFFFFFFFFFFull);
constexpr double kF64PositiveMin = std::bit_cast<double>(0x0010000000000000ull); constexpr double kF64PositiveMin = std::bit_cast<double>(0x0010000000000000ull);
constexpr double kF64PositiveMax = std::bit_cast<double>(0x7FEFFFFFFFFFFFFFull); constexpr double kF64PositiveMax = std::bit_cast<double>(0x7FEFFFFFFFFFFFFFull);
@@ -43,34 +47,37 @@ constexpr double kF64PositiveMax = std::bit_cast<double>(0x7FEFFFFFFFFFFFFFull);
* values that appear in kInterestingF64Values in math.ts * values that appear in kInterestingF64Values in math.ts
*/ */
const std::map<double, std::string> kInterestingF64s = { const std::map<double, std::string> kInterestingF64s = {
{ kF64NegativeMin, "kValue.f64.negative.min" }, {kF64NegativeMin, "kValue.f64.negative.min"},
{ -10.0, "-10.0" }, {-10.0, "-10.0"},
{ -1.0, "-1.0" }, {-1.0, "-1.0"},
{ -0.125, "-0.125" }, {-0.125, "-0.125"},
{ kF64NegativeMax, "kValue.f64.negative.max"}, {kF64NegativeMax, "kValue.f64.negative.max"},
{ kF64NegativeSubnormalMin, "kValue.f64.negative.subnormal.min" }, {kF64NegativeSubnormalMin, "kValue.f64.negative.subnormal.min"},
{ kF64NegativeSubnormalMax, "kValue.f64.negative.subnormal.max" }, {kF64NegativeSubnormalMax, "kValue.f64.negative.subnormal.max"},
{ 0.0, "0.0" }, {0.0, "0.0"},
{ kF64PositiveSubnormalMin, "kValue.f64.positive.subnormal.min" }, {kF64PositiveSubnormalMin, "kValue.f64.positive.subnormal.min"},
{ kF64PositiveSubnormalMax, "kValue.f64.positive.subnormal.max" }, {kF64PositiveSubnormalMax, "kValue.f64.positive.subnormal.max"},
{ kF64PositiveMin, "kValue.f64.positive.min" }, {kF64PositiveMin, "kValue.f64.positive.min"},
{ 0.125, "0.125" }, {0.125, "0.125"},
{ 1.0, "1.0" }, {1.0, "1.0"},
{ 10.0, "10.0" }, {10.0, "10.0"},
{ kF64PositiveMax, "kValue.f64.positive.max"} {kF64PositiveMax, "kValue.f64.positive.max"}};
};
/** Additional values to use for testing 'fract' */ /** Additional values to use for testing 'fract' */
const std::map<double, std::string> kFractF64s = { const std::map<double, std::string> kFractF64s = {
{ 0.5, "0.5" }, // 0.5 -> 0.5 {0.5, "0.5"}, // 0.5 -> 0.5
{ 1, "1" }, // 1 -> 0 {1, "1"}, // 1 -> 0
{ 2, "2" }, // 2 -> 0 {2, "2"}, // 2 -> 0
{ -0.5, "-0.5" }, // -0.5 -> 0.5 {-0.5, "-0.5"}, // -0.5 -> 0.5
{ -1, "-1" }, // -1 -> 0 {-1, "-1"}, // -1 -> 0
{ -2, "-2" }, // -2 -> 0 {-2, "-2"}, // -2 -> 0
{ 10.0000999999999997669, "10.0000999999999997669" }, // ~10.0001 -> ~0.0001 {10.0000999999999997669, "10.0000999999999997669"}, // ~10.0001 -> ~0.0001
{ -10.0000999999999997669, "-10.0000999999999997669" }, // -10.0001 -> ~0.9999 {-10.0000999999999997669,
{ 3937509.87755102012306, "3937509.87755102012306" }, // 3937509.87755102012306 -> ~0.877551..., not [0, 0.75], https://github.com/gpuweb/gpuweb/issues/4523 "-10.0000999999999997669"}, // -10.0001 -> ~0.9999
{3937509.87755102012306,
"3937509.87755102012306"}, // 3937509.87755102012306 -> ~0.877551..., not
// [0, 0.75],
// https://github.com/gpuweb/gpuweb/issues/4523
}; };
/** /**
@@ -78,33 +85,36 @@ const std::map<double, std::string> kFractF64s = {
* a CTS test * a CTS test
*/ */
std::string printAbstractFloat(const double val) { std::string printAbstractFloat(const double val) {
if (!std::isfinite(val)) { if (!std::isfinite(val)) {
if (val > 0) { if (val > 0) {
return "kValue.f64.positive.infinity"; return "kValue.f64.positive.infinity";
}
if (val < 0) {
return "kValue.f64.negative.infinity";
}
assert("Generated a NaN");
} }
if (val < 0) {
return "kValue.f64.negative.infinity";
}
assert("Generated a NaN");
}
if (const auto iter = kInterestingF64s.find(val); iter != kInterestingF64s.end()) { if (const auto iter = kInterestingF64s.find(val);
return iter->second; iter != kInterestingF64s.end()) {
} return iter->second;
}
std::stringstream ss; std::stringstream ss;
// Print 'easy' to read integers as literals, otherwise dump the hex value // Print 'easy' to read integers as literals, otherwise dump the hex value
if ( val == round(val) && fabs(val) < 100000) { if (val == round(val) && fabs(val) < 100000) {
ss << val; ss << val;
} else { } else {
ss << "reinterpretU64AsF64(0x" << std::hex << std::setfill('0') << std::setw(16) << std::bit_cast<uint64_t>(val) << "n) /* " << val << " */"; ss << "reinterpretU64AsF64(0x" << std::hex << std::setfill('0')
} << std::setw(16) << std::bit_cast<uint64_t>(val) << "n) /* " << val
return ss.str(); << " */";
}
return ss.str();
} }
/** Could this value potentially be affected by FTZ behaviour */ /** Could this value potentially be affected by FTZ behaviour */
bool couldBeFlushed(const double val) { bool couldBeFlushed(const double val) {
return std::fpclassify(val) == FP_SUBNORMAL; return std::fpclassify(val) == FP_SUBNORMAL;
} }
/** /**
@@ -120,95 +130,98 @@ bool couldBeFlushed(const double val) {
* processes. * processes.
*/ */
std::tuple<double, double> quantizeToAbstractFloat(const long double val) { std::tuple<double, double> quantizeToAbstractFloat(const long double val) {
const int round_mode = fegetround(); const int round_mode = fegetround();
assert(0 == fesetround(FE_DOWNWARD)); assert(0 == fesetround(FE_DOWNWARD));
const auto downward = static_cast<double>(val); const auto downward = static_cast<double>(val);
assert(0 == fesetround(FE_UPWARD)); assert(0 == fesetround(FE_UPWARD));
const auto upward = static_cast<double>(val); const auto upward = static_cast<double>(val);
assert(0 == fesetround(round_mode)); assert(0 == fesetround(round_mode));
return { downward, upward }; return {downward, upward};
} }
/** /**
* Generates a string for an unary operation result that can be copied into a * Generates a string for an unary operation result that can be copied into a
* CTS test file. * CTS test file.
*/ */
std::string printBinaryCase(const std::string &input, const std::vector<double> &result) { std::string printBinaryCase(const std::string& input,
assert(!result.empty()); const std::vector<double>& result) {
std::stringstream ss; assert(!result.empty());
ss << "{ input: "; std::stringstream ss;
ss << input; ss << "{ input: ";
ss << ", "; ss << input;
ss << "expected: [ "; ss << ", ";
if (!result.empty()) { ss << "expected: [ ";
for (auto i = 0; i < result.size() - 1; i++) { if (!result.empty()) {
ss << "" << printAbstractFloat(result[i]) << ", "; for (auto i = 0; i < result.size() - 1; i++) {
} ss << "" << printAbstractFloat(result[i]) << ", ";
ss << printAbstractFloat(result.back());
} }
ss << " ] }"; ss << printAbstractFloat(result.back());
return ss.str(); }
ss << " ] }";
return ss.str();
} }
/** /**
* Generates a string for a binary operation result that can be copied into a * Generates a string for a binary operation result that can be copied into a
* CTS test file. * CTS test file.
*/ */
std::string printBinaryCase(const std::string &lhs, const std::string &rhs, const std::vector<double> &result) { std::string printBinaryCase(const std::string& lhs, const std::string& rhs,
assert(!result.empty()); const std::vector<double>& result) {
std::stringstream ss; assert(!result.empty());
ss << "{ lhs: "; std::stringstream ss;
ss << lhs; ss << "{ lhs: ";
ss << ", rhs: "; ss << lhs;
ss << rhs; ss << ", rhs: ";
ss << ", "; ss << rhs;
ss << "expected: [ "; ss << ", ";
if (!result.empty()) { ss << "expected: [ ";
for (auto i = 0; i < result.size() - 1; i++) { if (!result.empty()) {
ss << "" << printAbstractFloat(result[i]) << ", "; for (auto i = 0; i < result.size() - 1; i++) {
} ss << "" << printAbstractFloat(result[i]) << ", ";
ss << printAbstractFloat(result.back());
} }
ss << " ] }"; ss << printAbstractFloat(result.back());
return ss.str(); }
ss << " ] }";
return ss.str();
} }
/** Function that performs a binary operation, i.e. addition, etc */ /** Function that performs a binary operation, i.e. addition, etc */
typedef long double (*BinaryOp)(long double, long double); typedef long double (*BinaryOp)(long double, long double);
const BinaryOp kAdditionOp= [](const long double lhs, const long double rhs) { const BinaryOp kAdditionOp = [](const long double lhs, const long double rhs) {
return lhs + rhs; return lhs + rhs;
}; };
const BinaryOp kSubtractionOp= [](const long double lhs, const long double rhs) { const BinaryOp kSubtractionOp = [](const long double lhs,
return lhs - rhs; const long double rhs) { return lhs - rhs; };
};
const BinaryOp kMultiplicationOp= [](const long double lhs, const long double rhs) { const BinaryOp kMultiplicationOp =
return lhs * rhs; [](const long double lhs, const long double rhs) { return lhs * rhs; };
};
/** /**
* Calculates all of the possible results for a binary operation given the * Calculates all of the possible results for a binary operation given the
* provided inputs. This handles both quantization and flushing behaviours. * provided inputs. This handles both quantization and flushing behaviours.
*/ */
std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs, long double rhs) { std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs,
// CTS needs to consider that subnormals may be flushed to zero at long double rhs) {
// any point, so applying potential flushings to get additional // CTS needs to consider that subnormals may be flushed to zero at
// results. // any point, so applying potential flushings to get additional
std::set<double> results; // results.
for (const auto l: couldBeFlushed(lhs) ? std::vector{0, lhs} : std::vector{lhs}) { std::set<double> results;
for (const auto r: couldBeFlushed(rhs) ? std::vector{0, rhs} : std::vector{rhs}) { for (const auto l :
const auto [downward, upward] = quantizeToAbstractFloat(op(l, r)); couldBeFlushed(lhs) ? std::vector{0, lhs} : std::vector{lhs}) {
results.insert(downward); for (const auto r :
results.insert(upward); couldBeFlushed(rhs) ? std::vector{0, rhs} : std::vector{rhs}) {
} const auto [downward, upward] = quantizeToAbstractFloat(op(l, r));
results.insert(downward);
results.insert(upward);
} }
}
return { results.begin(), results.end() }; return {results.begin(), results.end()};
} }
/** /**
@@ -216,15 +229,17 @@ std::vector<double> calculateBinaryResults(const BinaryOp op, long double lhs, l
* tests cases for a binary operation. * tests cases for a binary operation.
*/ */
std::string printBinaryOpCases(const BinaryOp op, const std::string& name) { std::string printBinaryOpCases(const BinaryOp op, const std::string& name) {
std::stringstream ss; std::stringstream ss;
ss << "BEGIN " << name << " CASES" << std::endl; ss << "BEGIN " << name << " CASES" << std::endl;
for (const auto& [lhs, lhs_str] : kInterestingF64s) { for (const auto& [lhs, lhs_str] : kInterestingF64s) {
for (const auto& [rhs, rhs_str] : kInterestingF64s) { for (const auto& [rhs, rhs_str] : kInterestingF64s) {
ss << printBinaryCase(lhs_str, rhs_str, calculateBinaryResults(op, lhs, rhs)) << "," << std::endl; ss << printBinaryCase(lhs_str, rhs_str,
} calculateBinaryResults(op, lhs, rhs))
<< "," << std::endl;
} }
ss << "END " << name << " CASES" << std::endl; }
return ss.str(); ss << "END " << name << " CASES" << std::endl;
return ss.str();
} }
/** /**
@@ -232,39 +247,47 @@ std::string printBinaryOpCases(const BinaryOp op, const std::string& name) {
* tests cases for `fract`. WGSL defines frac(x) = x - floor(x). * tests cases for `fract`. WGSL defines frac(x) = x - floor(x).
*/ */
std::string printFractCases() { std::string printFractCases() {
std::stringstream ss; std::stringstream ss;
ss << "BEGIN FRACT CASES" << std::endl; ss << "BEGIN FRACT CASES" << std::endl;
// Do not have to calculate quantization/roundings for floor(input), // Do not have to calculate quantization/roundings for floor(input),
// because floor of a double is guaranteed to be a double, and all of // because floor of a double is guaranteed to be a double, and all of
// the values in kInterestingF64s and kFractF64s are doubles. // the values in kInterestingF64s and kFractF64s are doubles.
for (const auto& [input, input_str] : kInterestingF64s) { for (const auto& [input, input_str] : kInterestingF64s) {
ss << printBinaryCase(input_str, calculateBinaryResults(kSubtractionOp, input, floor(input))) << "," << std::endl; ss << printBinaryCase(input_str, calculateBinaryResults(
} kSubtractionOp, input, floor(input)))
for (const auto& [input, input_str] : kFractF64s) { << "," << std::endl;
ss << printBinaryCase(input_str, calculateBinaryResults(kSubtractionOp, input, floor(input))) << "," << std::endl; }
} for (const auto& [input, input_str] : kFractF64s) {
ss << "END FRACT CASES" << std::endl; ss << printBinaryCase(input_str, calculateBinaryResults(
return ss.str(); kSubtractionOp, input, floor(input)))
<< "," << std::endl;
}
ss << "END FRACT CASES" << std::endl;
return ss.str();
} }
int main() { int main() {
assert(sizeof(double) < sizeof(long double) && "Need higher precision long double"); assert(sizeof(double) < sizeof(long double) &&
assert(sizeof(long double) == 16 && "Code assume 'proper' quad support, not some other higher precision floating point implementation"); "Need higher precision long double");
assert(sizeof(long double) == 16 &&
"Code assume 'proper' quad support, not some other higher precision "
"floating point implementation");
{ {
// Confirms that calculating f64 imprecise results generates two possible // Confirms that calculating f64 imprecise results generates two possible
// roundings. // roundings.
const auto [begin, end] = const auto [begin, end] = quantizeToAbstractFloat(
quantizeToAbstractFloat(static_cast<long double>(0.1) * static_cast<long double>(0.1)); static_cast<long double>(0.1) * static_cast<long double>(0.1));
assert(std::bit_cast<uint64_t>(begin) == 0x3F847AE147AE147bull && assert(std::bit_cast<uint64_t>(begin) == 0x3F847AE147AE147bull &&
std::bit_cast<uint64_t>(end) == 0x3F847AE147AE147Cull && std::bit_cast<uint64_t>(end) == 0x3F847AE147AE147Cull &&
"0.1 * 0.1 returned unexpected values"); "0.1 * 0.1 returned unexpected values");
} }
std::cout << printBinaryOpCases(kAdditionOp, "ADDITION") << std::endl; std::cout << printBinaryOpCases(kAdditionOp, "ADDITION") << std::endl;
std::cout << printBinaryOpCases(kSubtractionOp, "SUBTRACTION") << std::endl; std::cout << printBinaryOpCases(kSubtractionOp, "SUBTRACTION") << std::endl;
std::cout << printBinaryOpCases(kMultiplicationOp, "MULTIPLICATION") << std::endl; std::cout << printBinaryOpCases(kMultiplicationOp, "MULTIPLICATION")
std::cout << printFractCases() << std::endl; << std::endl;
std::cout << printFractCases() << std::endl;
return 0; return 0;
} }

View File

@@ -726,8 +726,7 @@ bool txXSLTNumber::isAlphaNumeric(char16_t ch) {
{ 0xFF66, 0xFFBE }, { 0xFF66, 0xFFBE },
{ 0xFFC2, 0xFFC7 }, { 0xFFC2, 0xFFC7 },
{ 0xFFCA, 0xFFCF }, { 0xFFCA, 0xFFCF },
{ 0xFFD2, 0xFFD7 } { 0xFFD2, 0xFFD7 } // clang-format on
// clang-format on
}; };
CharRange search = {ch, ch}; CharRange search = {ch, ch};

View File

@@ -72,8 +72,7 @@ XULResizerElement::Direction XULResizerElement::GetDirection() {
{-1, -1}, {0, -1}, {1, -1}, {-1, -1}, {0, -1}, {1, -1},
{-1, 0}, {1, 0}, {-1, 0}, {1, 0},
{-1, 1}, {0, 1}, {1, 1}, {-1, 1}, {0, 1}, {1, 1},
{-1, 1}, {1, 1} {-1, 1}, {1, 1} // clang-format on
// clang-format on
}; };
const auto* frame = GetPrimaryFrame(); const auto* frame = GetPrimaryFrame();

View File

@@ -44,8 +44,7 @@ NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE_WITH_LAST_RELEASE(TransactionItem,
NS_IMPL_CYCLE_COLLECTION_CLASS(TransactionItem) NS_IMPL_CYCLE_COLLECTION_CLASS(TransactionItem)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionItem) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionItem) tmp->CleanUp();
tmp->CleanUp();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TransactionItem) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TransactionItem)

View File

@@ -79,13 +79,9 @@
#include "mozHunspellAllocator.h" #include "mozHunspellAllocator.h"
#define MOZ_HUNSPELL_CONTRACTID "@mozilla.org/spellchecker/engine;1" #define MOZ_HUNSPELL_CONTRACTID "@mozilla.org/spellchecker/engine;1"
#define MOZ_HUNSPELL_CID \ #define MOZ_HUNSPELL_CID \
/* 56c778e4-1bee-45f3-a689-886692a97fe7 */ \ /* 56c778e4-1bee-45f3-a689-886692a97fe7 */ \
{ \ {0x56c778e4, 0x1bee, 0x45f3, {0xa6, 0x89, 0x88, 0x66, 0x92, 0xa9, 0x7f, 0xe7}}
0x56c778e4, 0x1bee, 0x45f3, { \
0xa6, 0x89, 0x88, 0x66, 0x92, 0xa9, 0x7f, 0xe7 \
} \
}
class mozHunspell final : public mozISpellCheckingEngine, class mozHunspell final : public mozISpellCheckingEngine,
public nsIObserver, public nsIObserver,

View File

@@ -19,12 +19,12 @@
#define MOZ_PERSONALDICTIONARY_CONTRACTID \ #define MOZ_PERSONALDICTIONARY_CONTRACTID \
"@mozilla.org/spellchecker/personaldictionary;1" "@mozilla.org/spellchecker/personaldictionary;1"
#define MOZ_PERSONALDICTIONARY_CID \ #define MOZ_PERSONALDICTIONARY_CID \
{ /* 7EF52EAF-B7E1-462B-87E2-5D1DBACA9048 */ \ {/* 7EF52EAF-B7E1-462B-87E2-5D1DBACA9048 */ \
0X7EF52EAF, 0XB7E1, 0X462B, { \ 0X7EF52EAF, \
0X87, 0XE2, 0X5D, 0X1D, 0XBA, 0XCA, 0X90, 0X48 \ 0XB7E1, \
} \ 0X462B, \
} {0X87, 0XE2, 0X5D, 0X1D, 0XBA, 0XCA, 0X90, 0X48}}
class mozPersonalDictionaryLoader; class mozPersonalDictionaryLoader;
class mozPersonalDictionarySave; class mozPersonalDictionarySave;

View File

@@ -1957,7 +1957,6 @@ class DrawTarget : public external::AtomicRefCounted<DrawTarget> {
return CreateSimilarDrawTarget(aSize, aFormat); return CreateSimilarDrawTarget(aSize, aFormat);
} }
/** /**
* Get the BackendType of Paths/PathBuilders created from this DrawTarget. * Get the BackendType of Paths/PathBuilders created from this DrawTarget.
* This will usually just be the same as the DrawTarget's BackendType. * This will usually just be the same as the DrawTarget's BackendType.

View File

@@ -106,7 +106,9 @@ bool GLXLibrary::EnsureInitialized(Display* aDisplay) {
#define SYMBOL(X) \ #define SYMBOL(X) \
{ \ { \
(PRFuncPtr*)&mSymbols.f##X, { \ (PRFuncPtr*)&mSymbols.f##X, { \
{ "glX" #X } \ { \
"glX" #X \
} \
} \ } \
} }
#define END_OF_SYMBOLS \ #define END_OF_SYMBOLS \

View File

@@ -97,7 +97,9 @@ bool WGLLibrary::EnsureInitialized() {
#define SYMBOL(X) \ #define SYMBOL(X) \
{ \ { \
(PRFuncPtr*)&mSymbols.f##X, { \ (PRFuncPtr*)&mSymbols.f##X, { \
{ "wgl" #X } \ { \
"wgl" #X \
} \
} \ } \
} }
#define END_OF_SYMBOLS \ #define END_OF_SYMBOLS \

View File

@@ -150,9 +150,8 @@ static auto ForEachNode(Node aRoot, const PreAction& aPreAction,
* ForEachNode pre-order traversal, using TraversalFlag. * ForEachNode pre-order traversal, using TraversalFlag.
*/ */
template <typename Iterator, typename Node, typename PreAction> template <typename Iterator, typename Node, typename PreAction>
auto ForEachNode(Node aRoot, const PreAction& aPreAction) auto ForEachNode(Node aRoot, const PreAction& aPreAction) -> std::enable_if_t<
-> std::enable_if_t< std::is_same_v<decltype(aPreAction(aRoot)), TraversalFlag>, bool> {
std::is_same_v<decltype(aPreAction(aRoot)), TraversalFlag>, bool> {
return ForEachNode<Iterator>( return ForEachNode<Iterator>(
aRoot, aPreAction, [](Node aNode) { return TraversalFlag::Continue; }); aRoot, aPreAction, [](Node aNode) { return TraversalFlag::Continue; });
} }

View File

@@ -37,7 +37,6 @@ namespace layers {
// //
class FenceD3D11 final : public Fence { class FenceD3D11 final : public Fence {
public: public:
static RefPtr<FenceD3D11> Create(ID3D11Device* aDevice); static RefPtr<FenceD3D11> Create(ID3D11Device* aDevice);
static RefPtr<FenceD3D11> CreateFromHandle( static RefPtr<FenceD3D11> CreateFromHandle(
RefPtr<gfx::FileHandleWrapper> aHandle, RefPtr<gfx::FileHandleWrapper> aHandle,

View File

@@ -7,25 +7,13 @@
#ifndef nsGfxCIID_h__ #ifndef nsGfxCIID_h__
#define nsGfxCIID_h__ #define nsGfxCIID_h__
#define NS_FONT_ENUMERATOR_CID \ #define NS_FONT_ENUMERATOR_CID \
{ \ {0xa6cf9115, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
0xa6cf9115, 0x15b3, 0x11d2, { \
0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 \
} \
}
#define NS_SCRIPTABLE_REGION_CID \ #define NS_SCRIPTABLE_REGION_CID \
{ \ {0xda5b130a, 0x1dd1, 0x11b2, {0xad, 0x47, 0xf4, 0x55, 0xb1, 0x81, 0x4a, 0x78}}
0xda5b130a, 0x1dd1, 0x11b2, { \
0xad, 0x47, 0xf4, 0x55, 0xb1, 0x81, 0x4a, 0x78 \
} \
}
#define NS_GFX_INITIALIZATION_CID \ #define NS_GFX_INITIALIZATION_CID \
{ \ {0x67c41576, 0x9664, 0x4ed5, {0x90, 0xc1, 0xf6, 0x68, 0x3f, 0xd5, 0x2c, 0x8f}}
0x67c41576, 0x9664, 0x4ed5, { \
0x90, 0xc1, 0xf6, 0x68, 0x3f, 0xd5, 0x2c, 0x8f \
} \
}
#endif #endif

View File

@@ -644,10 +644,14 @@ TEST(Gfx, gfxRect)
} }
TEST(Gfx, nsRectAbsolute) TEST(Gfx, nsRectAbsolute)
{ TestUnionEmptyRects<nsRectAbsolute>(); } {
TestUnionEmptyRects<nsRectAbsolute>();
}
TEST(Gfx, IntRectAbsolute) TEST(Gfx, IntRectAbsolute)
{ TestUnionEmptyRects<IntRectAbsolute>(); } {
TestUnionEmptyRects<IntRectAbsolute>();
}
static void TestMoveInsideAndClamp(IntRect aSrc, IntRect aTarget, static void TestMoveInsideAndClamp(IntRect aSrc, IntRect aTarget,
IntRect aExpected) { IntRect aExpected) {

View File

@@ -122,16 +122,24 @@ TEST(Gfx, RegionSingleRect)
} }
TEST(Gfx, RegionNonRectangular) TEST(Gfx, RegionNonRectangular)
{ TestLargestRegion::TestNonRectangular(); } {
TestLargestRegion::TestNonRectangular();
}
TEST(Gfx, RegionTwoRectTest) TEST(Gfx, RegionTwoRectTest)
{ TestLargestRegion::TwoRectTest(); } {
TestLargestRegion::TwoRectTest();
}
TEST(Gfx, RegionContainsSpecifiedRect) TEST(Gfx, RegionContainsSpecifiedRect)
{ TestLargestRegion::TestContainsSpecifiedRect(); } {
TestLargestRegion::TestContainsSpecifiedRect();
}
TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect) TEST(Gfx, RegionTestContainsSpecifiedOverflowingRect)
{ TestLargestRegion::TestContainsSpecifiedOverflowingRect(); } {
TestLargestRegion::TestContainsSpecifiedOverflowingRect();
}
TEST(Gfx, RegionScaleToInside) TEST(Gfx, RegionScaleToInside)
{ {

View File

@@ -3317,7 +3317,8 @@ already_AddRefed<gfxFont> gfxFontGroup::FindFontForChar(
return true; return true;
} }
// Does the candidate font provide a color glyph for the current character? // Does the candidate font provide a color glyph for the current character?
bool hasColorGlyph = f->HasColorGlyphFor(aCh, aNextCh) || bool hasColorGlyph =
f->HasColorGlyphFor(aCh, aNextCh) ||
(!nextIsVarSelector && f->HasColorGlyphFor(aCh, kVariationSelector16)); (!nextIsVarSelector && f->HasColorGlyphFor(aCh, kVariationSelector16));
// If the provided glyph matches the preference, accept the font. // If the provided glyph matches the preference, accept the font.
if (hasColorGlyph == PrefersColor(presentation)) { if (hasColorGlyph == PrefersColor(presentation)) {

View File

@@ -15,8 +15,7 @@
#include "nsString.h" #include "nsString.h"
gfxWindowsSurface::gfxWindowsSurface(HDC dc, uint32_t flags) gfxWindowsSurface::gfxWindowsSurface(HDC dc, uint32_t flags) : mDC(dc) {
: mDC(dc) {
InitWithDC(flags); InitWithDC(flags);
} }

View File

@@ -10,12 +10,8 @@
#include "nsICommandLineHandler.h" #include "nsICommandLineHandler.h"
// 5baca10a-4d53-4335-b24d-c69696640a9a // 5baca10a-4d53-4335-b24d-c69696640a9a
#define NS_FXRCOMMANDLINEHANDLER_CID \ #define NS_FXRCOMMANDLINEHANDLER_CID \
{ \ {0x5baca10a, 0x4d53, 0x4335, {0xb2, 0x4d, 0xc6, 0x96, 0x96, 0x64, 0x0a, 0x9a}}
0x5baca10a, 0x4d53, 0x4335, { \
0xb2, 0x4d, 0xc6, 0x96, 0x96, 0x64, 0x0a, 0x9a \
} \
}
// nsFxrCommandLineHandler is responsible for handling parameters used to // nsFxrCommandLineHandler is responsible for handling parameters used to
// bootstrap Firefox Reality running on desktop-class machines. // bootstrap Firefox Reality running on desktop-class machines.

View File

@@ -371,7 +371,8 @@ bool RenderDXGITextureHost::LockInternal() {
if (!mLocked) { if (!mLocked) {
if (mFencesHolderId.isSome()) { if (mFencesHolderId.isSome()) {
auto* fencesHolderMap = layers::CompositeProcessD3D11FencesHolderMap::Get(); auto* fencesHolderMap =
layers::CompositeProcessD3D11FencesHolderMap::Get();
if (!fencesHolderMap) { if (!fencesHolderMap) {
MOZ_ASSERT_UNREACHABLE("unexpected to be called"); MOZ_ASSERT_UNREACHABLE("unexpected to be called");
return false; return false;

View File

@@ -912,7 +912,7 @@ static inline void draw_quad_spans(int nump, Point2D p[4], uint32_t z,
if (y > checkY) { if (y > checkY) {
// If we're outside the clip rect, we're done. // If we're outside the clip rect, we're done.
if (y > clipRect.y1) break; if (y > clipRect.y1) break;
// Helper to find the next non-duplicate vertex that doesn't loop back. // Helper to find the next non-duplicate vertex that doesn't loop back.
#define STEP_EDGE(y, e0i, e0, e1i, e1, STEP_POINT, end) \ #define STEP_EDGE(y, e0i, e0, e1i, e1, STEP_POINT, end) \
do { \ do { \
/* Set new start of edge to be end of old edge */ \ /* Set new start of edge to be end of old edge */ \

View File

@@ -17,7 +17,8 @@ using namespace Microsoft::WRL;
// A basic composition layer backed by a swap-chain for DirectComposition // A basic composition layer backed by a swap-chain for DirectComposition
class Layer { class Layer {
public: public:
Layer(int width, int height, bool is_opaque, const ComPtr<IDXGIFactory2>& dxgiFactory, Layer(int width, int height, bool is_opaque,
const ComPtr<IDXGIFactory2>& dxgiFactory,
const ComPtr<ID3D11Device>& d3dDevice, const ComPtr<ID3D11Device>& d3dDevice,
const ComPtr<IDCompositionDesktopDevice>& dCompDevice) { const ComPtr<IDCompositionDesktopDevice>& dCompDevice) {
HRESULT hr; HRESULT hr;
@@ -33,7 +34,8 @@ class Layer {
// DXGI_SCALING_NONE caused swap chain creation failure. // DXGI_SCALING_NONE caused swap chain creation failure.
desc.Scaling = DXGI_SCALING_STRETCH; desc.Scaling = DXGI_SCALING_STRETCH;
desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
desc.AlphaMode = is_opaque ? DXGI_ALPHA_MODE_IGNORE : DXGI_ALPHA_MODE_PREMULTIPLIED; desc.AlphaMode =
is_opaque ? DXGI_ALPHA_MODE_IGNORE : DXGI_ALPHA_MODE_PREMULTIPLIED;
desc.Flags = 0; desc.Flags = 0;
// Create a swap-chain, visual, attach them and get the backbuffer texture // Create a swap-chain, visual, attach them and get the backbuffer texture
@@ -105,17 +107,15 @@ class Compositor {
// Construct a layer of given dimensions. // Construct a layer of given dimensions.
Layer* create_layer(int width, int height, bool is_opaque) { Layer* create_layer(int width, int height, bool is_opaque) {
Layer* layer = Layer* layer = new Layer(width, height, is_opaque, pIDXGIFactory,
new Layer(width, height, is_opaque, pIDXGIFactory, pD3DDevice, pDCompDevice); pD3DDevice, pDCompDevice);
return layer; return layer;
} }
void begin_frame() { void begin_frame() { pRootVisual->RemoveAllVisuals(); }
pRootVisual->RemoveAllVisuals();
}
void add_layer(Layer *layer) { void add_layer(Layer* layer) {
// TODO(gwc): Don't add the visual during creation. Once we support multiple // TODO(gwc): Don't add the visual during creation. Once we support multiple
// swap-chain layers, we'll need to support rebuilding the visual tree for // swap-chain layers, we'll need to support rebuilding the visual tree for
// DC as needed. // DC as needed.
@@ -148,7 +148,8 @@ Compositor* wrc_new(void* d3d11_device, void* hwnd) {
void wrc_delete(Compositor* compositor) { delete compositor; } void wrc_delete(Compositor* compositor) { delete compositor; }
Layer* wrc_create_layer(Compositor* compositor, int width, int height, bool is_opaque) { Layer* wrc_create_layer(Compositor* compositor, int width, int height,
bool is_opaque) {
return compositor->create_layer(width, height, is_opaque); return compositor->create_layer(width, height, is_opaque);
} }
@@ -163,15 +164,14 @@ void wrc_begin_frame(Compositor* compositor) { compositor->begin_frame(); }
void wrc_end_frame(Compositor* compositor) { compositor->end_frame(); } void wrc_end_frame(Compositor* compositor) { compositor->end_frame(); }
void wrc_add_layer(Compositor *compositor, Layer *layer) { void wrc_add_layer(Compositor* compositor, Layer* layer) {
compositor->add_layer(layer); compositor->add_layer(layer);
} }
void wrc_set_layer_position(Layer *layer, float x, float y) { void wrc_set_layer_position(Layer* layer, float x, float y) {
layer->mVisual->SetOffsetX(x); layer->mVisual->SetOffsetX(x);
layer->mVisual->SetOffsetY(y); layer->mVisual->SetOffsetY(y);
} }
} }
#endif #endif

View File

@@ -12,12 +12,12 @@ namespace mozilla {
namespace image { namespace image {
#define IMAGEBLOCKER_CONTRACTID "@mozilla.org/image-blocker-content-policy;1" #define IMAGEBLOCKER_CONTRACTID "@mozilla.org/image-blocker-content-policy;1"
#define IMAGEBLOCKER_CID \ #define IMAGEBLOCKER_CID \
{ /* f6fcd651-164b-4416-b001-9c8c393fd93b */ \ {/* f6fcd651-164b-4416-b001-9c8c393fd93b */ \
0xf6fcd651, 0x164b, 0x4416, { \ 0xf6fcd651, \
0xb0, 0x01, 0x9c, 0x8c, 0x39, 0x3f, 0xd9, 0x3b \ 0x164b, \
} \ 0x4416, \
} {0xb0, 0x01, 0x9c, 0x8c, 0x39, 0x3f, 0xd9, 0x3b}}
class ImageBlocker final : public nsIContentPolicy { class ImageBlocker final : public nsIContentPolicy {
~ImageBlocker() = default; ~ImageBlocker() = default;

View File

@@ -47,12 +47,12 @@
class nsIInputStream; class nsIInputStream;
class nsIRequest; class nsIRequest;
#define NS_RASTERIMAGE_CID \ #define NS_RASTERIMAGE_CID \
{ /* 376ff2c1-9bf6-418a-b143-3340c00112f7 */ \ {/* 376ff2c1-9bf6-418a-b143-3340c00112f7 */ \
0x376ff2c1, 0x9bf6, 0x418a, { \ 0x376ff2c1, \
0xb1, 0x43, 0x33, 0x40, 0xc0, 0x01, 0x12, 0xf7 \ 0x9bf6, \
} \ 0x418a, \
} {0xb1, 0x43, 0x33, 0x40, 0xc0, 0x01, 0x12, 0xf7}}
/** /**
* Handles static and animated image containers. * Handles static and animated image containers.

View File

@@ -120,15 +120,15 @@ static GdkRGBA GetForegroundColor(nsIMozIconURI* aIconURI) {
} }
return dark ? mozilla::ColorScheme::Dark : mozilla::ColorScheme::Light; return dark ? mozilla::ColorScheme::Dark : mozilla::ColorScheme::Light;
}(); }();
auto color = mozilla::LookAndFeel::Color(mozilla::LookAndFeel::ColorID::Windowtext, scheme, mozilla::LookAndFeel::UseStandins::No); auto color = mozilla::LookAndFeel::Color(
auto ToGdk = [](uint8_t aGecko) { mozilla::LookAndFeel::ColorID::Windowtext, scheme,
return aGecko / 255.0; mozilla::LookAndFeel::UseStandins::No);
}; auto ToGdk = [](uint8_t aGecko) { return aGecko / 255.0; };
return GdkRGBA { return GdkRGBA{
.red = ToGdk(NS_GET_R(color)), .red = ToGdk(NS_GET_R(color)),
.green = ToGdk(NS_GET_G(color)), .green = ToGdk(NS_GET_G(color)),
.blue = ToGdk(NS_GET_B(color)), .blue = ToGdk(NS_GET_B(color)),
.alpha = ToGdk(NS_GET_A(color)), .alpha = ToGdk(NS_GET_A(color)),
}; };
} }
@@ -353,5 +353,4 @@ nsresult nsIconChannel::Init(nsIURI* aURI) {
return StreamToChannel(stream.forget(), aURI, getter_AddRefs(mRealChannel)); return StreamToChannel(stream.forget(), aURI, getter_AddRefs(mRealChannel));
} }
void nsIconChannel::Shutdown() { void nsIconChannel::Shutdown() {}
}

Some files were not shown because too many files have changed in this diff Show More