diff --git a/docshell/base/ChildProcessChannelListener.h b/docshell/base/ChildProcessChannelListener.h index e938e10b3ef8..7998b51a8b7e 100644 --- a/docshell/base/ChildProcessChannelListener.h +++ b/docshell/base/ChildProcessChannelListener.h @@ -20,9 +20,9 @@ namespace dom { class ChildProcessChannelListener final { NS_INLINE_DECL_REFCOUNTING(ChildProcessChannelListener) - using Callback = std::function&&, - uint32_t, nsDOMNavigationTiming*)>; + using Callback = + std::function&&, + uint32_t, nsDOMNavigationTiming*)>; void RegisterCallback(uint64_t aIdentifier, Callback&& aCallback); diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 4e0110a43965..a616ccbf6ce9 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -601,7 +601,8 @@ void CustomElementRegistry::UpgradeCandidates( return; } - mozilla::UniquePtr>> candidates; + mozilla::UniquePtr>> + candidates; if (mCandidatesMap.Remove(aKey, &candidates)) { MOZ_ASSERT(candidates); CustomElementReactionsStack* reactionsStack = diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h index 88fe53de5714..a835874c81c4 100644 --- a/dom/base/nsDOMNavigationTiming.h +++ b/dom/base/nsDOMNavigationTiming.h @@ -191,8 +191,8 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline { bool IsTopLevelContentDocumentInContentProcess() const; -// Should those be amended, the IPC serializer should be updated -// accordingly. + // Should those be amended, the IPC serializer should be updated + // accordingly. mozilla::WeakPtr mDocShell; nsCOMPtr mUnloadedURI; diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 5bf502bc090b..e83198e8be46 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -885,7 +885,7 @@ bool nsFrameLoader::Show(nsSubDocumentFrame* frame) { ds->SetScrollbarPreference(GetScrollbarPreference(mOwnerContent)); const bool marginsChanged = - ds->UpdateFrameMargins(GetMarginAttributes(mOwnerContent)); + ds->UpdateFrameMargins(GetMarginAttributes(mOwnerContent)); if (PresShell* presShell = ds->GetPresShell()) { // Ensure root scroll frame is reflowed in case margins have changed if (marginsChanged) { diff --git a/dom/base/nsIStyleSheetLinkingElement.h b/dom/base/nsIStyleSheetLinkingElement.h index 0deceab8af5d..a65d9750bb7a 100644 --- a/dom/base/nsIStyleSheetLinkingElement.h +++ b/dom/base/nsIStyleSheetLinkingElement.h @@ -109,10 +109,8 @@ class nsIStyleSheetLinkingElement : public nsISupports { already_AddRefed aTriggeringPrincipal, already_AddRefed aReferrerInfo, mozilla::CORSMode, const nsAString& aTitle, - const nsAString& aMedia, - const nsAString& aIntegrity, - const nsAString& aNonce, - HasAlternateRel, IsInline, + const nsAString& aMedia, const nsAString& aIntegrity, + const nsAString& aNonce, HasAlternateRel, IsInline, IsExplicitlyEnabled); ~SheetInfo(); diff --git a/dom/base/nsJSUtils.h b/dom/base/nsJSUtils.h index 30581dfe350c..1206393fe111 100644 --- a/dom/base/nsJSUtils.h +++ b/dom/base/nsJSUtils.h @@ -251,7 +251,8 @@ inline void AssignFromStringBuffer(nsStringBuffer* buffer, size_t len, buffer->ToString(len, dest); } -template ::value>* = nullptr> +template ::value>* = nullptr> inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) { size_t len = JS::GetStringLength(s); static_assert(js::MaxStringLength < (1 << 30), @@ -285,7 +286,8 @@ inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) { } // Specialization for UTF8String. -template ::value>* = nullptr> +template ::value>* = nullptr> inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) { using namespace mozilla; CheckedInt bufLen(JS::GetStringLength(s)); diff --git a/dom/broadcastchannel/BroadcastChannelService.cpp b/dom/broadcastchannel/BroadcastChannelService.cpp index 16aee5e38aae..24bbadf982c7 100644 --- a/dom/broadcastchannel/BroadcastChannelService.cpp +++ b/dom/broadcastchannel/BroadcastChannelService.cpp @@ -59,10 +59,9 @@ void BroadcastChannelService::RegisterActor( AssertIsOnBackgroundThread(); MOZ_ASSERT(aParent); - const auto& parents = - mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() { - return new nsTArray(); - }); + const auto& parents = mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() { + return new nsTArray(); + }); MOZ_ASSERT(!parents->Contains(aParent)); parents->AppendElement(aParent); diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h index 90041305e348..2929eceeed63 100644 --- a/dom/canvas/WebGLTypes.h +++ b/dom/canvas/WebGLTypes.h @@ -681,8 +681,7 @@ class RawBuffer { * If aTakeData is true, RawBuffer will delete[] the memory when destroyed. */ RawBuffer(size_t len, T* data, bool aTakeData = false) - : mData(data), mLength(len), mOwnsData(aTakeData) { - } + : mData(data), mLength(len), mOwnsData(aTakeData) {} RawBuffer(size_t len, RefPtr& aSmem) : mSmem(aSmem), mData(aSmem->memory()), mLength(len), mOwnsData(false) { diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index ce5f396b60d8..afb4424e8ecc 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -2932,7 +2932,7 @@ void HTMLInputElement::Blur(ErrorResult& aError) { } void HTMLInputElement::Focus(const FocusOptions& aOptions, - CallerType aCallerType, ErrorResult& aError) { + CallerType aCallerType, ErrorResult& aError) { if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) && !IsExperimentalMobileType(mType)) { if (Element* dateTimeBoxElement = GetDateTimeBoxElement()) { diff --git a/dom/ipc/WindowGlobalParent.cpp b/dom/ipc/WindowGlobalParent.cpp index e6ed96f4790d..9ebd855ad28a 100644 --- a/dom/ipc/WindowGlobalParent.cpp +++ b/dom/ipc/WindowGlobalParent.cpp @@ -188,7 +188,6 @@ void WindowGlobalParent::GetContentBlockingLog(nsAString& aLog) { aLog.Assign(std::move(log)); } - mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI( dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState, bool aSetNavigating) { @@ -311,7 +310,7 @@ void WindowGlobalParent::NotifyContentBlockingEvent( MOZ_ASSERT_IF(isCookiesBlockedTracker && !aBlocked, aReason.isSome()); MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); // TODO: temporarily remove this until we find the root case of Bug 1609144 - //MOZ_DIAGNOSTIC_ASSERT_IF(XRE_IsE10sParentProcess(), !IsInProcess()); + // MOZ_DIAGNOSTIC_ASSERT_IF(XRE_IsE10sParentProcess(), !IsInProcess()); // Return early if this WindowGlobalParent is in process. if (IsInProcess()) { diff --git a/dom/localstorage/ActorsParent.cpp b/dom/localstorage/ActorsParent.cpp index e735cbff7c52..bc27aecddbf0 100644 --- a/dom/localstorage/ActorsParent.cpp +++ b/dom/localstorage/ActorsParent.cpp @@ -3666,9 +3666,9 @@ void DatastoreWriteOptimizer::ApplyAndReset( // about the UpdateWithMove flag. aOrderedItems.RemoveElementAt(index); - entry.Data() = MakeUnique(updateItemInfo->SerialNumber(), - updateItemInfo->GetKey(), - updateItemInfo->GetValue()); + entry.Data() = MakeUnique( + updateItemInfo->SerialNumber(), updateItemInfo->GetKey(), + updateItemInfo->GetValue()); } else { item.value() = updateItemInfo->GetValue(); entry.Remove(); diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 80bbae7e26f2..ddc2aac728a7 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -1210,13 +1210,15 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) { { MutexAutoLock lock(mMutex); - const auto& domainInfo = mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() { - NS_ASSERTION(!parent, "Shouldn't have a parent here!"); - Unused << parent; // silence clang -Wunused-lambda-capture in opt builds - WorkerDomainInfo* wdi = new WorkerDomainInfo(); - wdi->mDomain = domain; - return wdi; - }); + const auto& domainInfo = + mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() { + NS_ASSERTION(!parent, "Shouldn't have a parent here!"); + Unused + << parent; // silence clang -Wunused-lambda-capture in opt builds + WorkerDomainInfo* wdi = new WorkerDomainInfo(); + wdi->mDomain = domain; + return wdi; + }); queued = gMaxWorkersPerDomain && domainInfo->ActiveWorkerCount() >= gMaxWorkersPerDomain && @@ -1277,9 +1279,8 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) { if (!isServiceWorker) { // Service workers are excluded since their lifetime is separate from // that of dom windows. - const auto& windowArray = - mWindowMap.LookupForAdd(window).OrInsert( - []() { return new nsTArray(1); }); + const auto& windowArray = mWindowMap.LookupForAdd(window).OrInsert( + []() { return new nsTArray(1); }); if (!windowArray->Contains(aWorkerPrivate)) { windowArray->AppendElement(aWorkerPrivate); } else { diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index b6fe9666b411..aa3514107353 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -2194,7 +2194,6 @@ WorkerPrivate::WorkerPrivate( mJSSettings.content.realmOptions.creationOptions().setToSourceEnabled( UsesSystemPrincipal()); - if (mIsSecureContext) { mJSSettings.chrome.realmOptions.creationOptions().setSecureContext(true); mJSSettings.content.realmOptions.creationOptions().setSecureContext(true); diff --git a/editor/libeditor/ChangeStyleTransaction.cpp b/editor/libeditor/ChangeStyleTransaction.cpp index 5cf64e179e71..e900d14b72f6 100644 --- a/editor/libeditor/ChangeStyleTransaction.cpp +++ b/editor/libeditor/ChangeStyleTransaction.cpp @@ -193,8 +193,8 @@ ChangeStyleTransaction::DoTransaction() { } else { values.Assign(mValue); } - rv = cssDecl->SetProperty(propertyNameString, - NS_ConvertUTF16toUTF8(values), priority); + rv = cssDecl->SetProperty(propertyNameString, NS_ConvertUTF16toUTF8(values), + priority); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp index 19cab57d23a8..d26dabe9b105 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp @@ -43,7 +43,7 @@ inline bool IsIgnorableCharacter(char16_t ch) { // part of a word, and are otherwise punctuation. inline bool IsConditionalPunctuation(char ch) { - return (ch == '\'' || // RIGHT SINGLE QUOTATION MARK + return (ch == '\'' || // RIGHT SINGLE QUOTATION MARK ch == static_cast(0xB7)); // MIDDLE DOT } @@ -610,7 +610,8 @@ bool WordSplitState::ShouldSkipWord(int32_t aStart, int32_t aLength) const { // check to see if the word contains a digit for (int32_t i = aStart; i < last; i++) { - if (mozilla::unicode::GetGenCategory(GetUnicharAt(i)) == nsUGenCategory::kNumber) { + if (mozilla::unicode::GetGenCategory(GetUnicharAt(i)) == + nsUGenCategory::kNumber) { return true; } } diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 389412338c50..66bf0c322749 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -3538,7 +3538,8 @@ void AsyncPanZoomController::RecordScrollPayload(const TimeStamp& aTimeStamp) { } } -void AsyncPanZoomController::StartTouch(const ParentLayerPoint& aPoint, uint32_t aTime) { +void AsyncPanZoomController::StartTouch(const ParentLayerPoint& aPoint, + uint32_t aTime) { RecursiveMutexAutoLock lock(mRecursiveMutex); mX.StartTouch(aPoint.x, aTime); mY.StartTouch(aPoint.y, aTime); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 50a4d6074239..8c9ecf89cc2f 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -843,7 +843,8 @@ class AsyncPanZoomController { void TrackTouch(const MultiTouchInput& aEvent); /** - * Register the start of a touch or pan gesture at the given position and time. + * Register the start of a touch or pan gesture at the given position and + * time. */ void StartTouch(const ParentLayerPoint& aPoint, uint32_t aTime); diff --git a/gfx/layers/ipc/ContentCompositorBridgeParent.cpp b/gfx/layers/ipc/ContentCompositorBridgeParent.cpp index 1235d9217e65..d439990ef4f2 100644 --- a/gfx/layers/ipc/ContentCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/ContentCompositorBridgeParent.cpp @@ -739,7 +739,8 @@ mozilla::ipc::IPCResult ContentCompositorBridgeParent::RecvPreferredDXGIAdapter( return IPC_FAIL_NO_REASON(this); } - RefPtr device = gfx::DeviceManagerDx::Get()->GetCompositorDevice(); + RefPtr device = + gfx::DeviceManagerDx::Get()->GetCompositorDevice(); if (!device) { return IPC_FAIL_NO_REASON(this); } diff --git a/gfx/thebes/gfxWindowsNativeDrawing.h b/gfx/thebes/gfxWindowsNativeDrawing.h index fc7dc5b6f5af..a7713dd800eb 100644 --- a/gfx/thebes/gfxWindowsNativeDrawing.h +++ b/gfx/thebes/gfxWindowsNativeDrawing.h @@ -53,11 +53,11 @@ class gfxWindowsNativeDrawing { * } while (nativeDraw.ShouldRenderAgain()); * nativeDraw.PaintToContext(); */ - gfxWindowsNativeDrawing(gfxContext* ctx, const gfxRect& nativeRect, - uint32_t nativeDrawFlags = - CANNOT_DRAW_TO_COLOR_ALPHA | - CANNOT_AXIS_ALIGNED_SCALE | - CANNOT_COMPLEX_TRANSFORM); + gfxWindowsNativeDrawing( + gfxContext* ctx, const gfxRect& nativeRect, + uint32_t nativeDrawFlags = CANNOT_DRAW_TO_COLOR_ALPHA | + CANNOT_AXIS_ALIGNED_SCALE | + CANNOT_COMPLEX_TRANSFORM); /* Returns a HDC which may be used for native drawing. This HDC is valid * until EndNativeDrawing is called; if it is used for drawing after that diff --git a/gfx/vr/external_api/moz_external_vr.h b/gfx/vr/external_api/moz_external_vr.h index e2b48dbaa3cb..a086766066bb 100644 --- a/gfx/vr/external_api/moz_external_vr.h +++ b/gfx/vr/external_api/moz_external_vr.h @@ -551,7 +551,7 @@ enum class VRTelemetryId : uint8_t { TOTAL = 4, }; -enum class VRTelemetryInstallFrom: uint8_t { +enum class VRTelemetryInstallFrom : uint8_t { User = 0, FxR = 1, HTC = 2, @@ -559,7 +559,7 @@ enum class VRTelemetryInstallFrom: uint8_t { TOTAL = 4, }; -enum class VRTelemetryEntryMethod: uint8_t { +enum class VRTelemetryEntryMethod : uint8_t { SystemBtn = 0, Library = 1, Gaze = 2, diff --git a/gfx/webrender_bindings/DCLayerTree.cpp b/gfx/webrender_bindings/DCLayerTree.cpp index 2ac7e1864e15..cd170c4a4376 100644 --- a/gfx/webrender_bindings/DCLayerTree.cpp +++ b/gfx/webrender_bindings/DCLayerTree.cpp @@ -433,8 +433,8 @@ void DCSurface::UpdateAllocatedRect() { for (auto it = mDCLayers.begin(); it != mDCLayers.end(); ++it) { RECT rect; - rect.left = (LONG) (VIRTUAL_OFFSET + it->first.mX * mTileSize.width); - rect.top = (LONG) (VIRTUAL_OFFSET + it->first.mY * mTileSize.height); + rect.left = (LONG)(VIRTUAL_OFFSET + it->first.mX * mTileSize.width); + rect.top = (LONG)(VIRTUAL_OFFSET + it->first.mY * mTileSize.height); rect.right = rect.left + mTileSize.width; rect.bottom = rect.top + mTileSize.height; diff --git a/js/src/builtin/streams/MiscellaneousOperations-inl.h b/js/src/builtin/streams/MiscellaneousOperations-inl.h index 18b62340cf0c..0f6cab835f10 100644 --- a/js/src/builtin/streams/MiscellaneousOperations-inl.h +++ b/js/src/builtin/streams/MiscellaneousOperations-inl.h @@ -14,13 +14,13 @@ #include "mozilla/Assertions.h" // MOZ_ASSERT #include "mozilla/Attributes.h" // MOZ_MUST_USE -#include "js/Promise.h" // JS::{Resolve,Reject}Promise, JS::PromiseState -#include "js/RootingAPI.h" // JS::Rooted, JS::{,Mutable}Handle -#include "js/Value.h" // JS::UndefinedHandleValue, JS::Value -#include "vm/Compartment.h" // JS::Compartment -#include "vm/Interpreter.h" // js::Call -#include "vm/JSContext.h" // JSContext -#include "vm/JSObject.h" // JSObject +#include "js/Promise.h" // JS::{Resolve,Reject}Promise, JS::PromiseState +#include "js/RootingAPI.h" // JS::Rooted, JS::{,Mutable}Handle +#include "js/Value.h" // JS::UndefinedHandleValue, JS::Value +#include "vm/Compartment.h" // JS::Compartment +#include "vm/Interpreter.h" // js::Call +#include "vm/JSContext.h" // JSContext +#include "vm/JSObject.h" // JSObject #include "vm/PromiseObject.h" // js::PromiseObject #include "vm/Compartment-inl.h" // JS::Compartment::wrap diff --git a/js/src/builtin/streams/PipeToState.h b/js/src/builtin/streams/PipeToState.h index 6b2470979f0d..83de00feb288 100644 --- a/js/src/builtin/streams/PipeToState.h +++ b/js/src/builtin/streams/PipeToState.h @@ -28,10 +28,7 @@ class PipeToState : public NativeObject { /** * Memory layout for PipeToState instances. */ - enum Slots { - Slot_Flags, - SlotCount - }; + enum Slots { Slot_Flags, SlotCount }; private: enum Flags { diff --git a/js/src/builtin/streams/ReadableStreamDefaultControllerOperations.cpp b/js/src/builtin/streams/ReadableStreamDefaultControllerOperations.cpp index c07c952282bf..6a5fff61fc19 100644 --- a/js/src/builtin/streams/ReadableStreamDefaultControllerOperations.cpp +++ b/js/src/builtin/streams/ReadableStreamDefaultControllerOperations.cpp @@ -25,14 +25,14 @@ #include "js/RootingAPI.h" // JS::Handle, JS::Rooted #include "js/Stream.h" // JS::ReadableStreamUnderlyingSource #include "js/Value.h" // JS::{,Int32,Object}Value, JS::UndefinedHandleValue -#include "vm/Compartment.h" // JS::Compartment -#include "vm/Interpreter.h" // js::Call, js::GetAndClearExceptionAndStack -#include "vm/JSContext.h" // JSContext -#include "vm/JSObject.h" // JSObject -#include "vm/List.h" // js::ListObject +#include "vm/Compartment.h" // JS::Compartment +#include "vm/Interpreter.h" // js::Call, js::GetAndClearExceptionAndStack +#include "vm/JSContext.h" // JSContext +#include "vm/JSObject.h" // JSObject +#include "vm/List.h" // js::ListObject #include "vm/PromiseObject.h" // js::PromiseObject -#include "vm/Runtime.h" // JSAtomState -#include "vm/SavedFrame.h" // js::SavedFrame +#include "vm/Runtime.h" // JSAtomState +#include "vm/SavedFrame.h" // js::SavedFrame #include "builtin/streams/HandlerFunction-inl.h" // js::NewHandler #include "builtin/streams/MiscellaneousOperations-inl.h" // js::PromiseCall diff --git a/js/src/builtin/streams/ReadableStreamInternals.cpp b/js/src/builtin/streams/ReadableStreamInternals.cpp index f0fc05f090f5..c8b7f3f23c10 100644 --- a/js/src/builtin/streams/ReadableStreamInternals.cpp +++ b/js/src/builtin/streams/ReadableStreamInternals.cpp @@ -25,13 +25,13 @@ #include "js/RootingAPI.h" // JS::Handle, JS::Rooted #include "js/Stream.h" // JS::ReadableStreamUnderlyingSource, JS::ReadableStreamMode #include "js/Value.h" // JS::Value, JS::{Boolean,Object}Value, JS::UndefinedHandleValue -#include "vm/JSContext.h" // JSContext -#include "vm/JSFunction.h" // JSFunction, js::NewNativeFunction -#include "vm/NativeObject.h" // js::NativeObject -#include "vm/ObjectGroup.h" // js::GenericObject +#include "vm/JSContext.h" // JSContext +#include "vm/JSFunction.h" // JSFunction, js::NewNativeFunction +#include "vm/NativeObject.h" // js::NativeObject +#include "vm/ObjectGroup.h" // js::GenericObject #include "vm/PromiseObject.h" // js::PromiseObject -#include "vm/Realm.h" // JS::Realm -#include "vm/StringType.h" // js::PropertyName +#include "vm/Realm.h" // JS::Realm +#include "vm/StringType.h" // js::PropertyName #include "builtin/streams/MiscellaneousOperations-inl.h" // js::{Reject,Resolve}UnwrappedPromiseWithUndefined, js::SetSettledPromiseIsHandled #include "builtin/streams/ReadableStreamReader-inl.h" // js::js::UnwrapReaderFromStream{,NoThrow} diff --git a/js/src/builtin/streams/ReadableStreamOperations.cpp b/js/src/builtin/streams/ReadableStreamOperations.cpp index a61ce337dbec..68088c5a96fa 100644 --- a/js/src/builtin/streams/ReadableStreamOperations.cpp +++ b/js/src/builtin/streams/ReadableStreamOperations.cpp @@ -13,7 +13,7 @@ #include "jsapi.h" // JS_SetPrivate -#include "builtin/Array.h" // js::NewDenseFullyAllocatedArray +#include "builtin/Array.h" // js::NewDenseFullyAllocatedArray #include "builtin/Promise.h" // js::RejectPromiseWithPendingError #include "builtin/streams/ReadableStream.h" // js::ReadableStream #include "builtin/streams/ReadableStreamController.h" // js::ReadableStream{,Default}Controller diff --git a/js/src/builtin/streams/ReadableStreamReader.cpp b/js/src/builtin/streams/ReadableStreamReader.cpp index 67ad2bfcf6d1..cdf38956bde7 100644 --- a/js/src/builtin/streams/ReadableStreamReader.cpp +++ b/js/src/builtin/streams/ReadableStreamReader.cpp @@ -18,11 +18,11 @@ #include "builtin/streams/ReadableStreamController.h" // js::ReadableStreamController #include "builtin/streams/ReadableStreamInternals.h" // js::ReadableStream{Cancel,CreateReadResult} #include "js/RootingAPI.h" // JS::Handle, JS::Rooted -#include "js/Value.h" // JS::Value, JS::UndefinedHandleValue -#include "vm/Interpreter.h" // js::GetAndClearException -#include "vm/JSContext.h" // JSContext +#include "js/Value.h" // JS::Value, JS::UndefinedHandleValue +#include "vm/Interpreter.h" // js::GetAndClearException +#include "vm/JSContext.h" // JSContext #include "vm/PromiseObject.h" // js::PromiseObject -#include "vm/Runtime.h" // JSRuntime +#include "vm/Runtime.h" // JSRuntime #include "builtin/streams/MiscellaneousOperations-inl.h" // js::SetSettledPromiseIsHandled #include "vm/Compartment-inl.h" // JS::Compartment::wrap, js::UnwrapInternalSlot diff --git a/js/src/builtin/streams/TeeState.cpp b/js/src/builtin/streams/TeeState.cpp index 9c19227ccc5c..c8c151fd8a39 100644 --- a/js/src/builtin/streams/TeeState.cpp +++ b/js/src/builtin/streams/TeeState.cpp @@ -9,9 +9,9 @@ #include "builtin/streams/TeeState.h" #include "builtin/streams/ReadableStream.h" // js::ReadableStream -#include "js/Class.h" // JSClass, JSCLASS_HAS_RESERVED_SLOTS -#include "js/RootingAPI.h" // JS::Handle, JS::Rooted -#include "vm/JSContext.h" // JSContext +#include "js/Class.h" // JSClass, JSCLASS_HAS_RESERVED_SLOTS +#include "js/RootingAPI.h" // JS::Handle, JS::Rooted +#include "vm/JSContext.h" // JSContext #include "vm/PromiseObject.h" // js::PromiseObject #include "vm/JSObject-inl.h" // js::NewBuiltinClassInstance diff --git a/js/src/builtin/streams/TeeState.h b/js/src/builtin/streams/TeeState.h index e296549cfe05..beb42ff8e675 100644 --- a/js/src/builtin/streams/TeeState.h +++ b/js/src/builtin/streams/TeeState.h @@ -15,8 +15,8 @@ #include "builtin/streams/ReadableStreamController.h" // js::ReadableStreamDefaultController #include "js/Class.h" // JSClass -#include "js/Value.h" // JS::{Int32,Object}Value -#include "vm/NativeObject.h" // js::NativeObject +#include "js/Value.h" // JS::{Int32,Object}Value +#include "vm/NativeObject.h" // js::NativeObject #include "vm/PromiseObject.h" // js::PromiseObject namespace js { diff --git a/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp b/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp index 0f562b182c90..05782cb951af 100644 --- a/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp +++ b/js/src/builtin/streams/WritableStreamDefaultControllerOperations.cpp @@ -22,12 +22,12 @@ #include "js/Promise.h" // JS::AddPromiseReactions #include "js/RootingAPI.h" // JS::Handle, JS::Rooted #include "js/Value.h" // JS::{,Int32,Magic,Object}Value, JS::UndefinedHandleValue, JS_WRITABLESTREAM_CLOSE_RECORD -#include "vm/Compartment.h" // JS::Compartment -#include "vm/JSContext.h" // JSContext -#include "vm/JSObject.h" // JSObject -#include "vm/List.h" // js::ListObject +#include "vm/Compartment.h" // JS::Compartment +#include "vm/JSContext.h" // JSContext +#include "vm/JSObject.h" // JSObject +#include "vm/List.h" // js::ListObject #include "vm/PromiseObject.h" // js::PromiseObject -#include "vm/Runtime.h" // JSAtomState +#include "vm/Runtime.h" // JSAtomState #include "builtin/streams/HandlerFunction-inl.h" // js::TargetFromHandler #include "builtin/streams/MiscellaneousOperations-inl.h" // js::PromiseCall diff --git a/js/src/builtin/streams/WritableStreamDefaultWriter.cpp b/js/src/builtin/streams/WritableStreamDefaultWriter.cpp index 84c5bfe99ab0..168f4e2e8d36 100644 --- a/js/src/builtin/streams/WritableStreamDefaultWriter.cpp +++ b/js/src/builtin/streams/WritableStreamDefaultWriter.cpp @@ -22,10 +22,10 @@ #include "js/CallArgs.h" // JS::CallArgs{,FromVp} #include "js/Class.h" // js::ClassSpec, JS_NULL_CLASS_OPS #include "js/PropertySpec.h" // JS{Function,Property}Spec, JS_{FS,PS}_END, JS_{FN,PSG} -#include "js/RootingAPI.h" // JS::Handle -#include "js/Value.h" // JS::Value -#include "vm/Compartment.h" // JS::Compartment -#include "vm/JSContext.h" // JSContext +#include "js/RootingAPI.h" // JS::Handle +#include "js/Value.h" // JS::Value +#include "vm/Compartment.h" // JS::Compartment +#include "vm/JSContext.h" // JSContext #include "vm/PromiseObject.h" // js::PromiseObject #include "builtin/streams/MiscellaneousOperations-inl.h" // js::SetSettledPromiseIsHandled diff --git a/js/src/builtin/streams/WritableStreamOperations.cpp b/js/src/builtin/streams/WritableStreamOperations.cpp index 43c16b9c7fa6..891b96dd7a1a 100644 --- a/js/src/builtin/streams/WritableStreamOperations.cpp +++ b/js/src/builtin/streams/WritableStreamOperations.cpp @@ -25,9 +25,9 @@ #include "js/Promise.h" // JS::{Reject,Resolve}Promise #include "js/RootingAPI.h" // JS::Handle, JS::Rooted #include "js/Value.h" // JS::Value, JS::ObjecValue, JS::UndefinedHandleValue -#include "vm/Compartment.h" // JS::Compartment -#include "vm/JSContext.h" // JSContext -#include "vm/List.h" // js::ListObject +#include "vm/Compartment.h" // JS::Compartment +#include "vm/JSContext.h" // JSContext +#include "vm/List.h" // js::ListObject #include "vm/PromiseObject.h" // js::PromiseObject #include "builtin/streams/HandlerFunction-inl.h" // js::NewHandler, js::TargetFromHandler diff --git a/js/src/builtin/streams/WritableStreamWriterOperations.cpp b/js/src/builtin/streams/WritableStreamWriterOperations.cpp index 8778dbb3d823..0005cfc1a9d8 100644 --- a/js/src/builtin/streams/WritableStreamWriterOperations.cpp +++ b/js/src/builtin/streams/WritableStreamWriterOperations.cpp @@ -21,10 +21,10 @@ #include "builtin/streams/WritableStreamDefaultWriter.h" // js::WritableStreamDefaultWriter #include "builtin/streams/WritableStreamOperations.h" // js::WritableStream{Abort,CloseQueuedOrInFlight} #include "js/Promise.h" // JS::PromiseState -#include "js/Value.h" // JS::Value, JS::{Int32,Null}Value -#include "vm/Compartment.h" // JS::Compartment -#include "vm/Interpreter.h" // js::GetAndClearException -#include "vm/JSContext.h" // JSContext +#include "js/Value.h" // JS::Value, JS::{Int32,Null}Value +#include "vm/Compartment.h" // JS::Compartment +#include "vm/Interpreter.h" // js::GetAndClearException +#include "vm/JSContext.h" // JSContext #include "vm/PromiseObject.h" // js::PromiseObject #include "builtin/streams/MiscellaneousOperations-inl.h" // js::ResolveUnwrappedPromiseWithUndefined, js::SetSettledPromiseIsHandled diff --git a/js/src/debugger/Object.cpp b/js/src/debugger/Object.cpp index 0dfc20033d92..d1740b6d0cdd 100644 --- a/js/src/debugger/Object.cpp +++ b/js/src/debugger/Object.cpp @@ -33,38 +33,38 @@ #include "js/Conversions.h" // for ToObject #include "js/HeapAPI.h" // for IsInsideNursery #include "js/Promise.h" // for PromiseState -#include "js/Proxy.h" // for PropertyDescriptor -#include "js/StableStringChars.h" // for AutoStableStringChars -#include "proxy/ScriptedProxyHandler.h" // for ScriptedProxyHandler -#include "vm/ArgumentsObject.h" // for ARGS_LENGTH_MAX -#include "vm/ArrayObject.h" // for ArrayObject -#include "vm/AsyncFunction.h" // for AsyncGeneratorObject -#include "vm/AsyncIteration.h" // for AsyncFunctionGeneratorObject -#include "vm/BytecodeUtil.h" // for JSDVG_SEARCH_STACK -#include "vm/Compartment.h" // for Compartment -#include "vm/EnvironmentObject.h" // for GetDebugEnvironmentForFunction -#include "vm/ErrorObject.h" // for JSObject::is, ErrorObject -#include "vm/GeneratorObject.h" // for AbstractGeneratorObject -#include "vm/GlobalObject.h" // for JSObject::is, GlobalObject -#include "vm/Instrumentation.h" // for RealmInstrumentation -#include "vm/Interpreter.h" // for Call -#include "vm/JSAtom.h" // for Atomize, js_apply_str -#include "vm/JSContext.h" // for JSContext, ReportValueError -#include "vm/JSFunction.h" // for JSFunction -#include "vm/JSScript.h" // for JSScript -#include "vm/NativeObject.h" // for NativeObject, JSObject::is -#include "vm/ObjectGroup.h" // for GenericObject, NewObjectKind -#include "vm/ObjectOperations.h" // for DefineProperty -#include "vm/PromiseObject.h" // for js::PromiseObject -#include "vm/Realm.h" // for AutoRealm, ErrorCopier, Realm -#include "vm/Runtime.h" // for JSAtomState -#include "vm/SavedFrame.h" // for SavedFrame -#include "vm/Scope.h" // for PositionalFormalParameterIter -#include "vm/SelfHosting.h" // for GetClonedSelfHostedFunctionName -#include "vm/Shape.h" // for Shape -#include "vm/Stack.h" // for InvokeArgs -#include "vm/StringType.h" // for JSAtom, PropertyName -#include "vm/WrapperObject.h" // for JSObject::is, WrapperObject +#include "js/Proxy.h" // for PropertyDescriptor +#include "js/StableStringChars.h" // for AutoStableStringChars +#include "proxy/ScriptedProxyHandler.h" // for ScriptedProxyHandler +#include "vm/ArgumentsObject.h" // for ARGS_LENGTH_MAX +#include "vm/ArrayObject.h" // for ArrayObject +#include "vm/AsyncFunction.h" // for AsyncGeneratorObject +#include "vm/AsyncIteration.h" // for AsyncFunctionGeneratorObject +#include "vm/BytecodeUtil.h" // for JSDVG_SEARCH_STACK +#include "vm/Compartment.h" // for Compartment +#include "vm/EnvironmentObject.h" // for GetDebugEnvironmentForFunction +#include "vm/ErrorObject.h" // for JSObject::is, ErrorObject +#include "vm/GeneratorObject.h" // for AbstractGeneratorObject +#include "vm/GlobalObject.h" // for JSObject::is, GlobalObject +#include "vm/Instrumentation.h" // for RealmInstrumentation +#include "vm/Interpreter.h" // for Call +#include "vm/JSAtom.h" // for Atomize, js_apply_str +#include "vm/JSContext.h" // for JSContext, ReportValueError +#include "vm/JSFunction.h" // for JSFunction +#include "vm/JSScript.h" // for JSScript +#include "vm/NativeObject.h" // for NativeObject, JSObject::is +#include "vm/ObjectGroup.h" // for GenericObject, NewObjectKind +#include "vm/ObjectOperations.h" // for DefineProperty +#include "vm/PromiseObject.h" // for js::PromiseObject +#include "vm/Realm.h" // for AutoRealm, ErrorCopier, Realm +#include "vm/Runtime.h" // for JSAtomState +#include "vm/SavedFrame.h" // for SavedFrame +#include "vm/Scope.h" // for PositionalFormalParameterIter +#include "vm/SelfHosting.h" // for GetClonedSelfHostedFunctionName +#include "vm/Shape.h" // for Shape +#include "vm/Stack.h" // for InvokeArgs +#include "vm/StringType.h" // for JSAtom, PropertyName +#include "vm/WrapperObject.h" // for JSObject::is, WrapperObject #include "vm/Compartment-inl.h" // for Compartment::wrap #include "vm/JSAtom-inl.h" // for ValueToId diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index 3ea0695d8e09..2aa58c5f524c 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -162,7 +162,6 @@ class FreeSpan { * index calculation easier; see TenuredCell::indexInArena() for details. */ class Arena { - /* * The first span of free things in the arena. Most of these spans are * stored as offsets in free regions of the data array, and most operations diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index fcd344ce92b9..9e9a59b3ddac 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -901,7 +901,7 @@ static const JSStdName builtin_property_names[] = { static bool SkipUneval(JSContext* cx, jsid id) { return !cx->realm()->creationOptions().getToSourceEnabled() && - id == NameToId(cx->names().uneval); + id == NameToId(cx->names().uneval); } JS_PUBLIC_API bool JS_ResolveStandardClass(JSContext* cx, HandleObject obj, @@ -1156,7 +1156,8 @@ JS_PUBLIC_API JSProtoKey JS_IdToProtoKey(JSContext* cx, HandleId id) { return JSProto_Null; } - static_assert(mozilla::ArrayLength(standard_class_names) == JSProto_LIMIT + 1); + static_assert(mozilla::ArrayLength(standard_class_names) == + JSProto_LIMIT + 1); return static_cast(stdnm - standard_class_names); } diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 1545b1ebe8a5..a27f799b1cf0 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -1656,25 +1656,25 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx, * indirect goto (aka a threaded interpreter), which is technically * non-standard but is supported by all of our supported compilers. */ -# define INTERPRETER_LOOP() -# define CASE(OP) label_##OP: -# define DEFAULT() \ +#define INTERPRETER_LOOP() +#define CASE(OP) label_##OP: +#define DEFAULT() \ label_default: -# define DISPATCH_TO(OP) goto* addresses[(OP)] +#define DISPATCH_TO(OP) goto* addresses[(OP)] -# define LABEL(X) (&&label_##X) +#define LABEL(X) (&&label_##X) // Use addresses instead of offsets to optimize for runtime speed over // load-time relocation overhead. static const void* const addresses[EnableInterruptsPseudoOpcode + 1] = { -# define OPCODE_LABEL(op, ...) LABEL(op), +#define OPCODE_LABEL(op, ...) LABEL(op), FOR_EACH_OPCODE(OPCODE_LABEL) -# undef OPCODE_LABEL -# define TRAILING_LABEL(v) \ - ((v) == EnableInterruptsPseudoOpcode ? LABEL(EnableInterruptsPseudoOpcode) \ - : LABEL(default)), +#undef OPCODE_LABEL +#define TRAILING_LABEL(v) \ + ((v) == EnableInterruptsPseudoOpcode ? LABEL(EnableInterruptsPseudoOpcode) \ + : LABEL(default)), FOR_EACH_TRAILING_UNUSED_OPCODE(TRAILING_LABEL) -# undef TRAILING_LABEL +#undef TRAILING_LABEL }; /* diff --git a/js/src/vm/JSContext.cpp b/js/src/vm/JSContext.cpp index d793baf4dcde..1611535fd9e7 100644 --- a/js/src/vm/JSContext.cpp +++ b/js/src/vm/JSContext.cpp @@ -893,8 +893,8 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v, if (!reportScanStack) { JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, - JSMSG_CANT_CONVERT_TO, - NullOrUndefinedToCharZ(v), "object"); + JSMSG_CANT_CONVERT_TO, NullOrUndefinedToCharZ(v), + "object"); return; } @@ -938,8 +938,7 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v, if (!reportScanStack) { JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL, - keyStr.get(), - NullOrUndefinedToCharZ(v)); + keyStr.get(), NullOrUndefinedToCharZ(v)); return; } @@ -957,8 +956,8 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v, } JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, - JSMSG_PROPERTY_FAIL_EXPR, keyStr.get(), - bytes.get(), NullOrUndefinedToCharZ(v)); + JSMSG_PROPERTY_FAIL_EXPR, keyStr.get(), bytes.get(), + NullOrUndefinedToCharZ(v)); } bool js::ReportValueErrorFlags(JSContext* cx, unsigned flags, diff --git a/js/src/vm/ToSource.cpp b/js/src/vm/ToSource.cpp index 513ab52de240..fe8c15bc0b2b 100644 --- a/js/src/vm/ToSource.cpp +++ b/js/src/vm/ToSource.cpp @@ -14,11 +14,11 @@ #include "jsfriendapi.h" // CheckRecursionLimit -#include "builtin/Array.h" // ArrayToSource +#include "builtin/Array.h" // ArrayToSource #include "builtin/Boolean.h" // BooleanToString -#include "builtin/Object.h" // ObjectToSource -#include "gc/Allocator.h" // CanGC -#include "js/Symbol.h" // SymbolCode, JS::WellKnownSymbolLimit +#include "builtin/Object.h" // ObjectToSource +#include "gc/Allocator.h" // CanGC +#include "js/Symbol.h" // SymbolCode, JS::WellKnownSymbolLimit #include "js/TypeDecls.h" // Rooted{Function, Object, String, Value}, HandleValue, Latin1Char #include "js/Utility.h" // UniqueChars #include "js/Value.h" // JS::Value diff --git a/layout/base/nsCounterManager.cpp b/layout/base/nsCounterManager.cpp index a8aef08740cc..b09906b88cff 100644 --- a/layout/base/nsCounterManager.cpp +++ b/layout/base/nsCounterManager.cpp @@ -279,9 +279,9 @@ bool nsCounterManager::AddCounterChanges(nsIFrame* aFrame) { nsCounterList* nsCounterManager::CounterListFor(nsAtom* aCounterName) { MOZ_ASSERT(aCounterName); - return mNames.LookupForAdd(aCounterName).OrInsert([]() { - return new nsCounterList(); - }).get(); + return mNames.LookupForAdd(aCounterName) + .OrInsert([]() { return new nsCounterList(); }) + .get(); } void nsCounterManager::RecalcAll() { diff --git a/layout/base/nsCounterManager.h b/layout/base/nsCounterManager.h index dad63e7d1d05..e6ca7df45b5d 100644 --- a/layout/base/nsCounterManager.h +++ b/layout/base/nsCounterManager.h @@ -89,9 +89,8 @@ struct nsCounterUseNode : public nsCounterNode { } // args go directly to member variables here and of nsGenConNode - nsCounterUseNode(mozilla::CounterStylePtr aCounterStyle, - nsString aSeparator, uint32_t aContentIndex, - bool aAllCounters) + nsCounterUseNode(mozilla::CounterStylePtr aCounterStyle, nsString aSeparator, + uint32_t aContentIndex, bool aAllCounters) : nsCounterNode(aContentIndex, USE), mCounterStyle(std::move(aCounterStyle)), mSeparator(std::move(aSeparator)), diff --git a/layout/build/nsContentDLF.cpp b/layout/build/nsContentDLF.cpp index a8a152db16a9..1e49f0bf1431 100644 --- a/layout/build/nsContentDLF.cpp +++ b/layout/build/nsContentDLF.cpp @@ -37,11 +37,9 @@ using mozilla::dom::Document; already_AddRefed NS_NewContentViewer(); -static const char* const gHTMLTypes[] = {TEXT_HTML, - VIEWSOURCE_CONTENT_TYPE, +static const char* const gHTMLTypes[] = {TEXT_HTML, VIEWSOURCE_CONTENT_TYPE, APPLICATION_XHTML_XML, - APPLICATION_WAPXHTML_XML, - 0}; + APPLICATION_WAPXHTML_XML, 0}; static const char* const gXMLTypes[] = {TEXT_XML, APPLICATION_XML, diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h index be8e3c1e04e4..7c1ef13063c9 100644 --- a/layout/forms/nsTextControlFrame.h +++ b/layout/forms/nsTextControlFrame.h @@ -145,7 +145,7 @@ class nsTextControlFrame : public nsContainerFrame, //==== NSITEXTCONTROLFRAME MOZ_CAN_RUN_SCRIPT_BOUNDARY already_AddRefed - GetTextEditor() override; + GetTextEditor() override; MOZ_CAN_RUN_SCRIPT NS_IMETHOD SetSelectionRange(uint32_t aSelectionStart, uint32_t aSelectionEnd, SelectionDirection aDirection = eNone) override; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 7fdd7c4ff2ce..0e737ff5909d 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -9298,8 +9298,9 @@ static nsRect UnionBorderBoxes( // Iterate over all children except pop-up, absolutely-positioned, // float, and overflow ones. const nsIFrame::ChildListIDs skip = { - nsIFrame::kPopupList, nsIFrame::kSelectPopupList, nsIFrame::kAbsoluteList, - nsIFrame::kFixedList, nsIFrame::kFloatList, nsIFrame::kOverflowList}; + nsIFrame::kPopupList, nsIFrame::kSelectPopupList, + nsIFrame::kAbsoluteList, nsIFrame::kFixedList, + nsIFrame::kFloatList, nsIFrame::kOverflowList}; for (nsIFrame::ChildListIterator childLists(aFrame); !childLists.IsDone(); childLists.Next()) { if (skip.contains(childLists.CurrentID())) { diff --git a/layout/style/CSSFontFaceRule.h b/layout/style/CSSFontFaceRule.h index 55039546fdfc..167c40bda28f 100644 --- a/layout/style/CSSFontFaceRule.h +++ b/layout/style/CSSFontFaceRule.h @@ -22,7 +22,8 @@ class CSSFontFaceRuleDecl final : public nsICSSDeclaration { NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER nsINode* GetParentObject() final; - void IndexedGetter(uint32_t aIndex, bool& aFound, nsACString& aPropName) final; + void IndexedGetter(uint32_t aIndex, bool& aFound, + nsACString& aPropName) final; void GetPropertyValue(nsCSSFontDesc aFontDescID, nsAString& aResult) const; diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 326d9c904169..945e56445d03 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -626,7 +626,8 @@ static void AddImageURL(const nsStyleImageRequest& aRequest, AddImageURL(aRequest.GetImageValue(), aURLs); } -static void AddImageURL(const nsStyleImage& aImage, nsTArray& aURLs) { +static void AddImageURL(const nsStyleImage& aImage, + nsTArray& aURLs) { if (auto* urlValue = aImage.GetURLValue()) { AddImageURL(*urlValue, aURLs); } @@ -1562,7 +1563,7 @@ already_AddRefed nsComputedDOMStyle::GetGridTemplateColumnsRows( } const bool serializeImplicit = - StaticPrefs::layout_css_serialize_grid_implicit_tracks(); + StaticPrefs::layout_css_serialize_grid_implicit_tracks(); const nsTArray& trackSizes = aTrackInfo.mSizes; const uint32_t numExplicitTracks = aTrackInfo.mNumExplicitTracks; @@ -1571,7 +1572,8 @@ already_AddRefed nsComputedDOMStyle::GetGridTemplateColumnsRows( uint32_t numSizes = trackSizes.Length(); MOZ_ASSERT(numSizes >= numLeadingImplicitTracks + numExplicitTracks); - const bool hasTracksToSerialize = serializeImplicit ? !!numSizes : !!numExplicitTracks; + const bool hasTracksToSerialize = + serializeImplicit ? !!numSizes : !!numExplicitTracks; const bool hasRepeatAuto = aTrackList.HasRepeatAuto(); if (!hasTracksToSerialize && !hasRepeatAuto) { RefPtr val = new nsROCSSPrimitiveValue; @@ -1693,8 +1695,8 @@ already_AddRefed nsComputedDOMStyle::GetGridTemplateColumnsRows( // Add any trailing implicit tracks. if (serializeImplicit) { - for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks; i < numSizes; - ++i) { + for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks; + i < numSizes; ++i) { RefPtr val = new nsROCSSPrimitiveValue; val->SetAppUnits(trackSizes[i]); valueList->AppendCSSValue(val.forget()); diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 80a5c86b1a6f..0b27bd9d8514 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -74,7 +74,8 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, const nsACString& aValue, nsIPrincipal* aSubjectPrincipal) override; - void IndexedGetter(uint32_t aIndex, bool& aFound, nsACString& aPropName) final; + void IndexedGetter(uint32_t aIndex, bool& aFound, + nsACString& aPropName) final; enum StyleType { eDefaultOnly, // Only includes UA and user sheets diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 1bdc4a9627ab..53d778006d3e 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -328,8 +328,9 @@ nsresult nsDOMCSSDeclaration::ParseCustomPropertyValue( aSubjectPrincipal, &closureData, [&](DeclarationBlock* decl, ParsingEnvironment& env) { return Servo_DeclarationBlock_SetProperty( - decl->Raw(), &aPropertyName, &aPropValue, aIsImportant, env.mUrlExtraData, - ParsingMode::Default, env.mCompatMode, env.mLoader, closure); + decl->Raw(), &aPropertyName, &aPropValue, aIsImportant, + env.mUrlExtraData, ParsingMode::Default, env.mCompatMode, + env.mLoader, closure); }); } diff --git a/layout/style/nsICSSDeclaration.h b/layout/style/nsICSSDeclaration.h index fdc92e30df44..01113135289c 100644 --- a/layout/style/nsICSSDeclaration.h +++ b/layout/style/nsICSSDeclaration.h @@ -118,7 +118,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSDeclaration, NS_ICSSDECLARATION_IID) void GetPropertyPriority(const nsACString& propertyName, \ nsAString& aPriority) override; \ NS_IMETHOD SetProperty(const nsACString& propertyName, \ - const nsACString& value, const nsAString& priority, \ + const nsACString& value, const nsAString& priority, \ nsIPrincipal* aSubjectPrincipal = nullptr) override; \ uint32_t Length() override; \ mozilla::css::Rule* GetParentRule() override; diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index 8b4382ce4013..b5a5297e2a05 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -89,8 +89,8 @@ enum class StyleDisplay : uint16_t { /// XUL boxes. MozBox = StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox), - MozInlineBox = StyleDisplayFrom(StyleDisplayOutside::Inline, - StyleDisplayInside::MozBox), + MozInlineBox = + StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox), MozGrid = StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozGrid), MozGridGroup = StyleDisplayFrom(StyleDisplayOutside::XUL, diff --git a/mfbt/Utf8.h b/mfbt/Utf8.h index d7d76e0c0e55..06dedfebd59f 100644 --- a/mfbt/Utf8.h +++ b/mfbt/Utf8.h @@ -12,10 +12,10 @@ #ifndef mozilla_Utf8_h #define mozilla_Utf8_h -#include "mozilla/Casting.h" // for mozilla::AssertedCast -#include "mozilla/Likely.h" // for MOZ_UNLIKELY -#include "mozilla/Maybe.h" // for mozilla::Maybe -#include "mozilla/Span.h" // for mozilla::Span +#include "mozilla/Casting.h" // for mozilla::AssertedCast +#include "mozilla/Likely.h" // for MOZ_UNLIKELY +#include "mozilla/Maybe.h" // for mozilla::Maybe +#include "mozilla/Span.h" // for mozilla::Span #include "mozilla/TextUtils.h" // for mozilla::IsAscii and via Latin1.h for // encoding_rs_mem.h and MOZ_HAS_JSRUST. #include "mozilla/Tuple.h" // for mozilla::Tuple diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index cc29e4f946a9..964a79fba77b 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -2733,8 +2733,8 @@ nsPrefBranch::RemoveObserverImpl(const nsACString& aDomain, mozilla::UniquePtr pCallback; mObservers.Remove(&key, &pCallback); if (pCallback) { - rv = Preferences::UnregisterCallback(NotifyObserver, prefName, pCallback.get(), - Preferences::PrefixMatch); + rv = Preferences::UnregisterCallback( + NotifyObserver, prefName, pCallback.get(), Preferences::PrefixMatch); } return rv; diff --git a/mozglue/tests/interceptor/TestIATPatcher.cpp b/mozglue/tests/interceptor/TestIATPatcher.cpp index 8abf8920d745..4dfb81ee9d24 100644 --- a/mozglue/tests/interceptor/TestIATPatcher.cpp +++ b/mozglue/tests/interceptor/TestIATPatcher.cpp @@ -11,9 +11,7 @@ #include -static int NormalImport() { - return ::GetSystemMetrics(SM_CYCAPTION); -} +static int NormalImport() { return ::GetSystemMetrics(SM_CYCAPTION); } static bool DelayLoadImport() { return !!::UrlIsW(L"http://example.com/", URLIS_FILEURL); diff --git a/netwerk/cache2/CacheFile.cpp b/netwerk/cache2/CacheFile.cpp index 1dddb2585775..8aa249175d78 100644 --- a/netwerk/cache2/CacheFile.cpp +++ b/netwerk/cache2/CacheFile.cpp @@ -1216,8 +1216,8 @@ nsresult CacheFile::SetNetworkTimes(uint64_t aOnStartTime, aOnStopTime <= kIndexTimeOutOfBound ? aOnStopTime : kIndexTimeOutOfBound; if (mHandle && !mHandle->IsDoomed()) { - CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, nullptr, - &onStartTime16, &onStopTime16, nullptr); + CacheFileIOManager::UpdateIndexEntry( + mHandle, nullptr, nullptr, &onStartTime16, &onStopTime16, nullptr); } return NS_OK; } @@ -2539,9 +2539,8 @@ nsresult CacheFile::InitIndexEntry() { contentType = n64; } - rv = CacheFileIOManager::UpdateIndexEntry(mHandle, &frecency, &hasAltData, - &onStartTime, &onStopTime, - &contentType); + rv = CacheFileIOManager::UpdateIndexEntry( + mHandle, &frecency, &hasAltData, &onStartTime, &onStopTime, &contentType); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp index 606e0c4eb2a2..80a94a0a700a 100644 --- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -1033,13 +1033,12 @@ class UpdateIndexEntryEvent : public Runnable { return NS_OK; } - CacheIndex::UpdateEntry( - mHandle->Hash(), mHasFrecency ? &mFrecency : nullptr, - mHasHasAltData ? &mHasAltData : nullptr, - mHasOnStartTime ? &mOnStartTime : nullptr, - mHasOnStopTime ? &mOnStopTime : nullptr, - mHasContentType ? &mContentType : nullptr, - nullptr); + CacheIndex::UpdateEntry(mHandle->Hash(), + mHasFrecency ? &mFrecency : nullptr, + mHasHasAltData ? &mHasAltData : nullptr, + mHasOnStartTime ? &mOnStartTime : nullptr, + mHasOnStopTime ? &mOnStopTime : nullptr, + mHasContentType ? &mContentType : nullptr, nullptr); return NS_OK; } @@ -3517,10 +3516,12 @@ nsresult CacheFileIOManager::InitIndexEntry(CacheFileHandle* aHandle, } // static -nsresult CacheFileIOManager::UpdateIndexEntry( - CacheFileHandle* aHandle, const uint32_t* aFrecency, - const bool* aHasAltData, const uint16_t* aOnStartTime, - const uint16_t* aOnStopTime, const uint8_t* aContentType) { +nsresult CacheFileIOManager::UpdateIndexEntry(CacheFileHandle* aHandle, + const uint32_t* aFrecency, + const bool* aHasAltData, + const uint16_t* aOnStartTime, + const uint16_t* aOnStopTime, + const uint8_t* aContentType) { LOG( ("CacheFileIOManager::UpdateIndexEntry() [handle=%p, frecency=%s, " "hasAltData=%s, onStartTime=%s, onStopTime=%s, contentType=%s]", diff --git a/netwerk/cache2/CacheIndex.cpp b/netwerk/cache2/CacheIndex.cpp index b6e1de143546..3df871c27afb 100644 --- a/netwerk/cache2/CacheIndex.cpp +++ b/netwerk/cache2/CacheIndex.cpp @@ -925,11 +925,13 @@ nsresult CacheIndex::RemoveEntry(const SHA1Sum::Hash* aHash) { } // static -nsresult CacheIndex::UpdateEntry( - const SHA1Sum::Hash* aHash, const uint32_t* aFrecency, - const bool* aHasAltData, const uint16_t* aOnStartTime, - const uint16_t* aOnStopTime, const uint8_t* aContentType, - const uint32_t* aSize) { +nsresult CacheIndex::UpdateEntry(const SHA1Sum::Hash* aHash, + const uint32_t* aFrecency, + const bool* aHasAltData, + const uint16_t* aOnStartTime, + const uint16_t* aOnStopTime, + const uint8_t* aContentType, + const uint32_t* aSize) { LOG( ("CacheIndex::UpdateEntry() [hash=%08x%08x%08x%08x%08x, " "frecency=%s, hasAltData=%s, onStartTime=%s, onStopTime=%s, " @@ -976,9 +978,8 @@ nsresult CacheIndex::UpdateEntry( return NS_ERROR_UNEXPECTED; } - if (!HasEntryChanged( - entry, aFrecency, aHasAltData, aOnStartTime, aOnStopTime, - aContentType, aSize)) { + if (!HasEntryChanged(entry, aFrecency, aHasAltData, aOnStartTime, + aOnStopTime, aContentType, aSize)) { return NS_OK; } diff --git a/netwerk/cache2/CacheIndex.h b/netwerk/cache2/CacheIndex.h index 491726fb1e69..9c9a0a543850 100644 --- a/netwerk/cache2/CacheIndex.h +++ b/netwerk/cache2/CacheIndex.h @@ -682,11 +682,13 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable { // MUST be initialized. Call to AddEntry() or EnsureEntryExists() and to // InitEntry() must precede the call to this method. // Pass nullptr if the value didn't change. - static nsresult UpdateEntry( - const SHA1Sum::Hash* aHash, const uint32_t* aFrecency, - const bool* aHasAltData, const uint16_t* aOnStartTime, - const uint16_t* aOnStopTime, const uint8_t* aContentType, - const uint32_t* aSize); + static nsresult UpdateEntry(const SHA1Sum::Hash* aHash, + const uint32_t* aFrecency, + const bool* aHasAltData, + const uint16_t* aOnStartTime, + const uint16_t* aOnStopTime, + const uint8_t* aContentType, + const uint32_t* aSize); // Remove all entries from the index. Called when clearing the whole cache. static nsresult RemoveAll(); @@ -789,11 +791,13 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable { OriginAttrsHash aOriginAttrsHash, bool aAnonymous); // Checks whether any of the information about the entry has changed. - static bool HasEntryChanged( - CacheIndexEntry* aEntry, const uint32_t* aFrecency, - const bool* aHasAltData, const uint16_t* aOnStartTime, - const uint16_t* aOnStopTime, const uint8_t* aContentType, - const uint32_t* aSize); + static bool HasEntryChanged(CacheIndexEntry* aEntry, + const uint32_t* aFrecency, + const bool* aHasAltData, + const uint16_t* aOnStartTime, + const uint16_t* aOnStopTime, + const uint8_t* aContentType, + const uint32_t* aSize); // Merge all pending operations from mPendingUpdates into mIndex. void ProcessPendingOperations(); diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp index 32aef485c02e..4888416d6a4a 100644 --- a/netwerk/protocol/http/Http3Session.cpp +++ b/netwerk/protocol/http/Http3Session.cpp @@ -453,8 +453,7 @@ nsresult Http3Session::ProcessOutputAndEvents() { void Http3Session::SetupTimer(uint64_t aTimeout) { MOZ_ASSERT(OnSocketThread(), "not on socket thread"); - LOG(("Http3Session::SetupTimer to %" PRIu64 "ms [this=%p].", aTimeout, - this)); + LOG(("Http3Session::SetupTimer to %" PRIu64 "ms [this=%p].", aTimeout, this)); if (!mTimer) { mTimer = NS_NewTimer(); } diff --git a/netwerk/protocol/http/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h index e69c8dda23f4..f60a0a6407f7 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.h +++ b/netwerk/protocol/http/nsHttpAuthCache.h @@ -148,7 +148,8 @@ class nsHttpAuthNode { nsTArray > mList; friend class nsHttpAuthCache; - friend class mozilla::DefaultDelete; // needs to call the destructor + friend class mozilla::DefaultDelete; // needs to call the + // destructor }; //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index 9d89061bfc74..2f38c57a4402 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -772,6 +772,7 @@ class nsHttpHandler final : public nsIHttpProtocolHandler, TimeStamp mLastActiveTabLoadOptimizationHit; Mutex mSpdyBlacklistLock; + public: MOZ_MUST_USE nsresult NewChannelId(uint64_t& channelId); diff --git a/parser/htmlparser/nsExpatDriver.cpp b/parser/htmlparser/nsExpatDriver.cpp index 3a49470db65c..fe2c2d21b21f 100644 --- a/parser/htmlparser/nsExpatDriver.cpp +++ b/parser/htmlparser/nsExpatDriver.cpp @@ -281,8 +281,9 @@ void nsExpatDriver::HandleStartElement(void* aUserData, const char16_t* aName, if (self->mSink) { // We store the tagdepth in a PRUint16, so make sure the limit fits in a // PRUint16. - static_assert(sMaxXMLTreeDepth <= - std::numeric_limits::max()); + static_assert( + sMaxXMLTreeDepth <= + std::numeric_limits::max()); if (++self->mTagDepth > sMaxXMLTreeDepth) { self->MaybeStopParser(NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP); diff --git a/toolkit/recordreplay/Assembler.cpp b/toolkit/recordreplay/Assembler.cpp index 1f575b0462f5..9078e6f4a0ad 100644 --- a/toolkit/recordreplay/Assembler.cpp +++ b/toolkit/recordreplay/Assembler.cpp @@ -14,8 +14,7 @@ namespace mozilla { namespace recordreplay { Assembler::Assembler(uint8_t* aStorage, size_t aSize) - : mCursor(aStorage), - mCursorEnd(aStorage + aSize) {} + : mCursor(aStorage), mCursorEnd(aStorage + aSize) {} // The maximum byte length of an x86/x64 instruction. static const size_t MaximumInstructionLength = 15; @@ -25,9 +24,7 @@ void Assembler::Advance(size_t aSize) { MOZ_RELEASE_ASSERT(mCursor + MaximumInstructionLength <= mCursorEnd); } -uint8_t* Assembler::Current() { - return mCursor; -} +uint8_t* Assembler::Current() { return mCursor; } void Assembler::Jump(void* aTarget) { PushImmediate(aTarget); @@ -53,13 +50,9 @@ void Assembler::Push16(uint16_t aValue) { Advance(4); } -void Assembler::Return() { - NewInstruction(0xC3); -} +void Assembler::Return() { NewInstruction(0xC3); } -void Assembler::Breakpoint() { - NewInstruction(0xCC); -} +void Assembler::Breakpoint() { NewInstruction(0xCC); } void Assembler::PushRax() { NewInstruction(0x50); } @@ -91,7 +84,8 @@ void Assembler::MoveRaxToRegister(Register aRegister) { void Assembler::MoveRegisterToRax(Register aRegister) { if (aRegister <= Register::RDI) { - NewInstruction(0x48, 0x89, 0xC0 + ((int)aRegister - (int)Register::RAX) * 8); + NewInstruction(0x48, 0x89, + 0xC0 + ((int)aRegister - (int)Register::RAX) * 8); } else { NewInstruction(0x4C, 0x89, 0xC0 + ((int)aRegister - (int)Register::R8) * 8); } diff --git a/toolkit/recordreplay/Assembler.h b/toolkit/recordreplay/Assembler.h index 5ba5634f57cc..27976fc93cdc 100644 --- a/toolkit/recordreplay/Assembler.h +++ b/toolkit/recordreplay/Assembler.h @@ -16,7 +16,22 @@ namespace recordreplay { // x86-64 general purpose registers. enum class Register { - RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15, + RAX, + RCX, + RDX, + RBX, + RSP, + RBP, + RSI, + RDI, + R8, + R9, + R10, + R11, + R12, + R13, + R14, + R15, }; // Assembler for x64 instructions. This is a simple assembler that is primarily diff --git a/toolkit/recordreplay/ExternalCall.cpp b/toolkit/recordreplay/ExternalCall.cpp index c65b56445e77..a4633232e2e2 100644 --- a/toolkit/recordreplay/ExternalCall.cpp +++ b/toolkit/recordreplay/ExternalCall.cpp @@ -95,7 +95,8 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) { } if (aDiverged) { - PrintSpew("OnExternalCall Diverged %s %s\n", redirection.mName, messageName); + PrintSpew("OnExternalCall Diverged %s %s\n", redirection.mName, + messageName); } MonitorAutoLock lock(*gMonitor); @@ -106,8 +107,7 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) { // Save all the call's inputs. { - ExternalCallContext cx(call, aArguments, - ExternalCallPhase::SaveInput); + ExternalCallContext cx(call, aArguments, ExternalCallPhase::SaveInput); redirection.mExternalCall(cx); if (cx.mFailed) { delete call; @@ -145,8 +145,7 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) { // we need. Run the SaveOutput phase to capture these so that we can reuse // them later and associate any system outputs with the call. if (!aDiverged) { - ExternalCallContext cx(call, aArguments, - ExternalCallPhase::SaveOutput); + ExternalCallContext cx(call, aArguments, ExternalCallPhase::SaveOutput); redirection.mExternalCall(cx); if (isNewCall) { gUnflushedCalls.append(call); @@ -169,9 +168,8 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) { // Synchronously wait for the call result. InfallibleVector outputData; - child::SendExternalCallRequest(call->mId, - inputData.begin(), inputData.length(), - &outputData); + child::SendExternalCallRequest(call->mId, inputData.begin(), + inputData.length(), &outputData); // Decode the external call's output. BufferStream outputStream(outputData.begin(), outputData.length()); @@ -416,9 +414,9 @@ void EX_SystemOutput(ExternalCallContext& aCx, const void** aOutput, break; } // If we haven't encountered the aliased call, fall through and generate - // a new value for it. Aliases might be spurious if they were derived from - // the recording and reflect a value that was released and had its memory - // reused. + // a new value for it. Aliases might be spurious if they were derived + // from the recording and reflect a value that was released and had its + // memory reused. } *aOutput = MangledSystemValue(aCx.mCall->mId); } while (false); diff --git a/toolkit/recordreplay/ExternalCall.h b/toolkit/recordreplay/ExternalCall.h index fffdd0d3fd54..39ee2f40b39a 100644 --- a/toolkit/recordreplay/ExternalCall.h +++ b/toolkit/recordreplay/ExternalCall.h @@ -170,9 +170,7 @@ struct ExternalCallContext { ExternalCallContext(ExternalCall* aCall, CallArguments* aArguments, ExternalCallPhase aPhase) - : mCall(aCall), - mArguments(aArguments), - mPhase(aPhase) { + : mCall(aCall), mArguments(aArguments), mPhase(aPhase) { switch (mPhase) { case ExternalCallPhase::SaveInput: mInputStream.emplace(&mCall->mInput); @@ -218,7 +216,8 @@ struct ExternalCallContext { bool AccessInput() { return mInputStream.isSome(); } - void ReadOrWriteInputBytes(void* aBuffer, size_t aSize, bool aExcludeInput = false) { + void ReadOrWriteInputBytes(void* aBuffer, size_t aSize, + bool aExcludeInput = false) { switch (mPhase) { case ExternalCallPhase::SaveInput: // Only one buffer can be excluded, and it has to be the last input to @@ -298,8 +297,7 @@ struct ExternalCallContext { // any outputs for the call must be filled in; otherwise, they already have // been filled in using data from the recording. Returns false if the call was // unable to be processed. -bool OnExternalCall(size_t aCallId, CallArguments* aArguments, - bool aDiverged); +bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged); // In the external process, perform one or more calls encoded in aInputData // and encode the output of the final call in aOutputData. @@ -375,9 +373,8 @@ template static inline void EX_CString(ExternalCallContext& aCx) { if (aCx.AccessInput()) { auto& buffer = aCx.mArguments->Arg(); - size_t len = (aCx.mPhase == ExternalCallPhase::SaveInput) - ? strlen(buffer) + 1 - : 0; + size_t len = + (aCx.mPhase == ExternalCallPhase::SaveInput) ? strlen(buffer) + 1 : 0; aCx.ReadOrWriteInputBytes(&len, sizeof(len)); aCx.ReadOrWriteInputBuffer((void**)&buffer, len); } @@ -425,9 +422,9 @@ static inline void EX_SkipExecuting(ExternalCallContext& aCx) { static inline void EX_NoOp(ExternalCallContext& aCx) {} -template +template static inline void EX_Compose(ExternalCallContext& aCx) { Fn0(aCx); Fn1(aCx); diff --git a/toolkit/recordreplay/ProcessRecordReplay.cpp b/toolkit/recordreplay/ProcessRecordReplay.cpp index 20094e466248..90e961b4a465 100644 --- a/toolkit/recordreplay/ProcessRecordReplay.cpp +++ b/toolkit/recordreplay/ProcessRecordReplay.cpp @@ -231,18 +231,21 @@ MOZ_EXPORT void RecordReplayInterface_InternalInvalidateRecording( Unreachable(); } -MOZ_EXPORT void RecordReplayInterface_InternalBeginPassThroughThreadEventsWithLocalReplay() { +MOZ_EXPORT void +RecordReplayInterface_InternalBeginPassThroughThreadEventsWithLocalReplay() { if (IsReplaying() && !gReplayingInCloud) { BeginPassThroughThreadEvents(); } } -MOZ_EXPORT void RecordReplayInterface_InternalEndPassThroughThreadEventsWithLocalReplay() { +MOZ_EXPORT void +RecordReplayInterface_InternalEndPassThroughThreadEventsWithLocalReplay() { // If we are replaying locally we will be skipping over a section of the // recording while events are passed through. Include the current stream // position in the recording so that we will know how much to skip over. MOZ_RELEASE_ASSERT(Thread::CurrentIsMainThread()); - Stream* localReplayStream = gRecording->OpenStream(StreamName::LocalReplaySkip, 0); + Stream* localReplayStream = + gRecording->OpenStream(StreamName::LocalReplaySkip, 0); Stream& events = Thread::Current()->Events(); size_t position = IsRecording() ? events.StreamPosition() : 0; @@ -279,9 +282,10 @@ void FlushRecording() { gRecording->AllowStreamWrites(); if (gRecording->Size() > gRecordingDataSentToMiddleman) { - child::SendRecordingData(gRecordingDataSentToMiddleman, - gRecording->Data() + gRecordingDataSentToMiddleman, - gRecording->Size() - gRecordingDataSentToMiddleman); + child::SendRecordingData( + gRecordingDataSentToMiddleman, + gRecording->Data() + gRecordingDataSentToMiddleman, + gRecording->Size() - gRecordingDataSentToMiddleman); gRecordingDataSentToMiddleman = gRecording->Size(); } } @@ -484,13 +488,13 @@ static void CrashDetectorThread(void*) { request.body.exception == EXC_BAD_ACCESS && request.body.codeCnt == 2) { uint8_t* faultingAddress = (uint8_t*)request.body.code[1]; child::MinidumpInfo info(request.body.exception, request.body.code[0], - request.body.code[1], - request.body.thread.name, + request.body.code[1], request.body.thread.name, request.body.task.name); child::ReportCrash(info, faultingAddress); } else { - child::ReportFatalError("CrashDetectorThread mach_msg " - "returned unexpected data"); + child::ReportFatalError( + "CrashDetectorThread mach_msg " + "returned unexpected data"); } __Reply__exception_raise_t reply; diff --git a/toolkit/recordreplay/ProcessRedirect.cpp b/toolkit/recordreplay/ProcessRedirect.cpp index 3c3d9ff465ae..5ba7d87db6c5 100644 --- a/toolkit/recordreplay/ProcessRedirect.cpp +++ b/toolkit/recordreplay/ProcessRedirect.cpp @@ -305,16 +305,19 @@ uint8_t* GenerateRedirectStub(Assembler& aAssembler, size_t aCallId, uint8_t* newFunction = aAssembler.Current(); if (aPreserveCallerSaveRegisters) { static Register registers[] = { - Register::RDI, Register::RDI /* for alignment */, - Register::RSI, Register::RDX, Register::RCX, - Register::R8, Register::R9, Register::R10, Register::R11, + Register::RDI, Register::RDI /* for alignment */, + Register::RSI, Register::RDX, + Register::RCX, Register::R8, + Register::R9, Register::R10, + Register::R11, }; for (size_t i = 0; i < ArrayLength(registers); i++) { aAssembler.MoveRegisterToRax(registers[i]); aAssembler.PushRax(); } aAssembler.MoveImmediateToRax((void*)aCallId); - uint8_t* after = aAssembler.Current() + Assembler::PushImmediateBytes + Assembler::JumpBytes; + uint8_t* after = aAssembler.Current() + Assembler::PushImmediateBytes + + Assembler::JumpBytes; aAssembler.PushImmediate(after); aAssembler.Jump(BitwiseCast(RecordReplayRedirectCall)); for (int i = ArrayLength(registers) - 1; i >= 0; i--) { diff --git a/toolkit/recordreplay/ProcessRedirect.h b/toolkit/recordreplay/ProcessRedirect.h index ab0b3c6d5895..180570570602 100644 --- a/toolkit/recordreplay/ProcessRedirect.h +++ b/toolkit/recordreplay/ProcessRedirect.h @@ -89,19 +89,19 @@ struct CallArguments { static const size_t NumStackArguments = 64; protected: - size_t arg0; // 0 - size_t arg1; // 8 - size_t arg2; // 16 - size_t arg3; // 24 - size_t arg4; // 32 - size_t arg5; // 40 - double floatarg0; // 48 - double floatarg1; // 56 - double floatarg2; // 64 - size_t rval0; // 72 - size_t rval1; // 80 - double floatrval0; // 88 - double floatrval1; // 96 + size_t arg0; // 0 + size_t arg1; // 8 + size_t arg2; // 16 + size_t arg3; // 24 + size_t arg4; // 32 + size_t arg5; // 40 + double floatarg0; // 48 + double floatarg1; // 56 + double floatarg2; // 64 + size_t rval0; // 72 + size_t rval1; // 80 + double floatrval0; // 88 + double floatrval1; // 96 size_t stack[NumStackArguments]; // 104 // Size: 616 diff --git a/toolkit/recordreplay/ProcessRedirectDarwin.cpp b/toolkit/recordreplay/ProcessRedirectDarwin.cpp index d47075db1b5a..de4dcb301c28 100644 --- a/toolkit/recordreplay/ProcessRedirectDarwin.cpp +++ b/toolkit/recordreplay/ProcessRedirectDarwin.cpp @@ -248,7 +248,7 @@ static void EX_ObjCInput(ExternalCallContext& aCx, id* aThingPtr) { MOZ_RELEASE_ASSERT(cstring.get()[len - 1] == 0); void* ptr = dlsym(RTLD_DEFAULT, cstring.get() + strlen(cloudPrefix)); MOZ_RELEASE_ASSERT(ptr); - *aThingPtr = (id)*(CFStringRef*)ptr; + *aThingPtr = (id) * (CFStringRef*)ptr; break; } @@ -303,7 +303,7 @@ static void EX_CFTypeOutputArg(ExternalCallContext& aCx) { auto& arg = aCx.mArguments->Arg(); if (aCx.mPhase == ExternalCallPhase::RestoreInput) { - arg = (const void**) aCx.AllocateBytes(sizeof(const void*)); + arg = (const void**)aCx.AllocateBytes(sizeof(const void*)); } EX_CFTypeOutput(aCx, arg, /* aOwnsReference = */ false); @@ -324,9 +324,8 @@ static void EX_AutoreleaseCFTypeRval(ExternalCallContext& aCx) { if (rval && aCx.mPhase == ExternalCallPhase::SaveOutput && !IsReplaying()) { SendMessageToObject(rval, "retain"); - aCx.mReleaseCallbacks->append([=]() { - SendMessageToObject(rval, "autorelease"); - }); + aCx.mReleaseCallbacks->append( + [=]() { SendMessageToObject(rval, "autorelease"); }); } } @@ -348,29 +347,30 @@ static PreambleResult Preamble_SetError(CallArguments* aArguments) { return PreambleResult::Veto; } -#define ForEachFixedInputAddress(Macro) \ - Macro(kCFTypeArrayCallBacks) \ - Macro(kCFTypeDictionaryKeyCallBacks) \ - Macro(kCFTypeDictionaryValueCallBacks) +#define ForEachFixedInputAddress(Macro) \ + Macro(kCFTypeArrayCallBacks) Macro(kCFTypeDictionaryKeyCallBacks) \ + Macro(kCFTypeDictionaryValueCallBacks) -#define ForEachFixedInput(Macro) \ - Macro(kCFAllocatorDefault) \ - Macro(kCFAllocatorNull) +#define ForEachFixedInput(Macro) \ + Macro(kCFAllocatorDefault) Macro(kCFAllocatorNull) enum class FixedInput { #define DefineEnum(Name) Name, - ForEachFixedInputAddress(DefineEnum) - ForEachFixedInput(DefineEnum) + ForEachFixedInputAddress(DefineEnum) ForEachFixedInput(DefineEnum) #undef DefineEnum }; static const void* GetFixedInput(FixedInput aWhich) { switch (aWhich) { -#define FetchEnumAddress(Name) case FixedInput::Name: return &Name; +#define FetchEnumAddress(Name) \ + case FixedInput::Name: \ + return &Name; ForEachFixedInputAddress(FetchEnumAddress) #undef FetchEnumAddress -#define FetchEnum(Name) case FixedInput::Name: return Name; - ForEachFixedInput(FetchEnum) +#define FetchEnum(Name) \ + case FixedInput::Name: \ + return Name; + ForEachFixedInput(FetchEnum) #undef FetchEnum } MOZ_CRASH("Unknown fixed input"); @@ -384,9 +384,9 @@ static void EX_RequireFixed(ExternalCallContext& aCx) { if (aCx.AccessInput()) { const void* value = GetFixedInput(Which); if (aCx.mPhase == ExternalCallPhase::SaveInput) { - MOZ_RELEASE_ASSERT(arg == value || - (Which == FixedInput::kCFAllocatorDefault && - arg == nullptr)); + MOZ_RELEASE_ASSERT( + arg == value || + (Which == FixedInput::kCFAllocatorDefault && arg == nullptr)); } else { arg = value; } @@ -473,7 +473,7 @@ static void RR_open(Stream& aEvents, CallArguments* aArguments, } static void RR_close(Stream& aEvents, CallArguments* aArguments, - ErrorType* aError) { + ErrorType* aError) { RR_SaveRvalHadErrorNegative(aEvents, aArguments, aError); if (IsRecording()) { @@ -552,9 +552,8 @@ static PreambleResult Preamble_mmap(CallArguments* aArguments) { size_t hash = RecordReplayValue(0); int fd = DirectOpenFile(path.get(), /* aWriting */ false); - void* fileContents = CallFunction(gOriginal_mmap, nullptr, size, - PROT_READ, MAP_PRIVATE, - fd, offset); + void* fileContents = CallFunction( + gOriginal_mmap, nullptr, size, PROT_READ, MAP_PRIVATE, fd, offset); MOZ_RELEASE_ASSERT(fileContents != MAP_FAILED); memcpy(memory, fileContents, size); @@ -730,8 +729,7 @@ static ssize_t WaitForCvar(pthread_mutex_t* aMutex, pthread_cond_t* aCond, if (!lock) { if (IsReplaying() && !AreThreadEventsPassedThrough()) { Thread* thread = Thread::Current(); - if (thread->MaybeWaitForFork( - [=]() { pthread_mutex_unlock(aMutex); })) { + if (thread->MaybeWaitForFork([=]() { pthread_mutex_unlock(aMutex); })) { // We unlocked the mutex while the thread idled, so don't wait on the // condvar: the state the thread is waiting on may have changed and it // might not want to continue waiting. Returning immediately means this @@ -978,31 +976,30 @@ static PreambleResult Preamble_pthread_self(CallArguments* aArguments) { return PreambleResult::PassThrough; } -static void* -GetTLVTemplate(void* aPtr, size_t* aSize) { +static void* GetTLVTemplate(void* aPtr, size_t* aSize) { uint8_t* tlvTemplate = nullptr; *aSize = 0; Dl_info info; dladdr(aPtr, &info); - mach_header_64* header = (mach_header_64*) info.dli_fbase; + mach_header_64* header = (mach_header_64*)info.dli_fbase; MOZ_RELEASE_ASSERT(header->magic == MH_MAGIC_64); uint32_t offset = sizeof(mach_header_64); for (size_t i = 0; i < header->ncmds; i++) { - load_command* cmd = (load_command*) ((uint8_t*)header + offset); + load_command* cmd = (load_command*)((uint8_t*)header + offset); if (LC_SEGMENT_64 == (cmd->cmd & ~LC_REQ_DYLD)) { - segment_command_64* ncmd = (segment_command_64*) cmd; - section_64* sect = (section_64*) (ncmd + 1); + segment_command_64* ncmd = (segment_command_64*)cmd; + section_64* sect = (section_64*)(ncmd + 1); for (size_t i = 0; i < ncmd->nsects; i++, sect++) { switch (sect->flags & SECTION_TYPE) { - case S_THREAD_LOCAL_REGULAR: - case S_THREAD_LOCAL_ZEROFILL: - if (!tlvTemplate) { - tlvTemplate = (uint8_t*)header + sect->addr; - } - *aSize = (uint8_t*)header + sect->addr + sect->size - tlvTemplate; - break; + case S_THREAD_LOCAL_REGULAR: + case S_THREAD_LOCAL_ZEROFILL: + if (!tlvTemplate) { + tlvTemplate = (uint8_t*)header + sect->addr; + } + *aSize = (uint8_t*)header + sect->addr + sect->size - tlvTemplate; + break; } } } @@ -1314,7 +1311,7 @@ static void EX_PerformSelector(ExternalCallContext& aCx) { } if (aCx.mPhase == ExternalCallPhase::RestoreInput) { - selector = (const char*) sel_registerName(selector); + selector = (const char*)sel_registerName(selector); } EX_AutoreleaseCFTypeRval(aCx); @@ -1420,8 +1417,8 @@ static ObjCMessageInfo gObjCExternalCallMessages[] = { // NSBezierPath {"addClip", EX_NoOp, true}, {"bezierPathWithRoundedRect:xRadius:yRadius:", - EX_Compose, - EX_FloatArg<0>, EX_FloatArg<1>, EX_AutoreleaseCFTypeRval>}, + EX_Compose, EX_FloatArg<0>, + EX_FloatArg<1>, EX_AutoreleaseCFTypeRval>}, // NSCell {"drawFocusRingMaskWithFrame:inView:", @@ -1483,12 +1480,10 @@ static ObjCMessageInfo gObjCExternalCallMessages[] = { EX_Compose, EX_AutoreleaseCFTypeRval>}, {"pointSize"}, {"smallSystemFontSize"}, - {"systemFontOfSize:", - EX_Compose, EX_AutoreleaseCFTypeRval>}, + {"systemFontOfSize:", EX_Compose, EX_AutoreleaseCFTypeRval>}, {"toolTipsFontOfSize:", EX_Compose, EX_AutoreleaseCFTypeRval>}, - {"userFontOfSize:", - EX_Compose, EX_AutoreleaseCFTypeRval>}, + {"userFontOfSize:", EX_Compose, EX_AutoreleaseCFTypeRval>}, // NSFontManager {"availableMembersOfFontFamily:", @@ -1529,7 +1524,7 @@ static void EX_objc_msgSend(ExternalCallContext& aCx) { auto& message = aCx.mArguments->Arg<1, const char*>(); if (aCx.mPhase == ExternalCallPhase::RestoreInput) { - message = (const char*) sel_registerName(message); + message = (const char*)sel_registerName(message); } for (const ObjCMessageInfo& info : gObjCExternalCallMessages) { @@ -2177,18 +2172,17 @@ static SystemRedirection gSystemRedirections[] = { Preamble_SetError}, {"lseek", RR_SaveRvalHadErrorNegative}, {"select$DARWIN_EXTSN", - RR_SaveRvalHadErrorNegative, - RR_OutParam<2, fd_set>, - RR_OutParam<3, fd_set>>>, + RR_SaveRvalHadErrorNegative< + RR_Compose, RR_OutParam<2, fd_set>, + RR_OutParam<3, fd_set>>>, nullptr, nullptr, Preamble_WaitForever}, {"socketpair", RR_SaveRvalHadErrorNegative>}, {"fileport_makeport", RR_SaveRvalHadErrorNegative>}, {"getsockopt", RR_SaveRvalHadErrorNegative}, {"gettimeofday", - RR_SaveRvalHadErrorNegative, - RR_OutParam<1, struct timezone>>>, + RR_SaveRvalHadErrorNegative, + RR_OutParam<1, struct timezone>>>, nullptr, nullptr, Preamble_PassThrough}, {"getuid", RR_ScalarRval}, {"geteuid", RR_ScalarRval}, @@ -2207,22 +2201,20 @@ static SystemRedirection gSystemRedirections[] = { {"stat$INODE64", RR_SaveRvalHadErrorNegative>, nullptr, nullptr, Preamble_SetError}, {"statfs$INODE64", - RR_SaveRvalHadErrorNegative>, - nullptr, nullptr, Preamble_SetError}, + RR_SaveRvalHadErrorNegative>, nullptr, + nullptr, Preamble_SetError}, {"fstatfs$INODE64", - RR_SaveRvalHadErrorNegative>, - nullptr, nullptr, Preamble_SetError}, + RR_SaveRvalHadErrorNegative>, nullptr, + nullptr, Preamble_SetError}, {"readlink", RR_SaveRvalHadErrorNegative>}, {"__getdirentries64", - RR_SaveRvalHadErrorNegative, RR_OutParam<3, size_t>>>}, + RR_SaveRvalHadErrorNegative< + RR_Compose, RR_OutParam<3, size_t>>>}, {"getdirentriesattr", - RR_SaveRvalHadErrorNegative, - RR_WriteBuffer<2, 3>, - RR_OutParam<4, size_t>, - RR_OutParam<5, size_t>, - RR_OutParam<6, size_t>>>}, + RR_SaveRvalHadErrorNegative< + RR_Compose, + RR_WriteBuffer<2, 3>, RR_OutParam<4, size_t>, + RR_OutParam<5, size_t>, RR_OutParam<6, size_t>>>}, {"getrusage", RR_SaveRvalHadErrorNegative>, nullptr, nullptr, Preamble_SetError}, {"getrlimit", RR_SaveRvalHadErrorNegative>}, @@ -2248,15 +2240,12 @@ static SystemRedirection gSystemRedirections[] = { {"umask", RR_ScalarRval}, {"__select", RR_SaveRvalHadErrorNegative< - RR_Compose, - RR_OutParam<2, fd_set>, - RR_OutParam<3, fd_set>, - RR_OutParam<4, timeval>>>, + RR_Compose, RR_OutParam<2, fd_set>, + RR_OutParam<3, fd_set>, RR_OutParam<4, timeval>>>, nullptr, nullptr, Preamble_WaitForever}, {"__process_policy", RR_SaveRvalHadErrorNegative}, {"__kdebug_trace", RR_SaveRvalHadErrorNegative}, - {"guarded_kqueue_np", - RR_SaveRvalHadErrorNegative>}, + {"guarded_kqueue_np", RR_SaveRvalHadErrorNegative>}, {"csops", RR_SaveRvalHadErrorNegative>}, {"__getlogin", RR_SaveRvalHadErrorNegative>}, {"__workq_kernreturn", nullptr, Preamble___workq_kernreturn}, @@ -2303,17 +2292,16 @@ static SystemRedirection gSystemRedirections[] = { {"fwrite", RR_ScalarRval}, {"getenv", RR_CStringRval, Preamble_getenv, nullptr, Preamble_Veto<0>}, {"localtime_r", - RR_SaveRvalHadErrorZero, - RR_RvalIsArgument<1>>>, + RR_SaveRvalHadErrorZero< + RR_Compose, RR_RvalIsArgument<1>>>, nullptr, nullptr, Preamble_PassThrough}, {"gmtime_r", - RR_SaveRvalHadErrorZero, - RR_RvalIsArgument<1>>>, + RR_SaveRvalHadErrorZero< + RR_Compose, RR_RvalIsArgument<1>>>, nullptr, nullptr, Preamble_PassThrough}, {"localtime", nullptr, Preamble_localtime, nullptr, Preamble_PassThrough}, {"gmtime", nullptr, Preamble_gmtime, nullptr, Preamble_PassThrough}, - {"mktime", - RR_Compose>}, + {"mktime", RR_Compose>}, {"setlocale", RR_CStringRval}, {"strftime", RR_Compose>}, {"arc4random", RR_ScalarRval, nullptr, nullptr, Preamble_PassThrough}, @@ -2356,11 +2344,11 @@ static SystemRedirection gSystemRedirections[] = { {"task_get_special_port", RR_Compose>}, {"task_set_special_port", RR_ScalarRval}, - {"task_swap_exception_ports", RR_ScalarRval}, // Ignore out parameters - {"time", RR_Compose>, - nullptr, nullptr, Preamble_PassThrough}, - {"uname", RR_SaveRvalHadErrorNegative>, - nullptr, nullptr, Preamble_SetError}, + {"task_swap_exception_ports", RR_ScalarRval}, // Ignore out parameters + {"time", RR_Compose>, nullptr, + nullptr, Preamble_PassThrough}, + {"uname", RR_SaveRvalHadErrorNegative>, nullptr, + nullptr, Preamble_SetError}, {"vm_allocate", nullptr, Preamble_VetoIfNotPassedThrough}, {"vm_copy", nullptr, Preamble_PassThrough}, {"tzset"}, @@ -2408,8 +2396,8 @@ static SystemRedirection gSystemRedirections[] = { EX_CFArrayGetValueAtIndex}, {"CFArrayRemoveValueAtIndex"}, {"CFAttributedStringCreate", RR_ScalarRval, nullptr, - EX_Compose, - EX_CFTypeArg<1>, EX_CFTypeArg<2>, EX_CreateCFTypeRval>}, + EX_Compose, EX_CFTypeArg<1>, EX_CFTypeArg<2>, + EX_CreateCFTypeRval>}, {"CFBundleCopyExecutableURL", RR_ScalarRval}, {"CFBundleCopyInfoDictionaryForURL", RR_ScalarRval}, {"CFBundleCreate", RR_ScalarRval}, @@ -2432,16 +2420,13 @@ static SystemRedirection gSystemRedirections[] = { EX_Compose, EX_CFTypeArg<1>, EX_CFTypeArg<2>>}, {"CFDictionaryCreate", RR_ScalarRval, nullptr, EX_CFDictionaryCreate}, {"CFDictionaryCreateMutable", RR_ScalarRval, nullptr, - EX_Compose, - EX_ScalarArg<1>, - EX_RequireFixed<2, - FixedInput::kCFTypeDictionaryKeyCallBacks>, - EX_RequireFixed<3, - FixedInput::kCFTypeDictionaryValueCallBacks>, + EX_Compose, EX_ScalarArg<1>, + EX_RequireFixed<2, FixedInput::kCFTypeDictionaryKeyCallBacks>, + EX_RequireFixed<3, FixedInput::kCFTypeDictionaryValueCallBacks>, EX_CreateCFTypeRval>}, {"CFDictionaryCreateMutableCopy", RR_ScalarRval, nullptr, - EX_Compose, - EX_ScalarArg<1>, EX_CFTypeArg<2>, EX_CreateCFTypeRval>}, + EX_Compose, EX_ScalarArg<1>, EX_CFTypeArg<2>, + EX_CreateCFTypeRval>}, {"CFDictionaryGetTypeID", RR_ScalarRval, nullptr, EX_NoOp}, {"CFDictionaryGetValue", RR_ScalarRval, nullptr, EX_Compose, EX_CFTypeArg<1>, EX_CFTypeRval>}, @@ -2500,13 +2485,11 @@ static SystemRedirection gSystemRedirections[] = { {"CFStringCreateArrayBySeparatingStrings", RR_ScalarRval}, {"CFStringCreateMutable", RR_ScalarRval}, {"CFStringCreateWithBytes", RR_ScalarRval, nullptr, - EX_Compose, - EX_Buffer<1, 2>, EX_ScalarArg<3>, EX_ScalarArg<4>, - EX_CreateCFTypeRval>}, + EX_Compose, EX_Buffer<1, 2>, EX_ScalarArg<3>, + EX_ScalarArg<4>, EX_CreateCFTypeRval>}, {"CFStringCreateWithBytesNoCopy", RR_ScalarRval}, {"CFStringCreateWithCharactersNoCopy", RR_ScalarRval, nullptr, - EX_Compose, - EX_Buffer<1, 2, UniChar>, + EX_Compose, EX_Buffer<1, 2, UniChar>, EX_RequireFixed<3, FixedInput::kCFAllocatorNull>, EX_CreateCFTypeRval>}, {"CFStringCreateWithCString", RR_ScalarRval}, @@ -2522,8 +2505,7 @@ static SystemRedirection gSystemRedirections[] = { // We also need to specify the argument register with the range's length // here. RR_WriteBuffer<3, 2, UniChar>, nullptr, - EX_Compose, - EX_ScalarArg<1>, + EX_Compose, EX_ScalarArg<1>, EX_WriteBuffer<3, 2, UniChar>>}, {"CFStringGetCString", RR_Compose>}, {"CFStringGetCStringPtr", nullptr, Preamble_VetoIfNotPassedThrough<0>}, @@ -2546,18 +2528,17 @@ static SystemRedirection gSystemRedirections[] = { EX_Compose, EX_CreateCFTypeRval>}, {"CFUUIDCreateString", RR_ScalarRval}, {"CFUUIDGetUUIDBytes", RR_ComplexScalarRval, nullptr, EX_CFTypeArg<0>}, - {"CGAffineTransformConcat", - RR_OversizeRval, nullptr, + {"CGAffineTransformConcat", RR_OversizeRval, + nullptr, EX_Compose, EX_OversizeRval>}, - {"CGAffineTransformInvert", - RR_OversizeRval, nullptr, + {"CGAffineTransformInvert", RR_OversizeRval, + nullptr, EX_Compose, EX_OversizeRval>}, - {"CGAffineTransformMakeScale", - RR_OversizeRval, nullptr, - EX_Compose, - EX_FloatArg<1>, + {"CGAffineTransformMakeScale", RR_OversizeRval, + nullptr, + EX_Compose, EX_FloatArg<1>, EX_OversizeRval>}, {"CGBitmapContextCreateImage", RR_ScalarRval, nullptr, EX_Compose, EX_CreateCFTypeRval>}, @@ -2595,8 +2576,7 @@ static SystemRedirection gSystemRedirections[] = { EX_CFTypeArg<1>, EX_FlushCGContext<0>>}, {"CGContextDrawLinearGradient", RR_FlushCGContext<0>, nullptr, EX_Compose, EX_CFTypeArg<1>, - EX_StackArgumentData<2 * sizeof(CGPoint)>, - EX_ScalarArg<2>, + EX_StackArgumentData<2 * sizeof(CGPoint)>, EX_ScalarArg<2>, EX_FlushCGContext<0>>}, {"CGContextEndTransparencyLayer", nullptr, nullptr, EX_UpdateCFTypeArg<0>}, {"CGContextFillPath", RR_FlushCGContext<0>, nullptr, @@ -2630,13 +2610,11 @@ static SystemRedirection gSystemRedirections[] = { {"CGContextSetGrayFillColor", nullptr, nullptr, EX_Compose, EX_FloatArg<1>, EX_UpdateCFTypeArg<0>>}, {"CGContextSetRGBFillColor", nullptr, nullptr, - EX_Compose, - EX_FloatArg<0>, EX_FloatArg<1>, EX_FloatArg<2>, - EX_StackArgumentData>}, + EX_Compose, EX_FloatArg<0>, EX_FloatArg<1>, + EX_FloatArg<2>, EX_StackArgumentData>}, {"CGContextSetRGBStrokeColor", nullptr, nullptr, - EX_Compose, - EX_FloatArg<0>, EX_FloatArg<1>, EX_FloatArg<2>, - EX_StackArgumentData>}, + EX_Compose, EX_FloatArg<0>, EX_FloatArg<1>, + EX_FloatArg<2>, EX_StackArgumentData>}, {"CGContextSetShouldAntialias", nullptr, nullptr, EX_Compose, EX_ScalarArg<1>>}, {"CGContextSetShouldSmoothFonts", nullptr, nullptr, @@ -2706,17 +2684,16 @@ static SystemRedirection gSystemRedirections[] = { {"CGPathContainsPoint", RR_ScalarRval}, {"CGPathCreateMutable", RR_ScalarRval}, {"CGPathCreateWithRoundedRect", RR_ScalarRval, nullptr, - EX_Compose, - EX_FloatArg<0>, EX_FloatArg<1>, - EX_InParam<0, CGAffineTransform>, + EX_Compose, EX_FloatArg<0>, + EX_FloatArg<1>, EX_InParam<0, CGAffineTransform>, EX_CreateCFTypeRval>}, {"CGPathGetBoundingBox", RR_OversizeRval}, {"CGPathGetCurrentPoint", RR_ComplexFloatRval}, {"CGPathIsEmpty", RR_ScalarRval}, {"CGRectApplyAffineTransform", RR_OversizeRval, nullptr, - EX_Compose, - EX_OversizeRval>}, + EX_Compose< + EX_StackArgumentData, + EX_OversizeRval>}, {"CGSSetDebugOptions", RR_ScalarRval}, {"CGSShutdownServerConnections"}, {"CTFontCopyFamilyName", RR_ScalarRval, nullptr, @@ -2733,29 +2710,21 @@ static SystemRedirection gSystemRedirections[] = { {"CTFontCopyVariationAxes", RR_ScalarRval, nullptr, EX_Compose, EX_CreateCFTypeRval>}, {"CTFontCreateForString", RR_ScalarRval, nullptr, - EX_Compose, EX_CFTypeArg<1>, - EX_ScalarArg<2>, EX_ScalarArg<3>, EX_CreateCFTypeRval>}, + EX_Compose, EX_CFTypeArg<1>, EX_ScalarArg<2>, + EX_ScalarArg<3>, EX_CreateCFTypeRval>}, {"CTFontCreatePathForGlyph", RR_ScalarRval, nullptr, - EX_Compose, - EX_ScalarArg<1>, - EX_InParam<2, CGAffineTransform>, - EX_CreateCFTypeRval>}, + EX_Compose, EX_ScalarArg<1>, + EX_InParam<2, CGAffineTransform>, EX_CreateCFTypeRval>}, {"CTFontCreateWithFontDescriptor", RR_ScalarRval, nullptr, - EX_Compose, - EX_FloatArg<0>, - EX_InParam<1, CGAffineTransform>, - EX_CreateCFTypeRval>}, + EX_Compose, EX_FloatArg<0>, + EX_InParam<1, CGAffineTransform>, EX_CreateCFTypeRval>}, {"CTFontCreateWithGraphicsFont", RR_ScalarRval, nullptr, - EX_Compose, - EX_FloatArg<0>, - EX_InParam<1, CGAffineTransform>, - EX_CFTypeArg<2>, + EX_Compose, EX_FloatArg<0>, + EX_InParam<1, CGAffineTransform>, EX_CFTypeArg<2>, EX_CreateCFTypeRval>}, {"CTFontCreateWithName", RR_ScalarRval, nullptr, - EX_Compose, - EX_FloatArg<0>, - EX_InParam<1, CGAffineTransform>, - EX_CreateCFTypeRval>}, + EX_Compose, EX_FloatArg<0>, + EX_InParam<1, CGAffineTransform>, EX_CreateCFTypeRval>}, {"CTFontDescriptorCopyAttribute", RR_ScalarRval, nullptr, EX_Compose, EX_CFTypeArg<1>, EX_CreateCFTypeRval>}, {"CTFontDescriptorCreateCopyWithAttributes", RR_ScalarRval, nullptr, @@ -2769,8 +2738,7 @@ static SystemRedirection gSystemRedirections[] = { EX_Buffer<2, 3, CGPoint>, EX_FlushCGContext<4>>}, {"CTFontGetAdvancesForGlyphs", RR_Compose>, nullptr, - EX_Compose, EX_ScalarArg<1>, - EX_Buffer<2, 4, CGGlyph>, + EX_Compose, EX_ScalarArg<1>, EX_Buffer<2, 4, CGGlyph>, EX_WriteBuffer<3, 4, CGSize>>}, {"CTFontGetAscent", RR_FloatRval, nullptr, EX_CFTypeArg<0>}, {"CTFontGetBoundingBox", RR_OversizeRval, nullptr, @@ -2780,8 +2748,7 @@ static SystemRedirection gSystemRedirections[] = { RR_Compose, RR_WriteOptionalBuffer<4, 5, CGRect>>, nullptr, - EX_Compose, EX_ScalarArg<2>, - EX_Buffer<3, 5, CGGlyph>, + EX_Compose, EX_ScalarArg<2>, EX_Buffer<3, 5, CGGlyph>, EX_OversizeRval, EX_WriteBuffer<4, 5, CGRect>>}, {"CTFontGetCapHeight", RR_FloatRval, nullptr, EX_CFTypeArg<0>}, {"CTFontGetDescent", RR_FloatRval, nullptr, EX_CFTypeArg<0>}, @@ -2818,9 +2785,7 @@ static SystemRedirection gSystemRedirections[] = { {"CTRunGetTypographicBounds", // Argument indexes are off by one here as the CFRange argument uses two // slots. - RR_Compose, - RR_OutParam<4, CGFloat>, + RR_Compose, RR_OutParam<4, CGFloat>, RR_OutParam<5, CGFloat>>, nullptr, EX_Compose, EX_ScalarArg<1>, EX_ScalarArg<2>, @@ -2830,10 +2795,8 @@ static SystemRedirection gSystemRedirections[] = { EX_Compose, EX_CFTypeArg<1>, EX_CFTypeArg<2>, EX_StackArgumentData>}, {"FSCompareFSRefs", RR_ScalarRval}, - {"FSGetVolumeInfo", - RR_Compose, - RR_OutParam<6, FSRef>>}, + {"FSGetVolumeInfo", RR_Compose, + RR_OutParam<6, FSRef>>}, {"FSFindFolder", RR_Compose>}, {"Gestalt", RR_Compose>}, {"GetEventClass", RR_ScalarRval}, @@ -2847,65 +2810,42 @@ static SystemRedirection gSystemRedirections[] = { nullptr, EX_Compose, EX_OutParam<1, SInt32>>}, {"HIThemeDrawButton", RR_Compose, RR_ScalarRval>, nullptr, - EX_Compose, - EX_InParam<1, HIThemeButtonDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>, + EX_Compose, EX_InParam<1, HIThemeButtonDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>, EX_OutParam<4, HIRect>>}, {"HIThemeDrawFrame", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeFrameDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeFrameDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawGroupBox", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeGroupBoxDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeGroupBoxDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawGrowBox", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeGrowBoxDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeGrowBoxDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawMenuBackground", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeMenuDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeMenuDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawMenuItem", RR_Compose, RR_ScalarRval>, nullptr, - EX_Compose, - EX_InParam<1, HIRect>, - EX_InParam<2, HIThemeMenuItemDrawInfo>, - EX_UpdateCFTypeArg<3>, - EX_ScalarArg<4>, - EX_OutParam<5, HIRect>>}, + EX_Compose, EX_InParam<1, HIRect>, + EX_InParam<2, HIThemeMenuItemDrawInfo>, EX_UpdateCFTypeArg<3>, + EX_ScalarArg<4>, EX_OutParam<5, HIRect>>}, {"HIThemeDrawMenuSeparator", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIRect>, - EX_InParam<2, HIThemeMenuItemDrawInfo>, - EX_UpdateCFTypeArg<3>, + EX_Compose, EX_InParam<1, HIRect>, + EX_InParam<2, HIThemeMenuItemDrawInfo>, EX_UpdateCFTypeArg<3>, EX_ScalarArg<4>>}, {"HIThemeDrawSeparator", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeSeparatorDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeSeparatorDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawTabPane", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIThemeTabPaneDrawInfo>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIThemeTabPaneDrawInfo>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeDrawTrack", RR_ScalarRval, nullptr, - EX_Compose, - EX_InParam<1, HIRect>, - EX_UpdateCFTypeArg<2>, - EX_ScalarArg<3>>}, + EX_Compose, EX_InParam<1, HIRect>, + EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, {"HIThemeGetGrowBoxBounds", - RR_Compose>, - nullptr, - EX_Compose, - EX_InParam<1, HIThemeGrowBoxDrawInfo>, + RR_Compose>, nullptr, + EX_Compose, EX_InParam<1, HIThemeGrowBoxDrawInfo>, EX_OutParam<2, HIRect>>}, {"HIThemeSetFill", RR_ScalarRval, nullptr, EX_Compose, EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>}, @@ -2917,14 +2857,10 @@ static SystemRedirection gSystemRedirections[] = { RR_Compose>}, {"LSCopyKindStringForMIMEType", RR_Compose>}, - {"LSGetApplicationForInfo", - RR_Compose, - RR_OutParam<5, CFURLRef>>}, - {"LSGetApplicationForURL", - RR_Compose, - RR_OutParam<3, CFURLRef>>}, + {"LSGetApplicationForInfo", RR_Compose, + RR_OutParam<5, CFURLRef>>}, + {"LSGetApplicationForURL", RR_Compose, + RR_OutParam<3, CFURLRef>>}, {"LSCopyDefaultApplicationURLForURL", RR_Compose>}, {"NSClassFromString", RR_ScalarRval, nullptr, @@ -2971,9 +2907,7 @@ static SystemRedirection gSystemRedirections[] = { // Redirection Generation /////////////////////////////////////////////////////////////////////////////// -size_t NumRedirections() { - return ArrayLength(gSystemRedirections); -} +size_t NumRedirections() { return ArrayLength(gSystemRedirections); } static Redirection* gRedirections; @@ -3036,9 +2970,8 @@ void InitializeRedirections() { redirection.mOriginalFunction = FunctionStartAddress(redirection); if (IsRecordingOrReplaying()) { - redirection.mRedirectedFunction = - GenerateRedirectStub(assembler.ref(), i, - PreserveCallerSaveRegisters(redirection.mName)); + redirection.mRedirectedFunction = GenerateRedirectStub( + assembler.ref(), i, PreserveCallerSaveRegisters(redirection.mName)); gRedirectionAddresses->insert(RedirectionAddressMap::value_type( std::string(redirection.mName), redirection.mRedirectedFunction)); } @@ -3085,8 +3018,7 @@ static void ApplyBinding(const char* aName, void** aPtr) { void* binding = FindRedirectionBinding(aName); if (binding) { if (!strcmp(aName, "_tlv_bootstrap")) { - MOZ_RELEASE_ASSERT(gTLVGetAddress == nullptr || - gTLVGetAddress == *aPtr); + MOZ_RELEASE_ASSERT(gTLVGetAddress == nullptr || gTLVGetAddress == *aPtr); gTLVGetAddress = *aPtr; } *aPtr = binding; @@ -3131,8 +3063,8 @@ struct MachOLibrary { MOZ_RELEASE_ASSERT(rv >= 0); mFileSize = info.st_size; - mFileAddress = (uint8_t*)mmap(nullptr, mFileSize, PROT_READ, - MAP_PRIVATE, mFile, 0); + mFileAddress = + (uint8_t*)mmap(nullptr, mFileSize, PROT_READ, MAP_PRIVATE, mFile, 0); MOZ_RELEASE_ASSERT(mFileAddress != MAP_FAILED); mach_header_64* header = (mach_header_64*)mFileAddress; @@ -3146,50 +3078,50 @@ struct MachOLibrary { void ApplyRedirections() { ForEachCommand([=](load_command* aCmd) { - switch (aCmd->cmd & ~LC_REQ_DYLD) { - case LC_SYMTAB: - AddSymbolTable((symtab_command*)aCmd); - break; - case LC_DYSYMTAB: - AddDynamicSymbolTable((dysymtab_command*)aCmd); - break; - } - }); + switch (aCmd->cmd & ~LC_REQ_DYLD) { + case LC_SYMTAB: + AddSymbolTable((symtab_command*)aCmd); + break; + case LC_DYSYMTAB: + AddDynamicSymbolTable((dysymtab_command*)aCmd); + break; + } + }); ForEachCommand([=](load_command* aCmd) { - switch (aCmd->cmd & ~LC_REQ_DYLD) { - case LC_DYLD_INFO: - BindLoadInfo((dyld_info_command*)aCmd); - break; - case LC_SEGMENT_64: { - auto ncmd = (segment_command_64*)aCmd; - mSegments.append(ncmd); - BindSegment(ncmd); - break; - } + switch (aCmd->cmd & ~LC_REQ_DYLD) { + case LC_DYLD_INFO: + BindLoadInfo((dyld_info_command*)aCmd); + break; + case LC_SEGMENT_64: { + auto ncmd = (segment_command_64*)aCmd; + mSegments.append(ncmd); + BindSegment(ncmd); + break; } - }); + } + }); } void ForEachCommand(const std::function& aCallback) { mach_header_64* header = (mach_header_64*)mFileAddress; uint32_t offset = sizeof(mach_header_64); for (size_t i = 0; i < header->ncmds; i++) { - load_command* cmd = (load_command*) (mFileAddress + offset); + load_command* cmd = (load_command*)(mFileAddress + offset); aCallback(cmd); offset += cmd->cmdsize; } } void AddSymbolTable(symtab_command* aCmd) { - mSymbolTable = (nlist_64*) (mFileAddress + aCmd->symoff); + mSymbolTable = (nlist_64*)(mFileAddress + aCmd->symoff); mSymbolCount = aCmd->nsyms; - mStringTable = (char*) (mFileAddress + aCmd->stroff); + mStringTable = (char*)(mFileAddress + aCmd->stroff); } void AddDynamicSymbolTable(dysymtab_command* aCmd) { - mIndirectSymbols = (uint32_t*) (mFileAddress + aCmd->indirectsymoff); + mIndirectSymbols = (uint32_t*)(mFileAddress + aCmd->indirectsymoff); mIndirectSymbolCount = aCmd->nindirectsyms; } @@ -3237,29 +3169,29 @@ struct MachOLibrary { case BIND_OPCODE_SET_ADDEND_SLEB: break; case BIND_OPCODE_DO_BIND: - DoBinding(segmentIndex, segmentOffset, - symbolName, symbolFlags, symbolType); + DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags, + symbolType); segmentOffset += sizeof(uintptr_t); break; case BIND_OPCODE_ADD_ADDR_ULEB: segmentOffset += ReadLEB128(cursor, end); break; case BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB: - DoBinding(segmentIndex, segmentOffset, - symbolName, symbolFlags, symbolType); + DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags, + symbolType); segmentOffset += ReadLEB128(cursor, end) + sizeof(uintptr_t); break; case BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED: - DoBinding(segmentIndex, segmentOffset, - symbolName, symbolFlags, symbolType); + DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags, + symbolType); segmentOffset += immediate * sizeof(uintptr_t) + sizeof(uintptr_t); break; case BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: { size_t count = ReadLEB128(cursor, end); size_t skip = ReadLEB128(cursor, end); for (size_t i = 0; i < count; i++) { - DoBinding(segmentIndex, segmentOffset, - symbolName, symbolFlags, symbolType); + DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags, + symbolType); segmentOffset += skip + sizeof(uintptr_t); } break; @@ -3279,12 +3211,12 @@ struct MachOLibrary { uint8_t* address = mAddress + seg->vmaddr + aSegmentOffset; MOZ_RELEASE_ASSERT(aSymbolType == BIND_TYPE_POINTER); - void** ptr = (void**) address; + void** ptr = (void**)address; ApplyBinding(aSymbolName, ptr); } void BindSegment(segment_command_64* aCmd) { - section_64* sect = (section_64*) (aCmd + 1); + section_64* sect = (section_64*)(aCmd + 1); for (size_t i = 0; i < aCmd->nsects; i++, sect++) { switch (sect->flags & SECTION_TYPE) { case S_NON_LAZY_SYMBOL_POINTERS: @@ -3316,11 +3248,11 @@ struct MachOLibrary { // so we check again after each new library is loaded, and clear out these // entries once we have fixed their external references. static const char* gInitialLibrarySymbols[] = { - "RecordReplayInterface_Initialize", // XUL - "_ZN7mozilla12recordreplay10InitializeEiPPc", // libmozglue - "PR_Initialize", // libnss3 - "FREEBL_GetVector", // libfreebl - "NSC_GetFunctionList", // libsoftokn3 + "RecordReplayInterface_Initialize", // XUL + "_ZN7mozilla12recordreplay10InitializeEiPPc", // libmozglue + "PR_Initialize", // libnss3 + "FREEBL_GetVector", // libfreebl + "NSC_GetFunctionList", // libsoftokn3 }; void ApplyLibraryRedirections(void* aLibrary) { @@ -3371,35 +3303,36 @@ struct PlatformSymbol { uint32_t mValue; }; -#define NewPlatformSymbol(Name) { #Name, Name } +#define NewPlatformSymbol(Name) \ + { #Name, Name } extern "C" { MOZ_EXPORT PlatformSymbol RecordReplayInterface_PlatformSymbols[] = { - NewPlatformSymbol(PROT_READ), - NewPlatformSymbol(PROT_WRITE), - NewPlatformSymbol(PROT_EXEC), - NewPlatformSymbol(MAP_FIXED), - NewPlatformSymbol(MAP_PRIVATE), - NewPlatformSymbol(MAP_ANON), - NewPlatformSymbol(MAP_NORESERVE), - NewPlatformSymbol(PTHREAD_MUTEX_NORMAL), - NewPlatformSymbol(PTHREAD_MUTEX_RECURSIVE), - NewPlatformSymbol(PTHREAD_CREATE_JOINABLE), - NewPlatformSymbol(PTHREAD_CREATE_DETACHED), - NewPlatformSymbol(SYS_thread_selfid), - NewPlatformSymbol(_SC_PAGESIZE), - NewPlatformSymbol(_SC_NPROCESSORS_CONF), - NewPlatformSymbol(RLIMIT_AS), - NewPlatformSymbol(ETIMEDOUT), - NewPlatformSymbol(EINTR), - NewPlatformSymbol(EPIPE), - NewPlatformSymbol(EAGAIN), - NewPlatformSymbol(ECONNRESET), - { nullptr, 0 }, + NewPlatformSymbol(PROT_READ), + NewPlatformSymbol(PROT_WRITE), + NewPlatformSymbol(PROT_EXEC), + NewPlatformSymbol(MAP_FIXED), + NewPlatformSymbol(MAP_PRIVATE), + NewPlatformSymbol(MAP_ANON), + NewPlatformSymbol(MAP_NORESERVE), + NewPlatformSymbol(PTHREAD_MUTEX_NORMAL), + NewPlatformSymbol(PTHREAD_MUTEX_RECURSIVE), + NewPlatformSymbol(PTHREAD_CREATE_JOINABLE), + NewPlatformSymbol(PTHREAD_CREATE_DETACHED), + NewPlatformSymbol(SYS_thread_selfid), + NewPlatformSymbol(_SC_PAGESIZE), + NewPlatformSymbol(_SC_NPROCESSORS_CONF), + NewPlatformSymbol(RLIMIT_AS), + NewPlatformSymbol(ETIMEDOUT), + NewPlatformSymbol(EINTR), + NewPlatformSymbol(EPIPE), + NewPlatformSymbol(EAGAIN), + NewPlatformSymbol(ECONNRESET), + {nullptr, 0}, }; -} // extern "C" +} // extern "C" /////////////////////////////////////////////////////////////////////////////// // Direct system call API @@ -3488,8 +3421,8 @@ void InitializeCurrentTime() { } double CurrentTime() { - return CallFunction(gOriginal_mach_absolute_time) * - gNsPerTick / 1000.0; + return CallFunction(gOriginal_mach_absolute_time) * gNsPerTick / + 1000.0; } NativeThreadId DirectSpawnThread(void (*aFunction)(void*), void* aArgument, diff --git a/toolkit/recordreplay/ProcessRewind.cpp b/toolkit/recordreplay/ProcessRewind.cpp index ded3b01e9a7e..a28b94b91c14 100644 --- a/toolkit/recordreplay/ProcessRewind.cpp +++ b/toolkit/recordreplay/ProcessRewind.cpp @@ -27,9 +27,7 @@ static Monitor* gMainThreadCallbackMonitor; // gMainThreadCallbackMonitor. static StaticInfallibleVector> gMainThreadCallbacks; -void InitializeRewindState() { - gMainThreadCallbackMonitor = new Monitor(); -} +void InitializeRewindState() { gMainThreadCallbackMonitor = new Monitor(); } void NewCheckpoint() { MOZ_RELEASE_ASSERT(Thread::CurrentIsMainThread()); diff --git a/toolkit/recordreplay/Recording.cpp b/toolkit/recordreplay/Recording.cpp index 7fb95578ab4a..b0a9c23b00dc 100644 --- a/toolkit/recordreplay/Recording.cpp +++ b/toolkit/recordreplay/Recording.cpp @@ -180,10 +180,9 @@ void Stream::RecordOrReplayThreadEvent(ThreadEvent aEvent, const char* aExtra) { } extra = ReadInputString(); } - child::ReportFatalError( - "Event Mismatch: Recorded %s %s Replayed %s %s", - ThreadEventName(oldEvent), extra, - ThreadEventName(aEvent), aExtra ? aExtra : ""); + child::ReportFatalError("Event Mismatch: Recorded %s %s Replayed %s %s", + ThreadEventName(oldEvent), extra, + ThreadEventName(aEvent), aExtra ? aExtra : ""); } mLastEvent = aEvent; PushEvent(ThreadEventName(aEvent)); @@ -297,9 +296,8 @@ void Stream::Flush(bool aTakeLock) { MOZ_RELEASE_ASSERT((size_t)compressedSize <= bound); StreamChunkLocation chunk = - mRecording->WriteChunk(mName, mNameIndex, - mBallast.get(), compressedSize, mBufferPos, - mStreamPos - mBufferPos, aTakeLock); + mRecording->WriteChunk(mName, mNameIndex, mBallast.get(), compressedSize, + mBufferPos, mStreamPos - mBufferPos, aTakeLock); mChunks.append(chunk); MOZ_ALWAYS_TRUE(++mChunkIndex == mChunks.length()); @@ -396,7 +394,7 @@ void Recording::NewContents(const uint8_t* aContents, size_t aSize, MOZ_RELEASE_ASSERT(aSize >= sizeof(Header)); offset += sizeof(Header); - Header* header = (Header*) aContents; + Header* header = (Header*)aContents; MOZ_RELEASE_ASSERT(header->mMagic == MagicValue); BuildId currentBuildId; @@ -452,7 +450,7 @@ StreamChunkLocation Recording::WriteChunk(StreamName aName, size_t aNameIndex, chunk.mStreamPos = aStreamPos; ChunkDescriptor desc; - desc.mName = (uint32_t) aName; + desc.mName = (uint32_t)aName; desc.mNameIndex = aNameIndex; desc.mChunk = chunk; @@ -464,7 +462,8 @@ StreamChunkLocation Recording::WriteChunk(StreamName aName, size_t aNameIndex, void Recording::ReadChunk(char* aDest, const StreamChunkLocation& aChunk) { AutoSpinLock lock(mLock); - MOZ_RELEASE_ASSERT(aChunk.mOffset + aChunk.mCompressedSize <= mContents.length()); + MOZ_RELEASE_ASSERT(aChunk.mOffset + aChunk.mCompressedSize <= + mContents.length()); memcpy(aDest, mContents.begin() + aChunk.mOffset, aChunk.mCompressedSize); MOZ_RELEASE_ASSERT(HashBytes(aDest, aChunk.mCompressedSize) == aChunk.mHash); } diff --git a/toolkit/recordreplay/Recording.h b/toolkit/recordreplay/Recording.h index abc483209652..801251666ff1 100644 --- a/toolkit/recordreplay/Recording.h +++ b/toolkit/recordreplay/Recording.h @@ -177,7 +177,8 @@ class Stream { // Note a new thread event for this stream, and make sure it is the same // while replaying as it was while recording. - void RecordOrReplayThreadEvent(ThreadEvent aEvent, const char* aExtra = nullptr); + void RecordOrReplayThreadEvent(ThreadEvent aEvent, + const char* aExtra = nullptr); // Replay a thread event without requiring it to be a specific event. ThreadEvent ReplayThreadEvent(); diff --git a/toolkit/recordreplay/Thread.cpp b/toolkit/recordreplay/Thread.cpp index 857e61fcb5dd..8ac194994dfc 100644 --- a/toolkit/recordreplay/Thread.cpp +++ b/toolkit/recordreplay/Thread.cpp @@ -113,7 +113,7 @@ void Thread::InitializeThreads() { gThreads = new Thread[MaxThreadId + 1]; size_t nbytes = (MaxThreadId - MainThreadId) * ThreadStackSize; - gThreadStackMemory = (uint8_t*) DirectAllocateMemory(nbytes); + gThreadStackMemory = (uint8_t*)DirectAllocateMemory(nbytes); for (size_t i = MainThreadId; i <= MaxThreadId; i++) { Thread* thread = &gThreads[i]; @@ -127,7 +127,8 @@ void Thread::InitializeThreads() { thread->BindToCurrent(); thread->mNativeId = DirectCurrentThread(); } else { - thread->mStackBase = gThreadStackMemory + (i - MainThreadId - 1) * ThreadStackSize; + thread->mStackBase = + gThreadStackMemory + (i - MainThreadId - 1) * ThreadStackSize; thread->mStackSize = ThreadStackSize - PageSize * 2; // Make some memory between thread stacks inaccessible so that breakpad @@ -321,7 +322,8 @@ void Thread::ReleaseOrAcquireOwnedLocks(OwnedLockState aState) { } void** Thread::GetOrCreateStorage(uintptr_t aKey) { - for (StorageEntry** pentry = &mStorageEntries; *pentry; pentry = &(*pentry)->mNext) { + for (StorageEntry** pentry = &mStorageEntries; *pentry; + pentry = &(*pentry)->mNext) { StorageEntry* entry = *pentry; if (entry->mKey == aKey) { // Put this at the front of the list. @@ -331,7 +333,7 @@ void** Thread::GetOrCreateStorage(uintptr_t aKey) { return &entry->mData; } } - StorageEntry* entry = (StorageEntry*) AllocateStorage(sizeof(StorageEntry)); + StorageEntry* entry = (StorageEntry*)AllocateStorage(sizeof(StorageEntry)); entry->mKey = aKey; entry->mData = 0; entry->mNext = mStorageEntries; @@ -343,7 +345,7 @@ uint8_t* Thread::AllocateStorage(size_t aSize) { // malloc uses TLS, so go directly to the system to allocate TLS storage. if (mStorageCursor + aSize >= mStorageLimit) { size_t nbytes = std::max(aSize, PageSize); - mStorageCursor = (uint8_t*) DirectAllocateMemory(nbytes); + mStorageCursor = (uint8_t*)DirectAllocateMemory(nbytes); mStorageLimit = mStorageCursor + nbytes; } uint8_t* res = mStorageCursor; @@ -510,8 +512,7 @@ void Thread::NotifyUnrecordedWait( } } -bool Thread::MaybeWaitForFork( - const std::function& aReleaseCallback) { +bool Thread::MaybeWaitForFork(const std::function& aReleaseCallback) { MOZ_RELEASE_ASSERT(!PassThroughEvents()); if (IsMainThread()) { return false; diff --git a/toolkit/recordreplay/Thread.h b/toolkit/recordreplay/Thread.h index 4f5f3e1857fb..a827e917abf9 100644 --- a/toolkit/recordreplay/Thread.h +++ b/toolkit/recordreplay/Thread.h @@ -173,7 +173,6 @@ class Thread { uint8_t* AllocateStorage(size_t aSize); public: - // These are used by certain redirections to convey information from the // SaveOutput hook to the MiddlemanCall hook. uintptr_t mRedirectionValue; @@ -236,9 +235,7 @@ class Thread { } // Get the macOS mach identifier for this thread. - uintptr_t GetMachId() const { - return mMachId; - } + uintptr_t GetMachId() const { return mMachId; } // The actual start routine at the root of all recorded threads, and of all // threads when replaying. diff --git a/toolkit/recordreplay/ThreadSnapshot.cpp b/toolkit/recordreplay/ThreadSnapshot.cpp index 09fa33bfa225..a32c0cf30d07 100644 --- a/toolkit/recordreplay/ThreadSnapshot.cpp +++ b/toolkit/recordreplay/ThreadSnapshot.cpp @@ -175,8 +175,7 @@ bool SaveThreadState(size_t aId, int* aStackSeparator) { MOZ_RELEASE_ASSERT(aId <= MaxThreadId); ThreadState* info = &gThreadState[aId]; - bool res = - SaveThreadStateOrReturnFromRestore(info, aStackSeparator) == 0; + bool res = SaveThreadStateOrReturnFromRestore(info, aStackSeparator) == 0; if (!res) { ClearThreadState(info); } @@ -199,13 +198,12 @@ void SaveThreadStack(size_t aId) { // Release any existing stack contents from a previous fork. free(info.mStackContents); - info.mStackContents = (uint8_t*) malloc(stackBytes); + info.mStackContents = (uint8_t*)malloc(stackBytes); info.mStackBytes = stackBytes; memcpy(info.mStackContents, info.mStackTop, info.mStackTopBytes); memcpy(info.mStackContents + info.mStackTopBytes, - stackPointer + info.mStackTopBytes, - stackBytes - info.mStackTopBytes); + stackPointer + info.mStackTopBytes, stackBytes - info.mStackTopBytes); } void RestoreThreadStack(size_t aId) { diff --git a/toolkit/recordreplay/ipc/Channel.cpp b/toolkit/recordreplay/ipc/Channel.cpp index ae6941ccd90e..88c352eb9bee 100644 --- a/toolkit/recordreplay/ipc/Channel.cpp +++ b/toolkit/recordreplay/ipc/Channel.cpp @@ -68,7 +68,8 @@ Channel::Channel(size_t aId, Kind aKind, const MessageHandler& aHandler, mConnectionFd(0), mFd(0), mMessageBytes(0) { - MOZ_RELEASE_ASSERT(!IsRecordingOrReplaying() || AreThreadEventsPassedThrough()); + MOZ_RELEASE_ASSERT(!IsRecordingOrReplaying() || + AreThreadEventsPassedThrough()); if (IsParent()) { ipc::FileDescriptor connection; @@ -223,8 +224,7 @@ Message::UniquePtr Channel::WaitForMessage() { // Remove the message we just received from the incoming buffer. size_t remaining = mMessageBytes - messageSize; if (remaining) { - memmove(mMessageBuffer.begin(), &mMessageBuffer[messageSize], - remaining); + memmove(mMessageBuffer.begin(), &mMessageBuffer[messageSize], remaining); } mMessageBytes = remaining; diff --git a/toolkit/recordreplay/ipc/Channel.h b/toolkit/recordreplay/ipc/Channel.h index 6fa168e28d1f..84a4f5153fb7 100644 --- a/toolkit/recordreplay/ipc/Channel.h +++ b/toolkit/recordreplay/ipc/Channel.h @@ -41,11 +41,11 @@ namespace recordreplay { // replaying process rewinds itself. A few exceptions to this rule are noted // below. -#define ForEachMessageType(_Macro) \ +#define ForEachMessageType(_Macro) \ /* Messages which can be interpreted or constructed by the cloud server. */ \ - /* Avoid changing the message IDs for these. */ \ - \ - /* Sent by the middleman at startup. */ \ + /* Avoid changing the message IDs for these. */ \ + \ + /* Sent by the middleman at startup. */ \ _Macro(Introduction) \ \ /* An error occurred in the cloud server. */ \ @@ -162,10 +162,8 @@ struct Message { return mType == MessageType::CreateCheckpoint || mType == MessageType::SetDebuggerRunsInMiddleman || mType == MessageType::ExternalCallResponse || - mType == MessageType::Ping || - mType == MessageType::Terminate || - mType == MessageType::Crash || - mType == MessageType::Introduction || + mType == MessageType::Ping || mType == MessageType::Terminate || + mType == MessageType::Crash || mType == MessageType::Introduction || mType == MessageType::RecordingData; } @@ -286,7 +284,8 @@ struct ErrorMessage : public Message { typedef ErrorMessage FatalErrorMessage; typedef ErrorMessage CloudErrorMessage; -typedef EmptyMessage UnhandledDivergenceMessage; +typedef EmptyMessage + UnhandledDivergenceMessage; // The format for graphics data which will be sent to the middleman process. // This needs to match the format expected for canvas image data, to avoid @@ -426,7 +425,7 @@ class Channel { // Return whether this is the parent side of a connection. This side is opened // first and the child will connect to it afterwards. - bool IsParent() { + bool IsParent() { switch (mKind) { case Kind::MiddlemanRecord: case Kind::MiddlemanReplay: diff --git a/toolkit/recordreplay/ipc/ChildIPC.cpp b/toolkit/recordreplay/ipc/ChildIPC.cpp index 7bcd115926f3..b4c1c4465291 100644 --- a/toolkit/recordreplay/ipc/ChildIPC.cpp +++ b/toolkit/recordreplay/ipc/ChildIPC.cpp @@ -161,8 +161,8 @@ static void ChannelMessageHandler(Message::UniquePtr aMsg) { case MessageType::RecordingData: { MonitorAutoLock lock(*gMonitor); const RecordingDataMessage& nmsg = (const RecordingDataMessage&)*aMsg; - MOZ_RELEASE_ASSERT( - nmsg.mTag == gRecording->Size() + gPendingRecordingData.length()); + MOZ_RELEASE_ASSERT(nmsg.mTag == + gRecording->Size() + gPendingRecordingData.length()); gPendingRecordingData.append(nmsg.BinaryData(), nmsg.BinaryDataSize()); gMonitor->NotifyAll(); break; @@ -351,9 +351,9 @@ static void ForkListenerThread(void*) { int nbytes = read(gForkReadFd, &process, sizeof(process)); MOZ_RELEASE_ASSERT(nbytes == sizeof(process)); - process.mChannel = new Channel(0, Channel::Kind::ReplayRoot, - HandleMessageFromForkedProcess, - process.mPid); + process.mChannel = + new Channel(0, Channel::Kind::ReplayRoot, + HandleMessageFromForkedProcess, process.mPid); // Send any messages destined for this fork. size_t i = 0; @@ -377,8 +377,9 @@ static void InitializeForkListener() { Thread::SpawnNonRecordedThread(ForkListenerThread, nullptr); if (!ReplayingInCloud()) { - gFatalErrorMemory = (char*) mmap(nullptr, FatalErrorMemorySize, - PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); + gFatalErrorMemory = + (char*)mmap(nullptr, FatalErrorMemorySize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_SHARED, -1, 0); MOZ_RELEASE_ASSERT(gFatalErrorMemory != MAP_FAILED); } } @@ -386,9 +387,8 @@ static void InitializeForkListener() { static void SendMessageToForkedProcess(Message::UniquePtr aMsg) { for (ForkedProcess& process : gForkedProcesses) { if (process.mForkId == aMsg->mForkId) { - bool remove = - aMsg->mType == MessageType::Terminate || - aMsg->mType == MessageType::Crash; + bool remove = aMsg->mType == MessageType::Terminate || + aMsg->mType == MessageType::Crash; process.mChannel->SendMessage(std::move(*aMsg)); if (remove) { gForkedProcesses.erase(&process); @@ -467,15 +467,16 @@ static void SendFatalErrorMessage(size_t aForkId, const char* aMessage) { char msgBuf[4096]; size_t header = sizeof(FatalErrorMessage); size_t len = std::min(strlen(aMessage) + 1, sizeof(msgBuf) - header); - FatalErrorMessage* msg = new (msgBuf) FatalErrorMessage(header + len, aForkId); + FatalErrorMessage* msg = + new (msgBuf) FatalErrorMessage(header + len, aForkId); memcpy(&msgBuf[header], aMessage, len); msgBuf[sizeof(msgBuf) - 1] = 0; // Don't take the message lock when sending this, to avoid touching the heap. gChannel->SendMessage(std::move(*msg)); - Print("***** Fatal Record/Replay Error #%lu:%lu *****\n%s\n", GetId(), aForkId, - aMessage); + Print("***** Fatal Record/Replay Error #%lu:%lu *****\n%s\n", GetId(), + aForkId, aMessage); } void ReportCrash(const MinidumpInfo& aInfo, void* aFaultingAddress) { @@ -537,7 +538,7 @@ MOZ_EXPORT void RecordReplayInterface_ReportCrash(const char* aMessage) { SendFatalErrorMessage(gForkId, aMessage); } -} // extern "C" +} // extern "C" void ReportUnhandledDivergence() { gChannel->SendMessage(UnhandledDivergenceMessage(gForkId)); @@ -840,8 +841,8 @@ void ManifestFinished(const js::CharBuffer& aBuffer) { }); } -void SendExternalCallRequest(ExternalCallId aId, - const char* aInputData, size_t aInputSize, +void SendExternalCallRequest(ExternalCallId aId, const char* aInputData, + size_t aInputSize, InfallibleVector* aOutputData) { AutoPassThroughThreadEvents pt; MonitorAutoLock lock(*gMonitor); @@ -851,8 +852,8 @@ void SendExternalCallRequest(ExternalCallId aId, } gWaitingForCallResponse = true; - UniquePtr msg(ExternalCallRequestMessage::New( - gForkId, aId, aInputData, aInputSize)); + UniquePtr msg( + ExternalCallRequestMessage::New(gForkId, aId, aInputData, aInputSize)); gChannel->SendMessage(std::move(*msg)); while (!gCallResponseMessage) { @@ -868,10 +869,10 @@ void SendExternalCallRequest(ExternalCallId aId, gMonitor->Notify(); } -void SendExternalCallOutput(ExternalCallId aId, - const char* aOutputData, size_t aOutputSize) { - Message::UniquePtr msg(ExternalCallResponseMessage::New( - gForkId, aId, aOutputData, aOutputSize)); +void SendExternalCallOutput(ExternalCallId aId, const char* aOutputData, + size_t aOutputSize) { + Message::UniquePtr msg( + ExternalCallResponseMessage::New(gForkId, aId, aOutputData, aOutputSize)); gChannel->SendMessage(std::move(*msg)); } diff --git a/toolkit/recordreplay/ipc/ChildInternal.h b/toolkit/recordreplay/ipc/ChildInternal.h index e46f63883905..c427900ad4ec 100644 --- a/toolkit/recordreplay/ipc/ChildInternal.h +++ b/toolkit/recordreplay/ipc/ChildInternal.h @@ -62,14 +62,14 @@ bool DebuggerRunsInMiddleman(); void ManifestFinished(const js::CharBuffer& aResponse); // Send messages operating on external calls. -void SendExternalCallRequest(ExternalCallId aId, - const char* aInputData, size_t aInputSize, +void SendExternalCallRequest(ExternalCallId aId, const char* aInputData, + size_t aInputSize, InfallibleVector* aOutputData); // Send the output from an external call to the root replaying process, // to fill in its external call cache. -void SendExternalCallOutput(ExternalCallId aId, - const char* aOutputData, size_t aOutputSize); +void SendExternalCallOutput(ExternalCallId aId, const char* aOutputData, + size_t aOutputSize); // Return whether a repaint is in progress and is not allowed to trigger an // unhandled recording divergence per preferences. diff --git a/toolkit/recordreplay/ipc/ChildProcess.cpp b/toolkit/recordreplay/ipc/ChildProcess.cpp index d1a4121e380c..9fbb01bc910e 100644 --- a/toolkit/recordreplay/ipc/ChildProcess.cpp +++ b/toolkit/recordreplay/ipc/ChildProcess.cpp @@ -27,11 +27,11 @@ ChildProcessInfo::ChildProcessInfo( : mRecording(aRecordingProcessData.isSome()) { MOZ_RELEASE_ASSERT(NS_IsMainThread()); - Channel::Kind kind = - IsRecording() ? Channel::Kind::MiddlemanRecord : Channel::Kind::MiddlemanReplay; + Channel::Kind kind = IsRecording() ? Channel::Kind::MiddlemanRecord + : Channel::Kind::MiddlemanReplay; mChannel = new Channel(aId, kind, [=](Message::UniquePtr aMsg) { - ReceiveChildMessageOnMainThread(aId, std::move(aMsg)); - }); + ReceiveChildMessageOnMainThread(aId, std::move(aMsg)); + }); LaunchSubprocess(aId, aRecordingProcessData); } @@ -297,7 +297,7 @@ void ChildProcessInfo::MaybeProcessPendingMessageRunnable() { // Execute a task that processes a message received from the child. This is // called on a channel thread, and the function executes asynchronously on // the main thread. - /* static */ void ChildProcessInfo::ReceiveChildMessageOnMainThread( +/* static */ void ChildProcessInfo::ReceiveChildMessageOnMainThread( size_t aChildId, Message::UniquePtr aMsg) { MOZ_RELEASE_ASSERT(!NS_IsMainThread()); diff --git a/toolkit/recordreplay/ipc/JSControl.cpp b/toolkit/recordreplay/ipc/JSControl.cpp index 3f28cb457de1..fe4142b31cb4 100644 --- a/toolkit/recordreplay/ipc/JSControl.cpp +++ b/toolkit/recordreplay/ipc/JSControl.cpp @@ -265,8 +265,8 @@ static bool Middleman_SendManifest(JSContext* aCx, unsigned aArgc, Value* aVp) { } size_t forkId; - parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0), - args.get(1), &forkId); + parent::ChildProcessInfo* child = + ToChildProcess(aCx, args.get(0), args.get(1), &forkId); if (!child) { return false; } @@ -284,8 +284,8 @@ static bool Middleman_Ping(JSContext* aCx, unsigned aArgc, Value* aVp) { CallArgs args = CallArgsFromVp(aArgc, aVp); size_t forkId; - parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0), - args.get(1), &forkId); + parent::ChildProcessInfo* child = + ToChildProcess(aCx, args.get(0), args.get(1), &forkId); if (!child) { return false; } @@ -428,8 +428,8 @@ static bool Middleman_Terminate(JSContext* aCx, unsigned aArgc, Value* aVp) { CallArgs args = CallArgsFromVp(aArgc, aVp); size_t forkId; - parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0), - args.get(1), &forkId); + parent::ChildProcessInfo* child = + ToChildProcess(aCx, args.get(0), args.get(1), &forkId); if (!child) { return false; } @@ -445,8 +445,8 @@ static bool Middleman_CrashHangedChild(JSContext* aCx, unsigned aArgc, CallArgs args = CallArgsFromVp(aArgc, aVp); size_t forkId; - parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0), - args.get(1), &forkId); + parent::ChildProcessInfo* child = + ToChildProcess(aCx, args.get(0), args.get(1), &forkId); if (!child) { return false; } @@ -472,8 +472,8 @@ static bool Middleman_UpdateRecording(JSContext* aCx, unsigned aArgc, CallArgs args = CallArgsFromVp(aArgc, aVp); size_t forkId; - parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0), - args.get(1), &forkId); + parent::ChildProcessInfo* child = + ToChildProcess(aCx, args.get(0), args.get(1), &forkId); if (!child) { return false; } @@ -1087,8 +1087,7 @@ struct ScriptHitInfo { } }; - typedef HashMap - ScriptHitMap; + typedef HashMap ScriptHitMap; struct AnyScriptHit { uint32_t mScript; @@ -1120,7 +1119,7 @@ struct ScriptHitInfo { } ScriptHitVector* FindHits(uint32_t aCheckpoint, uint32_t aScript, - uint32_t aOffset) { + uint32_t aOffset) { CheckpointInfo* info = GetInfo(aCheckpoint); ScriptHitKey key(aScript, aOffset); @@ -1349,8 +1348,8 @@ static bool RecordReplay_FindScriptHits(JSContext* aCx, unsigned aArgc, for (const auto& hit : *hits) { RootedObject hitObject(aCx, JS_NewObject(aCx, nullptr)); if (!hitObject || - !JS_DefineProperty(aCx, hitObject, "progress", - (double)hit.mProgress, JSPROP_ENUMERATE) || + !JS_DefineProperty(aCx, hitObject, "progress", (double)hit.mProgress, + JSPROP_ENUMERATE) || !JS_DefineProperty(aCx, hitObject, "frameIndex", hit.mFrameIndex, JSPROP_ENUMERATE) || !values.append(ObjectValue(*hitObject))) { diff --git a/toolkit/recordreplay/ipc/ParentIPC.cpp b/toolkit/recordreplay/ipc/ParentIPC.cpp index c1ace322fc6c..373d52e5b546 100644 --- a/toolkit/recordreplay/ipc/ParentIPC.cpp +++ b/toolkit/recordreplay/ipc/ParentIPC.cpp @@ -198,7 +198,8 @@ class SendMessageToCloudRunnable : public Runnable { SendMessageToCloudRunnable(int32_t aConnectionId, Message::UniquePtr aMsg) : Runnable("SendMessageToCloudRunnable"), - mConnectionId(aConnectionId), mMsg(std::move(aMsg)) {} + mConnectionId(aConnectionId), + mMsg(std::move(aMsg)) {} NS_IMETHODIMP Run() { AutoSafeJSContext cx; @@ -256,7 +257,7 @@ static bool ConnectionCallback(JSContext* aCx, unsigned aArgc, JS::Value* aVp) { if (ptr) { Channel* channel = gConnectionChannels[id]; - channel->SendMessageData((const char*) ptr, length); + channel->SendMessageData((const char*)ptr, length); sentData = true; } } @@ -274,16 +275,16 @@ void CreateReplayingCloudProcess(base::ProcessId aProcessId, MOZ_RELEASE_ASSERT(XRE_IsParentProcess()); if (!gConnection) { - nsCOMPtr connection = - do_ImportModule("resource://devtools/server/actors/replay/connection.js"); + nsCOMPtr connection = do_ImportModule( + "resource://devtools/server/actors/replay/connection.js"); gConnection = connection.forget(); ClearOnShutdown(&gConnection); AutoSafeJSContext cx; JSAutoRealm ar(cx, xpc::PrivilegedJunkScope()); - JSFunction* fun = JS_NewFunction(cx, ConnectionCallback, 2, 0, - "ConnectionCallback"); + JSFunction* fun = + JS_NewFunction(cx, ConnectionCallback, 2, 0, "ConnectionCallback"); MOZ_RELEASE_ASSERT(fun); JS::RootedValue callback(cx, JS::ObjectValue(*(JSObject*)fun)); if (NS_FAILED(gConnection->Initialize(callback))) { @@ -307,9 +308,10 @@ void CreateReplayingCloudProcess(base::ProcessId aProcessId, aChannelId, Channel::Kind::ParentCloud, [=](Message::UniquePtr aMsg) { RefPtr runnable = - new SendMessageToCloudRunnable(connectionId, std::move(aMsg)); + new SendMessageToCloudRunnable(connectionId, std::move(aMsg)); NS_DispatchToMainThread(runnable); - }, aProcessId); + }, + aProcessId); while ((size_t)connectionId >= gConnectionChannels.length()) { gConnectionChannels.append(nullptr); } diff --git a/toolkit/xre/glxtest.cpp b/toolkit/xre/glxtest.cpp index 6db6fa7ec81e..57fb989bf6db 100644 --- a/toolkit/xre/glxtest.cpp +++ b/toolkit/xre/glxtest.cpp @@ -37,8 +37,8 @@ #include "mozilla/Unused.h" #ifdef MOZ_WAYLAND -#include "nsAppRunner.h" // for IsWaylandDisabled -#include "mozilla/widget/mozwayland.h" +# include "nsAppRunner.h" // for IsWaylandDisabled +# include "mozilla/widget/mozwayland.h" #endif // stuff from glx.h @@ -552,7 +552,8 @@ bool fire_glxtest_process() { write_end_of_the_pipe = pfd[1]; close_logging(); // TODO: --display command line argument is not properly handled - // NOTE: prefers X for now because eglQueryRendererIntegerMESA does not exist yet + // NOTE: prefers X for now because eglQueryRendererIntegerMESA does not + // exist yet #ifdef MOZ_WAYLAND if (IsWaylandDisabled() || getenv("DISPLAY") || !wayland_egltest()) #endif diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index d907ce1f8958..be1b5723a8cf 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -948,8 +948,7 @@ void nsLookAndFeel::ConfigureContentGtkTheme() { mozilla::Preferences::GetCString("widget.content.gtk-theme-override", themeOverride); if (!themeOverride.IsEmpty()) { - g_object_set(settings, "gtk-theme-name", themeOverride.get(), - nullptr); + g_object_set(settings, "gtk-theme-name", themeOverride.get(), nullptr); LOG(("ConfigureContentGtkTheme(%s)\n", themeOverride.get())); } else { LOG(("ConfigureContentGtkTheme(%s)\n", GetGtkTheme().get())); diff --git a/widget/windows/nsWindowBase.cpp b/widget/windows/nsWindowBase.cpp index 4ff3d0d799dd..0d3cd6a6d336 100644 --- a/widget/windows/nsWindowBase.cpp +++ b/widget/windows/nsWindowBase.cpp @@ -221,8 +221,7 @@ nsresult nsWindowBase::ClearNativeTouchSequence(nsIObserver* aObserver) { // cancel all input points for (auto iter = mActivePointers.Iter(); !iter.Done(); iter.Next()) { auto info = iter.UserData(); - InjectTouchPoint(info->mPointerId, info->mPosition, - POINTER_FLAG_CANCELED); + InjectTouchPoint(info->mPointerId, info->mPosition, POINTER_FLAG_CANCELED); iter.Remove(); } diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index 3991ade2d738..bda18f9c4408 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -79,8 +79,7 @@ CycleCollectedJSContext::~CycleCollectedJSContext() { return; } - JS::SetHostCleanupFinalizationGroupCallback( - mJSContext, nullptr, nullptr); + JS::SetHostCleanupFinalizationGroupCallback(mJSContext, nullptr, nullptr); mFinalizationGroupsToCleanUp.reset(); JS_SetContextPrivate(mJSContext, nullptr); @@ -745,7 +744,8 @@ nsresult CycleCollectedJSContext::NotifyUnhandledRejections::Cancel() { class CleanupFinalizationGroupsRunnable : public CancelableRunnable { public: explicit CleanupFinalizationGroupsRunnable(CycleCollectedJSContext* aContext) - : CancelableRunnable("CleanupFinalizationGroupsRunnable"), mContext(aContext) {} + : CancelableRunnable("CleanupFinalizationGroupsRunnable"), + mContext(aContext) {} NS_DECL_NSIRUNNABLE private: CycleCollectedJSContext* mContext; diff --git a/xpcom/base/CycleCollectedJSContext.h b/xpcom/base/CycleCollectedJSContext.h index fc3f3d6d2a1c..9d15c1b7d782 100644 --- a/xpcom/base/CycleCollectedJSContext.h +++ b/xpcom/base/CycleCollectedJSContext.h @@ -85,9 +85,7 @@ class MicroTaskRunnable { virtual ~MicroTaskRunnable() = default; }; -class CycleCollectedJSContext - : dom::PerThreadAtomCache, - private JS::JobQueue { +class CycleCollectedJSContext : dom::PerThreadAtomCache, private JS::JobQueue { friend class CycleCollectedJSRuntime; protected: diff --git a/xpcom/base/Logging.cpp b/xpcom/base/Logging.cpp index bbfebac76175..aac25cc6572c 100644 --- a/xpcom/base/Logging.cpp +++ b/xpcom/base/Logging.cpp @@ -640,8 +640,8 @@ void LogModule::Printv(LogLevel aLevel, const char* aFmt, va_list aArgs) const { sLogModuleManager->Print(Name(), aLevel, aFmt, aArgs); } -void LogModule::Printv(LogLevel aLevel, const TimeStamp* aStart, const char* aFmt, - va_list aArgs) const { +void LogModule::Printv(LogLevel aLevel, const TimeStamp* aStart, + const char* aFmt, va_list aArgs) const { MOZ_ASSERT(sLogModuleManager != nullptr); // Forward to LogModule manager w/ level and name