Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D24168

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-03-31 15:12:55 +00:00
parent 08639a4653
commit ef0bfc3822
111 changed files with 463 additions and 500 deletions

View File

@ -5,11 +5,12 @@
* Insert URLs into Internet Explorer (IE) history so we can test importing
* them.
*
* See API docs at https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774949(v%3dvs.85)
* See API docs at
* https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms774949(v%3dvs.85)
*/
#include <urlhist.h> // IUrlHistoryStg
#include <shlguid.h> // SID_SUrlHistory
#include <urlhist.h> // IUrlHistoryStg
#include <shlguid.h> // SID_SUrlHistory
int main(int argc, char** argv) {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@ -19,14 +20,16 @@ int main(int argc, char** argv) {
}
IUrlHistoryStg* ieHist;
hr = ::CoCreateInstance(CLSID_CUrlHistory, nullptr, CLSCTX_INPROC_SERVER,
IID_IUrlHistoryStg, reinterpret_cast<void**>(&ieHist));
hr =
::CoCreateInstance(CLSID_CUrlHistory, nullptr, CLSCTX_INPROC_SERVER,
IID_IUrlHistoryStg, reinterpret_cast<void**>(&ieHist));
if (FAILED(hr)) return -2;
hr = ieHist->AddUrl(L"http://www.mozilla.org/1", L"Mozilla HTTP Test", 0);
if (FAILED(hr)) return -3;
hr = ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊", 0);
hr = ieHist->AddUrl(L"https://www.mozilla.org/2", L"Mozilla HTTPS Test 🦊",
0);
if (FAILED(hr)) return -4;
CoUninitialize();

View File

@ -447,7 +447,6 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
}
/////////////////////////////
// nsScriptSecurityManager //
/////////////////////////////

View File

@ -22,11 +22,10 @@ CSSPseudoElement::CSSPseudoElement(dom::Element* aElement,
PseudoStyleType aType)
: mOriginatingElement(aElement), mPseudoType(aType) {
MOZ_ASSERT(aElement);
MOZ_ASSERT(
aType == PseudoStyleType::after ||
aType == PseudoStyleType::before ||
aType == PseudoStyleType::marker,
"Unexpected Pseudo Type");
MOZ_ASSERT(aType == PseudoStyleType::after ||
aType == PseudoStyleType::before ||
aType == PseudoStyleType::marker,
"Unexpected Pseudo Type");
}
CSSPseudoElement::~CSSPseudoElement() {

View File

@ -335,14 +335,14 @@ void EffectCompositor::ClearRestyleRequestsFor(Element* aElement) {
PseudoStyleType pseudoType = aElement->GetPseudoElementType();
if (pseudoType == PseudoStyleType::NotPseudo) {
PseudoElementHashEntry::KeyType notPseudoKey =
{aElement, PseudoStyleType::NotPseudo};
PseudoElementHashEntry::KeyType beforePseudoKey =
{aElement, PseudoStyleType::before};
PseudoElementHashEntry::KeyType afterPseudoKey =
{aElement, PseudoStyleType::after};
PseudoElementHashEntry::KeyType markerPseudoKey =
{aElement, PseudoStyleType::marker};
PseudoElementHashEntry::KeyType notPseudoKey = {aElement,
PseudoStyleType::NotPseudo};
PseudoElementHashEntry::KeyType beforePseudoKey = {aElement,
PseudoStyleType::before};
PseudoElementHashEntry::KeyType afterPseudoKey = {aElement,
PseudoStyleType::after};
PseudoElementHashEntry::KeyType markerPseudoKey = {aElement,
PseudoStyleType::marker};
elementsToRestyle.Remove(notPseudoKey);
elementsToRestyle.Remove(beforePseudoKey);

View File

@ -104,7 +104,8 @@ class EffectCompositor {
void PostRestyleForThrottledAnimations();
// Clear all pending restyle requests for the given (pseudo-) element (and its
// ::before, ::after and ::marker elements if the given element is not pseudo).
// ::before, ::after and ::marker elements if the given element is not
// pseudo).
void ClearRestyleRequestsFor(dom::Element* aElement);
// Called when computed style on the specified (pseudo-) element might
@ -203,9 +204,9 @@ class EffectCompositor {
// Returns the target element for restyling.
//
// If |aPseudoType| is ::after, ::before or ::marker, returns the generated content
// element of which |aElement| is the parent. If |aPseudoType| is any other
// pseudo type (other than PseudoStyleType::NotPseudo) returns nullptr.
// If |aPseudoType| is ::after, ::before or ::marker, returns the generated
// content element of which |aElement| is the parent. If |aPseudoType| is any
// other pseudo type (other than PseudoStyleType::NotPseudo) returns nullptr.
// Otherwise, returns |aElement|.
static dom::Element* GetElementToRestyle(dom::Element* aElement,
PseudoStyleType aPseudoType);

View File

@ -151,8 +151,7 @@ nsAtom** EffectSet::GetEffectSetPropertyAtoms() {
nsGkAtoms::animationEffectsProperty,
nsGkAtoms::animationEffectsForBeforeProperty,
nsGkAtoms::animationEffectsForAfterProperty,
nsGkAtoms::animationEffectsForMarkerProperty,
nullptr};
nsGkAtoms::animationEffectsForMarkerProperty, nullptr};
return effectSetPropertyAtoms;
}

View File

@ -7,12 +7,12 @@
#define mozilla_dom_Document_h___
#include "mozilla/EventStates.h" // for EventStates
#include "mozilla/FlushType.h" // for enum
#include "mozilla/Pair.h" // for Pair
#include "nsAutoPtr.h" // for member
#include "nsCOMArray.h" // for member
#include "nsCompatibility.h" // for member
#include "nsCOMPtr.h" // for member
#include "mozilla/FlushType.h" // for enum
#include "mozilla/Pair.h" // for Pair
#include "nsAutoPtr.h" // for member
#include "nsCOMArray.h" // for member
#include "nsCompatibility.h" // for member
#include "nsCOMPtr.h" // for member
#include "nsICookieSettings.h"
#include "nsGkAtoms.h" // for static class members
#include "nsIApplicationCache.h"

View File

@ -3506,8 +3506,7 @@ void Element::GetAnimations(const AnimationFilter& filter,
return;
}
if (!filter.mSubtree ||
pseudoType == PseudoStyleType::before ||
if (!filter.mSubtree || pseudoType == PseudoStyleType::before ||
pseudoType == PseudoStyleType::after ||
pseudoType == PseudoStyleType::marker) {
GetAnimationsUnsorted(elem, pseudoType, aAnimations);

View File

@ -976,8 +976,7 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
mLastFiringIndex = timeout->mFiringIndex;
#endif
// This timeout is good to run.
bool timeout_was_cleared =
window->RunTimeoutHandler(timeout, scx);
bool timeout_was_cleared = window->RunTimeoutHandler(timeout, scx);
#if MOZ_GECKO_PROFILER
if (profiler_is_active()) {
TimeDuration elapsed = now - timeout->SubmitTime();

View File

@ -50,6 +50,5 @@ void nsFrameLoaderOwner::ChangeRemoteness(
// ChromeOnlyDispatch is turns on to make sure this isn't fired into content.
(new AsyncEventDispatcher(owner, NS_LITERAL_STRING("XULFrameLoaderCreated"),
CanBubble::eYes, ChromeOnlyDispatch::eYes))
->RunDOMEventWhenSafe();
->RunDOMEventWhenSafe();
}

View File

@ -559,9 +559,10 @@ bool nsJSUtils::GetScopeChainForElement(
}
/* static */
bool nsJSUtils::GetScopeChainForXBL(JSContext* aCx, Element* aElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain) {
bool nsJSUtils::GetScopeChainForXBL(
JSContext* aCx, Element* aElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain) {
if (!aElement) {
return true;
}

View File

@ -231,10 +231,10 @@ class nsJSUtils {
// <binding> element had the simpleScopeChain attribute.
//
// This is to prevent footguns like bug 1446342.
static bool GetScopeChainForXBL(JSContext* aCx,
mozilla::dom::Element* aBoundElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain);
static bool GetScopeChainForXBL(
JSContext* aCx, mozilla::dom::Element* aBoundElement,
const nsXBLPrototypeBinding& aProtoBinding,
JS::MutableHandleVector<JSObject*> aScopeChain);
static void ResetTimeZone();
};

View File

@ -133,8 +133,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
// We manage 4 states here: ACTIVE, HOVER, DRAGOVER, URLTARGET
static bool ManagesState(EventStates aState) {
return aState == NS_EVENT_STATE_ACTIVE ||
aState == NS_EVENT_STATE_HOVER ||
return aState == NS_EVENT_STATE_ACTIVE || aState == NS_EVENT_STATE_HOVER ||
aState == NS_EVENT_STATE_DRAGOVER ||
aState == NS_EVENT_STATE_URLTARGET;
}

View File

@ -175,7 +175,7 @@ class BlobURLsReporter final : public nsIMemoryReporter {
NS_IMETHOD CollectReports(nsIHandleReportCallback* aCallback,
nsISupports* aData, bool aAnonymize) override {
MOZ_ASSERT(NS_IsMainThread(),
"without locking gDataTable is main-thread only");
"without locking gDataTable is main-thread only");
if (!gDataTable) {
return NS_OK;
}

View File

@ -96,7 +96,7 @@ void HTMLSharedListElement::MapOLAttributesIntoRule(
bool haveReversed = !!aAttributes->GetAttr(nsGkAtoms::reversed);
if (haveReversed) {
if (haveStart) {
start += 2; // i.e. the attr value + 1
start += 2; // i.e. the attr value + 1
} else {
start = std::numeric_limits<int32_t>::min();
}

View File

@ -1792,9 +1792,9 @@ bool ContentChild::SendPBrowserConstructor(
return false;
}
return PContentChild::SendPBrowserConstructor(aActor, aTabId, aSameTabGroupAs,
aContext, aChromeFlags, aCpID,
aBrowsingContext, aIsForBrowser);
return PContentChild::SendPBrowserConstructor(
aActor, aTabId, aSameTabGroupAs, aContext, aChromeFlags, aCpID,
aBrowsingContext, aIsForBrowser);
}
mozilla::ipc::IPCResult ContentChild::RecvPBrowserConstructor(
@ -3792,7 +3792,8 @@ mozilla::ipc::IPCResult ContentChild::RecvRegisterBrowsingContextGroup(
MOZ_ASSERT_IF(parent, parent->Group() == group);
#endif
RefPtr<BrowsingContext> ctxt = BrowsingContext::CreateFromIPC(std::move(init), group, nullptr);
RefPtr<BrowsingContext> ctxt =
BrowsingContext::CreateFromIPC(std::move(init), group, nullptr);
// FIXME: We should deal with cached & detached contexts as well.
ctxt->Attach(/* aFromIPC */ true);

View File

@ -571,8 +571,9 @@ class TabChild final : public TabChildBase,
void ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId,
bool aPreventDefault) const;
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<layers::SLGuidAndRenderRoot>& aTargets) const;
void SetTargetAPZC(
uint64_t aInputBlockId,
const nsTArray<layers::SLGuidAndRenderRoot>& aTargets) const;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
mozilla::ipc::IPCResult RecvHandleTap(
const layers::GeckoContentController::TapType& aType,

View File

@ -338,7 +338,8 @@ bool ADTSTrackDemuxer::Init() {
mInfo->mDuration.ToMicroseconds());
// AAC encoder delay is by default 2112 audio frames.
// See https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
// See
// https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
// So we always seek 2112 frames prior the seeking point.
mPreRoll = TimeUnit::FromMicroseconds(2112 * 1000000ULL / mSamplesPerSecond);
return mSamplesPerSecond && mChannels;

View File

@ -145,7 +145,6 @@ class ADTSTrackDemuxer : public MediaTrackDemuxer,
// Amount of pre-roll time when seeking.
// AAC encoder delay is by default 2112 audio frames.
media::TimeUnit mPreRoll;
};
} // namespace mozilla

View File

@ -321,8 +321,8 @@ void TextTrack::GetCurrentCuesAndOtherCues(
// Negative length cue, which is possible because user can set cue's end
// time arbitrary.
if (cue->EndTime() < cue->StartTime()) {
WEBVTT_LOG("[BAD TIME] skip cue %p [%f:%f] with negative length",
cue, cue->StartTime(), cue->EndTime());
WEBVTT_LOG("[BAD TIME] skip cue %p [%f:%f] with negative length", cue,
cue->StartTime(), cue->EndTime());
continue;
}
media::TimeInterval cueInterval(

View File

@ -104,16 +104,15 @@ class TextTrack final : public DOMEventTargetHelper {
// would add or remove the cue to the active cue list.
void NotifyCueActiveStateChanged(TextTrackCue* aCue);
// Use this function to request current cues, which start time are less than or
// equal to the current playback position and whose end times are greater than
// the current playback position, and other cues, which are not in the current
// cues. Because there would be LOTS of cues in the other cues, and we don't
// actually need all of them. Therefore, we use a time interval to get the
// cues which are overlapping within the time interval.
void GetCurrentCuesAndOtherCues(
RefPtr<TextTrackCueList>& aCurrentCues,
RefPtr<TextTrackCueList>& aOtherCues,
const media::TimeInterval& aInterval) const;
// Use this function to request current cues, which start time are less than
// or equal to the current playback position and whose end times are greater
// than the current playback position, and other cues, which are not in the
// current cues. Because there would be LOTS of cues in the other cues, and we
// don't actually need all of them. Therefore, we use a time interval to get
// the cues which are overlapping within the time interval.
void GetCurrentCuesAndOtherCues(RefPtr<TextTrackCueList>& aCurrentCues,
RefPtr<TextTrackCueList>& aOtherCues,
const media::TimeInterval& aInterval) const;
private:
~TextTrack();

View File

@ -12,8 +12,9 @@
extern mozilla::LazyLogModule gTextTrackLog;
#define LOG(msg, ...) \
MOZ_LOG(gTextTrackLog, LogLevel::Debug, ("TextTrackCue=%p, " msg, this, ##__VA_ARGS__))
#define LOG(msg, ...) \
MOZ_LOG(gTextTrackLog, LogLevel::Debug, \
("TextTrackCue=%p, " msg, this, ##__VA_ARGS__))
namespace mozilla {
namespace dom {

View File

@ -270,7 +270,7 @@ class VideoFrameConverter {
("Sending a black video frame"));
webrtc::I420Buffer::SetBlack(buffer);
webrtc::VideoFrame frame(buffer, 0, // not setting rtp timestamp
webrtc::VideoFrame frame(buffer, 0, // not setting rtp timestamp
now, webrtc::kVideoRotation_0);
VideoFrameConverted(frame);
return;
@ -296,7 +296,7 @@ class VideoFrameConverter {
rtc::KeepRefUntilDone(image)));
webrtc::VideoFrame i420_frame(video_frame_buffer,
0, // not setting rtp timestamp
0, // not setting rtp timestamp
now, webrtc::kVideoRotation_0);
MOZ_LOG(gVideoFrameConverterLog, LogLevel::Verbose,
("Sending an I420 video frame"));
@ -327,7 +327,7 @@ class VideoFrameConverter {
return;
}
webrtc::VideoFrame frame(buffer, 0, //not setting rtp timestamp
webrtc::VideoFrame frame(buffer, 0, // not setting rtp timestamp
now, webrtc::kVideoRotation_0);
VideoFrameConverted(frame);
}
@ -353,4 +353,4 @@ class VideoFrameConverter {
} // namespace mozilla
#endif // VideoFrameConverter_h
#endif // VideoFrameConverter_h

View File

@ -24,7 +24,8 @@ class RDDParent final : public PRDDParent {
bool Init(base::ProcessId aParentPid, const char* aParentBuildID,
MessageLoop* aIOLoop, IPC::Channel* aChannel);
mozilla::ipc::IPCResult RecvInit(const Maybe<ipc::FileDescriptor>& aBrokerFd, bool aStartMacSandbox);
mozilla::ipc::IPCResult RecvInit(const Maybe<ipc::FileDescriptor>& aBrokerFd,
bool aStartMacSandbox);
mozilla::ipc::IPCResult RecvInitProfiler(
Endpoint<PProfilerChild>&& aEndpoint);

View File

@ -148,8 +148,8 @@ struct MOZ_STACK_CLASS CreateDecoderParams final {
// The 'value' have to be the biggest enum from CreateDecoderParams::Option.
template <>
struct MaxEnumValue<::mozilla::CreateDecoderParams::Option> {
static constexpr unsigned int value = static_cast<unsigned int>(
CreateDecoderParams::Option::SENTINEL);
static constexpr unsigned int value =
static_cast<unsigned int>(CreateDecoderParams::Option::SENTINEL);
};
// The PlatformDecoderModule interface is used by the MediaFormatReader to

View File

@ -184,7 +184,7 @@ void DynamicsCompressor::process(const AudioBlock* sourceChunk,
break;
case 1:
m_sourceChannels[0] =
static_cast<const float*>(sourceChunk->mChannelData[0]);
static_cast<const float*>(sourceChunk->mChannelData[0]);
break;
default:
MOZ_CRASH("not supported.");

View File

@ -63,8 +63,7 @@ static nsString DefaultVideoName() {
*/
MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
: mTimer(nullptr),
mName(DefaultVideoName()) {}
: mTimer(nullptr), mName(DefaultVideoName()) {}
MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource() = default;

View File

@ -984,7 +984,7 @@ bool _evaluate(NPP npp, NPObject *npobj, NPString *script, NPVariant *result) {
JS::CompileOptions options(cx);
options.setFileAndLine(spec, 0);
JS::Rooted<JS::Value> rval(cx);
JS::RootedVector<JSObject*> scopeChain(cx);
JS::RootedVector<JSObject *> scopeChain(cx);
if (!JS_IsGlobalObject(obj) && !scopeChain.append(obj)) {
return false;
}

View File

@ -18,22 +18,22 @@ using mozilla::ipc::AssertIsOnBackgroundThread;
class ServiceWorkerRegistrationProxy::DelayedUpdate final
: public nsITimerCallback {
RefPtr<ServiceWorkerRegistrationProxy> mProxy;
RefPtr<ServiceWorkerRegistrationPromise::Private> mPromise;
nsCOMPtr<nsITimer> mTimer;
RefPtr<ServiceWorkerRegistrationProxy> mProxy;
RefPtr<ServiceWorkerRegistrationPromise::Private> mPromise;
nsCOMPtr<nsITimer> mTimer;
~DelayedUpdate() = default;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
~DelayedUpdate() = default;
DelayedUpdate(RefPtr<ServiceWorkerRegistrationProxy>&& aProxy,
RefPtr<ServiceWorkerRegistrationPromise::Private>&& aPromise,
uint32_t delay);
void Reject();
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSITIMERCALLBACK
DelayedUpdate(RefPtr<ServiceWorkerRegistrationProxy>&& aProxy,
RefPtr<ServiceWorkerRegistrationPromise::Private>&& aPromise,
uint32_t delay);
void Reject();
};
ServiceWorkerRegistrationProxy::~ServiceWorkerRegistrationProxy() {
// Any thread
MOZ_DIAGNOSTIC_ASSERT(!mActor);
@ -250,25 +250,21 @@ NS_IMPL_ISUPPORTS(ServiceWorkerRegistrationProxy::DelayedUpdate,
nsITimerCallback)
ServiceWorkerRegistrationProxy::DelayedUpdate::DelayedUpdate(
RefPtr<ServiceWorkerRegistrationProxy >&& aProxy,
RefPtr<ServiceWorkerRegistrationPromise::Private >&& aPromise,
RefPtr<ServiceWorkerRegistrationProxy>&& aProxy,
RefPtr<ServiceWorkerRegistrationPromise::Private>&& aPromise,
uint32_t delay)
: mProxy(std::move(aProxy))
, mPromise(std::move(aPromise))
{
: mProxy(std::move(aProxy)), mPromise(std::move(aPromise)) {
MOZ_DIAGNOSTIC_ASSERT(mProxy);
MOZ_DIAGNOSTIC_ASSERT(mPromise);
mProxy->mDelayedUpdate = this;
Result<nsCOMPtr<nsITimer>, nsresult> result = NS_NewTimerWithCallback(
this, delay, nsITimer::TYPE_ONE_SHOT,
SystemGroup::EventTargetFor(TaskCategory::Other));
Result<nsCOMPtr<nsITimer>, nsresult> result =
NS_NewTimerWithCallback(this, delay, nsITimer::TYPE_ONE_SHOT,
SystemGroup::EventTargetFor(TaskCategory::Other));
mTimer = result.unwrapOr(nullptr);
MOZ_DIAGNOSTIC_ASSERT(mTimer);
}
void
ServiceWorkerRegistrationProxy::DelayedUpdate::Reject()
{
void ServiceWorkerRegistrationProxy::DelayedUpdate::Reject() {
MOZ_DIAGNOSTIC_ASSERT(mPromise);
if (mTimer) {
mTimer->Cancel();
@ -278,8 +274,7 @@ ServiceWorkerRegistrationProxy::DelayedUpdate::Reject()
}
NS_IMETHODIMP
ServiceWorkerRegistrationProxy::DelayedUpdate::Notify(nsITimer* aTimer)
{
ServiceWorkerRegistrationProxy::DelayedUpdate::Notify(nsITimer* aTimer) {
auto scopeExit = MakeScopeExit(
[&] { mPromise->Reject(NS_ERROR_DOM_INVALID_STATE_ERR, __func__); });
MOZ_DIAGNOSTIC_ASSERT((mProxy->mDelayedUpdate == this));
@ -323,7 +318,8 @@ ServiceWorkerRegistrationProxy::Update() {
new ServiceWorkerRegistrationProxy::DelayedUpdate(
std::move(self), std::move(promise), delay);
} else {
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
RefPtr<ServiceWorkerManager> swm =
ServiceWorkerManager::GetInstance();
NS_ENSURE_TRUE_VOID(swm);
RefPtr<UpdateCallback> cb = new UpdateCallback(std::move(promise));

View File

@ -207,8 +207,7 @@ already_AddRefed<SVGAnimatedRect> SVGViewBox::ToSVGAnimatedRect(
return domAnimatedRect.forget();
}
already_AddRefed<SVGIRect> SVGViewBox::ToDOMBaseVal(
SVGElement* aSVGElement) {
already_AddRefed<SVGIRect> SVGViewBox::ToDOMBaseVal(SVGElement* aSVGElement) {
if (!mHasBaseVal || mBaseVal.none) {
return nullptr;
}
@ -226,8 +225,7 @@ SVGViewBox::DOMBaseVal::~DOMBaseVal() {
sBaseSVGViewBoxTearoffTable.RemoveTearoff(mVal);
}
already_AddRefed<SVGIRect> SVGViewBox::ToDOMAnimVal(
SVGElement* aSVGElement) {
already_AddRefed<SVGIRect> SVGViewBox::ToDOMAnimVal(SVGElement* aSVGElement) {
if ((mAnimVal && mAnimVal->none) ||
(!mAnimVal && (!mHasBaseVal || mBaseVal.none))) {
return nullptr;

View File

@ -202,8 +202,7 @@ class XMLHttpRequestMainThread final : public XMLHttpRequest,
void Construct(nsIPrincipal* aPrincipal, nsIGlobalObject* aGlobalObject,
nsICookieSettings* aCookieSettings, bool aForWorker,
nsIURI* aBaseURI = nullptr,
nsILoadGroup* aLoadGroup = nullptr,
nsIURI* aBaseURI = nullptr, nsILoadGroup* aLoadGroup = nullptr,
PerformanceStorage* aPerformanceStorage = nullptr,
nsICSPEventListener* aCSPEventListener = nullptr) {
MOZ_ASSERT(aPrincipal);
@ -781,28 +780,26 @@ class nsXMLHttpRequestXPCOMifier final : public nsIStreamListener,
RefPtr<XMLHttpRequestMainThread> mXHR;
};
class XMLHttpRequestDoneNotifier : public Runnable
{
class XMLHttpRequestDoneNotifier : public Runnable {
public:
explicit XMLHttpRequestDoneNotifier(XMLHttpRequestMainThread* aXHR)
: Runnable("XMLHttpRequestDoneNotifier"), mXHR(aXHR) {}
NS_IMETHOD Run() override {
if (mXHR) {
RefPtr<XMLHttpRequestMainThread> xhr = mXHR;
mXHR = nullptr;
xhr->ChangeStateToDoneInternal();
}
return NS_OK;
}
NS_IMETHOD Run() override {
if (mXHR) {
RefPtr<XMLHttpRequestMainThread> xhr = mXHR;
mXHR = nullptr;
xhr->ChangeStateToDoneInternal();
}
return NS_OK;
}
void Disconnect() { mXHR = nullptr; }
private:
XMLHttpRequestMainThread* mXHR;
};
class nsXHRParseEndListener : public nsIDOMEventListener {
public:
NS_DECL_ISUPPORTS

View File

@ -779,8 +779,7 @@ bool Proxy::Init() {
mXHR = new XMLHttpRequestMainThread();
mXHR->Construct(mWorkerPrivate->GetPrincipal(),
ownerWindow ? ownerWindow->AsGlobal() : nullptr,
mWorkerPrivate->CookieSettings(),
true,
mWorkerPrivate->CookieSettings(), true,
mWorkerPrivate->GetBaseURI(), mWorkerPrivate->GetLoadGroup(),
mWorkerPrivate->GetPerformanceStorage(),
mWorkerPrivate->CSPEventListener());

View File

@ -434,9 +434,8 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
static_cast<const LinearGradientPattern&>(aPattern);
GradientStopsSkia* stops =
static_cast<GradientStopsSkia*>(pat.mStops.get());
if (!stops || stops->mCount < 2 ||
!pat.mBegin.IsFinite() || !pat.mEnd.IsFinite() ||
pat.mBegin == pat.mEnd) {
if (!stops || stops->mCount < 2 || !pat.mBegin.IsFinite() ||
!pat.mEnd.IsFinite() || pat.mBegin == pat.mEnd) {
aPaint.setColor(SK_ColorTRANSPARENT);
} else {
SkShader::TileMode mode =
@ -468,9 +467,9 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
static_cast<const RadialGradientPattern&>(aPattern);
GradientStopsSkia* stops =
static_cast<GradientStopsSkia*>(pat.mStops.get());
if (!stops || stops->mCount < 2 ||
!pat.mCenter1.IsFinite() || !IsFinite(pat.mRadius1) ||
!pat.mCenter2.IsFinite() || !IsFinite(pat.mRadius2) ||
if (!stops || stops->mCount < 2 || !pat.mCenter1.IsFinite() ||
!IsFinite(pat.mRadius1) || !pat.mCenter2.IsFinite() ||
!IsFinite(pat.mRadius2) ||
(pat.mCenter1 == pat.mCenter2 && pat.mRadius1 == pat.mRadius2)) {
aPaint.setColor(SK_ColorTRANSPARENT);
} else {
@ -599,7 +598,8 @@ struct AutoPaintSetup {
temp.setBlendMode(GfxOpToSkiaOp(aOptions.mCompositionOp));
temp.setAlpha(ColorFloatToByte(aOptions.mAlpha));
// TODO: Get a rect here
SkCanvas::SaveLayerRec rec(nullptr, &temp, SkCanvas::kPreserveLCDText_SaveLayerFlag);
SkCanvas::SaveLayerRec rec(nullptr, &temp,
SkCanvas::kPreserveLCDText_SaveLayerFlag);
mCanvas->saveLayer(rec);
mNeedsRestore = true;
} else {
@ -1324,9 +1324,9 @@ void DrawTargetSkia::DrawGlyphs(ScaledFont* aFont, const GlyphBuffer& aBuffer,
SkFont font(sk_ref_sp(typeface), SkFloatToScalar(skiaFont->mSize));
bool useSubpixelAA = ShouldLCDRenderText(aFont->GetType(), aaMode);
font.setEdging(useSubpixelAA ?
SkFont::Edging::kSubpixelAntiAlias :
(aaEnabled ? SkFont::Edging::kAntiAlias : SkFont::Edging::kAlias));
font.setEdging(useSubpixelAA ? SkFont::Edging::kSubpixelAntiAlias
: (aaEnabled ? SkFont::Edging::kAntiAlias
: SkFont::Edging::kAlias));
bool useSubpixelText = true;
switch (aFont->GetType()) {

View File

@ -118,21 +118,23 @@ SkPath ScaledFontBase::GetSkiaPathForGlyphs(const GlyphBuffer &aBuffer) {
}
struct Context {
const Glyph* mGlyph;
const Glyph *mGlyph;
SkPath mPath;
} ctx = { aBuffer.mGlyphs };
} ctx = {aBuffer.mGlyphs};
font.getPaths(indices.data(), indices.size(),
[](const SkPath* glyphPath, const SkMatrix& scaleMatrix, void* ctxPtr) {
Context& ctx = *reinterpret_cast<Context*>(ctxPtr);
if (glyphPath) {
SkMatrix transMatrix(scaleMatrix);
transMatrix.postTranslate(SkFloatToScalar(ctx.mGlyph->mPosition.x),
SkFloatToScalar(ctx.mGlyph->mPosition.y));
ctx.mPath.addPath(*glyphPath, transMatrix);
}
++ctx.mGlyph;
}, &ctx);
font.getPaths(
indices.data(), indices.size(),
[](const SkPath *glyphPath, const SkMatrix &scaleMatrix, void *ctxPtr) {
Context &ctx = *reinterpret_cast<Context *>(ctxPtr);
if (glyphPath) {
SkMatrix transMatrix(scaleMatrix);
transMatrix.postTranslate(SkFloatToScalar(ctx.mGlyph->mPosition.x),
SkFloatToScalar(ctx.mGlyph->mPosition.y));
ctx.mPath.addPath(*glyphPath, transMatrix);
}
++ctx.mGlyph;
},
&ctx);
return ctx.mPath;
}

View File

@ -55,8 +55,8 @@ void PaintCounter::Draw(Compositor* aCompositor, TimeDuration aPaintTime,
SkFont font(SkTypeface::MakeDefault(), 32);
mCanvas->clear(SK_ColorTRANSPARENT);
mCanvas->drawSimpleText(buffer, strlen(buffer), kUTF8_SkTextEncoding,
10, 30, font, paint);
mCanvas->drawSimpleText(buffer, strlen(buffer), kUTF8_SkTextEncoding, 10, 30,
font, paint);
mCanvas->flush();
if (!mTextureSource) {

View File

@ -235,8 +235,7 @@ void ClusterIterator::Next() {
bool baseIsEmoji = (GetEmojiPresentation(ch) == EmojiDefault) ||
(GetEmojiPresentation(ch) == TextDefault &&
((mPos < mLimit && *mPos == kVS16) ||
(mPos + 1 < mLimit &&
*mPos == kFitzpatrickHigh &&
(mPos + 1 < mLimit && *mPos == kFitzpatrickHigh &&
*(mPos + 1) >= kFitzpatrickLowFirst &&
*(mPos + 1) <= kFitzpatrickLowLast)));
bool prevWasZwj = false;
@ -254,12 +253,12 @@ void ClusterIterator::Next() {
chLen = 2;
}
bool extendCluster = IsClusterExtender(ch) ||
bool extendCluster =
IsClusterExtender(ch) ||
(baseIsEmoji && prevWasZwj &&
((GetEmojiPresentation(ch) == EmojiDefault) ||
(GetEmojiPresentation(ch) == TextDefault &&
mPos + chLen < mLimit &&
*(mPos + chLen) == kVS16)));
((GetEmojiPresentation(ch) == EmojiDefault) ||
(GetEmojiPresentation(ch) == TextDefault && mPos + chLen < mLimit &&
*(mPos + chLen) == kVS16)));
if (!extendCluster) {
break;
}

View File

@ -627,7 +627,8 @@ bool Pickle::WriteBytes(const void* data, uint32_t data_len,
BeginWrite(data_len, alignment);
MOZ_ALWAYS_TRUE(buffers_.WriteBytes(reinterpret_cast<const char*>(data), data_len));
MOZ_ALWAYS_TRUE(
buffers_.WriteBytes(reinterpret_cast<const char*>(data), data_len));
EndWrite(data_len);
return true;

View File

@ -528,12 +528,12 @@ bool SharedMemoryBasic::Map(size_t size, void* fixed_address) {
}
kr = mach_vm_map(mach_task_self(), &address, round_page(size), 0,
fixed_address ? VM_FLAGS_FIXED : VM_FLAGS_ANYWHERE,
mPort, 0, false, vmProtection, vmProtection, VM_INHERIT_NONE);
fixed_address ? VM_FLAGS_FIXED : VM_FLAGS_ANYWHERE, mPort, 0, false,
vmProtection, vmProtection, VM_INHERIT_NONE);
if (kr != KERN_SUCCESS) {
if (!fixed_address) {
LOG_ERROR("Failed to map shared memory (%zu bytes) into %x, port %x. %s (%x)\n",
size, mach_task_self(), mPort, mach_error_string(kr), kr);
LOG_ERROR("Failed to map shared memory (%zu bytes) into %x, port %x. %s (%x)\n", size,
mach_task_self(), mPort, mach_error_string(kr), kr);
}
return false;
}
@ -556,9 +556,8 @@ bool SharedMemoryBasic::Map(size_t size, void* fixed_address) {
void* SharedMemoryBasic::FindFreeAddressSpace(size_t size) {
mach_vm_address_t address = 0;
size = round_page(size);
if (mach_vm_map(mach_task_self(), &address, size, 0,
VM_FLAGS_ANYWHERE, MEMORY_OBJECT_NULL, 0, false, VM_PROT_NONE,
VM_PROT_NONE, VM_INHERIT_NONE) != KERN_SUCCESS ||
if (mach_vm_map(mach_task_self(), &address, size, 0, VM_FLAGS_ANYWHERE, MEMORY_OBJECT_NULL, 0,
false, VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_NONE) != KERN_SUCCESS ||
vm_deallocate(mach_task_self(), address, size) != KERN_SUCCESS) {
return nullptr;
}

View File

@ -281,14 +281,14 @@ class MutableWrappedPtrOperations<JS::GCVector<T, Capacity, AllocPolicy>,
};
template <typename Wrapper, typename T, typename AllocPolicy>
class WrappedPtrOperations<JS::StackGCVector<T, AllocPolicy>, Wrapper> :
public WrappedPtrOperations<typename JS::StackGCVector<T, AllocPolicy>::Base,
Wrapper> {};
class WrappedPtrOperations<JS::StackGCVector<T, AllocPolicy>, Wrapper>
: public WrappedPtrOperations<
typename JS::StackGCVector<T, AllocPolicy>::Base, Wrapper> {};
template <typename Wrapper, typename T, typename AllocPolicy>
class MutableWrappedPtrOperations<JS::StackGCVector<T, AllocPolicy>, Wrapper> :
public MutableWrappedPtrOperations<typename JS::StackGCVector<T, AllocPolicy>::Base,
Wrapper> {};
class MutableWrappedPtrOperations<JS::StackGCVector<T, AllocPolicy>, Wrapper>
: public MutableWrappedPtrOperations<
typename JS::StackGCVector<T, AllocPolicy>::Base, Wrapper> {};
} // namespace js

View File

@ -28,7 +28,7 @@ class Compartment;
class Realm;
class Zone;
} // namespace JS
} // namespace JS
namespace JS {
@ -294,6 +294,6 @@ extern JS_PUBLIC_API RealmBehaviors& RealmBehaviorsRef(Realm* realm);
extern JS_PUBLIC_API RealmBehaviors& RealmBehaviorsRef(JSContext* cx);
} // namespace JS
} // namespace JS
#endif // js_RealmOptions_h
#endif // js_RealmOptions_h

View File

@ -3657,8 +3657,7 @@ static const JSFunctionSpec string_static_methods[] = {
JS_INLINABLE_FN("fromCodePoint", js::str_fromCodePoint, 1, 0,
StringFromCodePoint),
JS_SELF_HOSTED_FN("raw", "String_static_raw", 1, 0),
JS_FS_END};
JS_SELF_HOSTED_FN("raw", "String_static_raw", 1, 0), JS_FS_END};
/* static */
Shape* StringObject::assignInitialShape(JSContext* cx,

View File

@ -307,9 +307,9 @@ enum TypeCode {
// Descriptor of one field in a StructType. The name of the field is stored
// as the key to the hash entry.
struct FieldInfo {
HeapPtr<JSObject*> mType; // CType of the field
size_t mIndex; // index of the field in the struct (first is 0)
size_t mOffset; // offset of the field in the struct, in bytes
HeapPtr<JSObject*> mType; // CType of the field
size_t mIndex; // index of the field in the struct (first is 0)
size_t mOffset; // offset of the field in the struct, in bytes
void trace(JSTracer* trc) { TraceEdge(trc, &mType, "fieldType"); }
};

View File

@ -16,7 +16,7 @@
#include "frontend/BinAST-macros.h"
#include "frontend/BinASTRuntimeSupport.h"
#include "frontend/BytecodeCompiler.h" // IsIdentifier
#include "frontend/BytecodeCompiler.h" // IsIdentifier
#include "js/Result.h"

View File

@ -77,11 +77,12 @@ class BaselineInspector {
public:
typedef Vector<ReceiverGuard, 4, JitAllocPolicy> ReceiverVector;
typedef Vector<ObjectGroup*, 4, JitAllocPolicy> ObjectGroupVector;
MOZ_MUST_USE bool maybeInfoForPropertyOp(
jsbytecode* pc, ReceiverVector& receivers);
MOZ_MUST_USE bool maybeInfoForPropertyOp(jsbytecode* pc,
ReceiverVector& receivers);
MOZ_MUST_USE bool maybeInfoForProtoReadSlot(
jsbytecode* pc, ReceiverVector& receivers, JSObject** holder);
MOZ_MUST_USE bool maybeInfoForProtoReadSlot(jsbytecode* pc,
ReceiverVector& receivers,
JSObject** holder);
SetElemICInspector setElemICInspector(jsbytecode* pc) {
return makeICInspector<SetElemICInspector>(pc, ICStub::SetElem_Fallback);
@ -126,9 +127,11 @@ class BaselineInspector {
MOZ_MUST_USE bool megamorphicGetterSetterFunction(
jsbytecode* pc, jsid id, bool isGetter, JSFunction** getterOrSetter);
MOZ_MUST_USE bool commonSetPropFunction(
jsbytecode* pc, JSObject** holder, Shape** holderShape,
JSFunction** commonSetter, bool* isOwnProperty, ReceiverVector& receivers);
MOZ_MUST_USE bool commonSetPropFunction(jsbytecode* pc, JSObject** holder,
Shape** holderShape,
JSFunction** commonSetter,
bool* isOwnProperty,
ReceiverVector& receivers);
MOZ_MUST_USE bool instanceOfData(jsbytecode* pc, Shape** shape,
uint32_t* slot, JSObject** prototypeObject);

View File

@ -4436,8 +4436,7 @@ bool SetPropIRGenerator::tryAttachAddSlotStub(HandleObjectGroup oldGroup,
changeGroup, newGroup);
trackAttached("AddSlot");
} else {
size_t offset =
holder->dynamicSlotIndex(propShape->slot()) * sizeof(Value);
size_t offset = holder->dynamicSlotIndex(propShape->slot()) * sizeof(Value);
uint32_t numOldSlots = NativeObject::dynamicSlotsCount(oldShape);
uint32_t numNewSlots = NativeObject::dynamicSlotsCount(propShape);
if (numOldSlots == numNewSlots) {

View File

@ -1178,7 +1178,7 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
bool isSpread, bool isConstructing) {
writeOpWithOperandId(CacheOp::CallClassHook, calleeId);
writeOperandId(argc);
buffer_.writeByte(true); // may be cross-realm
buffer_.writeByte(true); // may be cross-realm
buffer_.writeByte(uint32_t(isSpread));
buffer_.writeByte(uint32_t(isConstructing));
void* target = JS_FUNC_TO_DATA_PTR(void*, hook);

View File

@ -3938,8 +3938,7 @@ void CodeGenerator::visitStoreSlotV(LStoreSlotV* lir) {
}
static void GuardReceiver(MacroAssembler& masm, const ReceiverGuard& guard,
Register obj,
Register scratch, Label* miss) {
Register obj, Register scratch, Label* miss) {
if (guard.group) {
masm.branchTestObjGroup(Assembler::NotEqual, obj, guard.group, scratch, obj,
miss);
@ -4070,8 +4069,7 @@ void CodeGenerator::visitSetPropertyPolymorphicV(
Register obj = ToRegister(ins->obj());
Register temp1 = ToRegister(ins->temp());
ValueOperand value = ToValue(ins, LSetPropertyPolymorphicV::Value);
emitSetPropertyPolymorphic(ins, obj, temp1,
TypedOrValueRegister(value));
emitSetPropertyPolymorphic(ins, obj, temp1, TypedOrValueRegister(value));
}
void CodeGenerator::visitSetPropertyPolymorphicT(

View File

@ -177,9 +177,11 @@ class CodeGenerator final : public CodeGeneratorSpecific {
void visitNewArrayCallVM(LNewArray* lir);
void visitNewObjectVMCall(LNewObject* lir);
void emitGetPropertyPolymorphic(LInstruction* lir, Register obj, Register scratch,
void emitGetPropertyPolymorphic(LInstruction* lir, Register obj,
Register scratch,
const TypedOrValueRegister& output);
void emitSetPropertyPolymorphic(LInstruction* lir, Register obj, Register scratch,
void emitSetPropertyPolymorphic(LInstruction* lir, Register obj,
Register scratch,
const ConstantOrRegister& value);
void emitCompareS(LInstruction* lir, JSOp op, Register left, Register right,
Register output);

View File

@ -916,8 +916,7 @@ class IonBuilder : public MIRGenerator,
MDefinition* addShapeGuardsForGetterSetter(
MDefinition* obj, JSObject* holder, Shape* holderShape,
const BaselineInspector::ReceiverVector& receivers,
bool isOwnProperty);
const BaselineInspector::ReceiverVector& receivers, bool isOwnProperty);
AbortReasonOr<Ok> annotateGetPropertyCache(MDefinition* obj,
PropertyName* name,

View File

@ -1677,7 +1677,6 @@ bool IonCacheIRCompiler::emitAllocateAndStoreDynamicSlot() {
return emitAddAndStoreSlotShared(CacheOp::AllocateAndStoreDynamicSlot);
}
bool IonCacheIRCompiler::emitStoreTypedObjectReferenceProperty() {
JitSpew(JitSpew_Codegen, __FUNCTION__);
Register obj = allocator.useRegister(masm, reader.objOperandId());

View File

@ -118,9 +118,7 @@ struct DefaultJitOptions {
void resetFullIonWarmUpThreshold();
void enableGvn(bool val);
bool eagerIonCompilation() const {
return normalIonWarmUpThreshold == 0;
}
bool eagerIonCompilation() const { return normalIonWarmUpThreshold == 0; }
};
extern DefaultJitOptions JitOptions;

View File

@ -3714,8 +3714,8 @@ void LIRGenerator::visitGetPropertyPolymorphic(MGetPropertyPolymorphic* ins) {
assignSnapshot(lir, Bailout_ShapeGuard);
defineBox(lir, ins);
} else {
LGetPropertyPolymorphicT* lir = new (alloc()) LGetPropertyPolymorphicT(
useRegister(ins->object()), temp());
LGetPropertyPolymorphicT* lir = new (alloc())
LGetPropertyPolymorphicT(useRegister(ins->object()), temp());
assignSnapshot(lir, Bailout_ShapeGuard);
define(lir, ins);
}
@ -3731,9 +3731,8 @@ void LIRGenerator::visitSetPropertyPolymorphic(MSetPropertyPolymorphic* ins) {
add(lir, ins);
} else {
LAllocation value = useRegisterOrConstant(ins->value());
LSetPropertyPolymorphicT* lir = new (alloc())
LSetPropertyPolymorphicT(useRegister(ins->object()), value,
ins->value()->type(), temp());
LSetPropertyPolymorphicT* lir = new (alloc()) LSetPropertyPolymorphicT(
useRegister(ins->object()), value, ins->value()->type(), temp());
assignSnapshot(lir, Bailout_ShapeGuard);
add(lir, ins);
}
@ -3833,8 +3832,8 @@ void LIRGenerator::visitGuardReceiverPolymorphic(
MOZ_ASSERT(ins->type() == MIRType::Object);
if (JitOptions.spectreObjectMitigationsMisc) {
auto* lir = new (alloc()) LGuardReceiverPolymorphic(
useRegisterAtStart(ins->object()), temp());
auto* lir = new (alloc())
LGuardReceiverPolymorphic(useRegisterAtStart(ins->object()), temp());
assignSnapshot(lir, Bailout_ShapeGuard);
defineReuseInput(lir, ins, 0);
} else {

View File

@ -2518,9 +2518,7 @@ class MObjectState : public MVariadicInstruction,
MOZ_MUST_USE bool initFromTemplateObject(TempAllocator& alloc,
MDefinition* undefinedVal);
size_t numFixedSlots() const {
return numFixedSlots_;
}
size_t numFixedSlots() const { return numFixedSlots_; }
size_t numSlots() const { return numSlots_; }
MDefinition* getSlot(uint32_t slot) const { return getOperand(slot + 1); }

View File

@ -1200,7 +1200,6 @@ void MacroAssembler::initGCThing(Register obj, Register temp,
#endif
}
void MacroAssembler::compareStrings(JSOp op, Register left, Register right,
Register result, Label* fail) {
MOZ_ASSERT(left != result);

View File

@ -3198,8 +3198,7 @@ class MOZ_RAII StackMacroAssembler : public MacroAssembler {
class MOZ_RAII WasmMacroAssembler : public MacroAssembler {
public:
explicit WasmMacroAssembler(TempAllocator& alloc, bool limitedSize = true)
: MacroAssembler(WasmToken(), alloc)
{
: MacroAssembler(WasmToken(), alloc) {
if (!limitedSize) {
setUnlimitedBuffer();
}

View File

@ -1251,9 +1251,7 @@ class Assembler : public AssemblerShared {
// MacroAssembler, before allocating any space.
void initWithAllocator() { m_buffer.initWithAllocator(); }
void setUnlimitedBuffer() {
m_buffer.setUnlimited();
}
void setUnlimitedBuffer() { m_buffer.setUnlimited(); }
static Condition InvertCondition(Condition cond);
static Condition UnsignedCondition(Condition cond);

View File

@ -224,9 +224,7 @@ class Assembler : public vixl::Assembler {
void bind(RepatchLabel* label);
void bind(CodeLabel* label) { label->target()->bind(currentOffset()); }
void setUnlimitedBuffer() {
armbuffer_.setUnlimited();
}
void setUnlimitedBuffer() { armbuffer_.setUnlimited(); }
bool oom() const {
return AssemblerShared::oom() || armbuffer_.oom() ||
jumpRelocations_.oom() || dataRelocations_.oom();

View File

@ -814,9 +814,7 @@ class AssemblerMIPSShared : public AssemblerShared {
}
public:
void setUnlimitedBuffer() {
m_buffer.setUnlimited();
}
void setUnlimitedBuffer() { m_buffer.setUnlimited(); }
bool oom() const;
void setPrinter(Sprinter* sp) {

View File

@ -171,9 +171,7 @@ class Assembler : public AssemblerShared {
MOZ_CRASH();
}
void setUnlimitedBuffer() {
MOZ_CRASH();
}
void setUnlimitedBuffer() { MOZ_CRASH(); }
};
class Operand {

View File

@ -174,9 +174,7 @@ class AssemblerBuffer {
return !(size() & (alignment - 1));
}
void setUnlimited() {
maxSize = MaxCodeBytesPerProcess;
}
void setUnlimited() { maxSize = MaxCodeBytesPerProcess; }
private:
Slice* newSlice(LifoAlloc& a) {

View File

@ -1102,9 +1102,7 @@ struct AssemblerBufferWithConstantPools
inhibitNops_ = false;
}
void align(unsigned alignment) {
align(alignment, alignFillInst_);
}
void align(unsigned alignment) { align(alignment, alignFillInst_); }
void align(unsigned alignment, uint32_t pattern) {
MOZ_ASSERT(mozilla::IsPowerOfTwo(alignment));

View File

@ -11184,9 +11184,8 @@ int main(int argc, char** argv, char** envp) {
JS_SetContextPrivate(cx, sc.get());
JS_SetGrayGCRootsTracer(cx, TraceGrayRoots, nullptr);
auto resetGrayGCRootsTracer = MakeScopeExit([cx] {
JS_SetGrayGCRootsTracer(cx, nullptr, nullptr);
});
auto resetGrayGCRootsTracer =
MakeScopeExit([cx] { JS_SetGrayGCRootsTracer(cx, nullptr, nullptr); });
// Waiting is allowed on the shell's main thread, for now.
JS_SetFutexCanWait(cx);

View File

@ -134,8 +134,7 @@ void StructuredSpewer::startObject(JSContext* cx, const JSScript* script,
json.beginObject();
json.property("channel", getName(channel));
if (script)
{
if (script) {
json.beginObjectProperty("location");
json.property("filename", script->filename());
json.property("line", script->lineno());

View File

@ -2349,7 +2349,7 @@ BigInt* BigInt::asUintN(JSContext* cx, HandleBigInt x, uint64_t bits) {
if (res == nullptr) {
return nullptr;
}
while (length-- > 0) {
res->setDigit(length, x->digit(length) & mask);
mask = Digit(-1);

View File

@ -5665,14 +5665,16 @@ class DebuggerAdoptSourceMatcher {
ReturnType match(HandleScriptSourceObject source) {
if (source->compartment() == cx_->compartment()) {
JS_ReportErrorASCII(cx_, "Source is in the same compartment as this debugger");
JS_ReportErrorASCII(cx_,
"Source is in the same compartment as this debugger");
return nullptr;
}
return dbg_->wrapSource(cx_, source);
}
ReturnType match(Handle<WasmInstanceObject*> wasmInstance) {
if (wasmInstance->compartment() == cx_->compartment()) {
JS_ReportErrorASCII(cx_, "WasmInstance is in the same compartment as this debugger");
JS_ReportErrorASCII(
cx_, "WasmInstance is in the same compartment as this debugger");
return nullptr;
}
return dbg_->wrapWasmSource(cx_, wasmInstance);

View File

@ -159,8 +159,7 @@ static bool EnumerateExtraProperties(JSContext* cx, HandleObject obj,
// `enumerableOnly` to the hook to filter out non-enumerable
// properties, it doesn't really matter what we pass here.
bool enumerable = true;
if (!Enumerate<true>(cx, obj, id, enumerable, flags, visited,
props)) {
if (!Enumerate<true>(cx, obj, id, enumerable, flags, visited, props)) {
return false;
}
}

View File

@ -3014,8 +3014,7 @@ extern bool PropertySpecNameToId(JSContext* cx, const char* name,
js::PinningBehavior pin = js::DoNotPinAtom);
static bool ShouldIgnorePropertyDefinition(JSContext* cx, HandleObject obj,
HandleId id)
{
HandleId id) {
if (StandardProtoKeyOrNull(obj) == JSProto_DataView &&
!cx->realm()->creationOptions().getBigIntEnabled() &&
(id == NameToId(cx->names().getBigInt64) ||

View File

@ -362,7 +362,6 @@ class TypeNewScript {
}
};
inline bool ObjectGroup::hasUnanalyzedPreliminaryObjects() {
return (newScriptDontCheckGeneration() &&
!newScriptDontCheckGeneration()->analyzed()) ||

View File

@ -733,7 +733,7 @@ class FunctionCompiler {
// storage are not movable.
MWasmLoadRef* load =
MWasmLoadRef::New(alloc(), base, AliasSet::WasmTableElement,
/*isMovable=*/ false);
/*isMovable=*/false);
curBlock_->add(load);
return load;
}

View File

@ -150,7 +150,8 @@ AnyRef Table::getAnyRef(uint32_t index) const {
const void* Table::getShortlivedAnyRefLocForCompiledCode(uint32_t index) const {
MOZ_ASSERT(!isFunction());
return const_cast<HeapPtr<JSObject*>&>(objects_[index]).unsafeUnbarrieredForTracing();
return const_cast<HeapPtr<JSObject*>&>(objects_[index])
.unsafeUnbarrieredForTracing();
}
void Table::setAnyFunc(uint32_t index, void* code, const Instance* instance) {

View File

@ -28,8 +28,7 @@ NS_IMPL_CI_INTERFACE_GETTER(XPCVariant, XPCVariant, nsIVariant)
NS_IMPL_CYCLE_COLLECTING_ADDREF(XPCVariant)
NS_IMPL_CYCLE_COLLECTING_RELEASE(XPCVariant)
XPCVariant::XPCVariant(JSContext* cx, const Value& aJSVal)
: mJSVal(aJSVal) {
XPCVariant::XPCVariant(JSContext* cx, const Value& aJSVal) : mJSVal(aJSVal) {
if (!mJSVal.isPrimitive()) {
// XXXbholley - The innerization here was from bug 638026. Blake says
// the basic problem was that we were storing the C++ inner but the JS

View File

@ -151,7 +151,8 @@ class StaticPresData {
* to re-call GetLanguageGroup when it is safe to cache, to avoid
* recomputing the language group again later.
*/
nsStaticAtom* GetLangGroup(nsAtom* aLanguage, bool* aNeedsToCache = nullptr) const;
nsStaticAtom* GetLangGroup(nsAtom* aLanguage,
bool* aNeedsToCache = nullptr) const;
/**
* Same as GetLangGroup, but will not cache the result

View File

@ -3088,7 +3088,8 @@ nsIFrame* nsCSSFrameConstructor::ConstructFieldSetFrame(
true, aItem.mPendingBinding);
nsFrameList fieldsetKids;
fieldsetKids.AppendFrame(nullptr, scrollFrame ? scrollFrame : contentFrameTop);
fieldsetKids.AppendFrame(nullptr,
scrollFrame ? scrollFrame : contentFrameTop);
for (nsFrameList::Enumerator e(childList); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
@ -5192,8 +5193,7 @@ static bool ShouldSuppressFrameInSelect(const nsIContent* aParent,
}
static bool ShouldSuppressFrameInNonOpenDetails(
const HTMLDetailsElement* aDetails,
ComputedStyle* aComputedStyle,
const HTMLDetailsElement* aDetails, ComputedStyle* aComputedStyle,
const nsIContent& aChild) {
if (!aDetails || aDetails->Open()) {
return false;
@ -9546,13 +9546,16 @@ inline void nsCSSFrameConstructor::ConstructFramesFromItemList(
for (FCItemIterator iter(aItems); !iter.IsDone(); iter.Next()) {
NS_ASSERTION(iter.item().DesiredParentType() == GetParentType(aParentFrame),
"Needed pseudos didn't get created; expect bad things");
// display:list-item boxes affects the start value of the "list-item" counter
// when an <ol reversed> element doesn't have an explicit start value.
// display:list-item boxes affects the start value of the "list-item"
// counter when an <ol reversed> element doesn't have an explicit start
// value.
if (!listItemListIsDirty &&
iter.item().mComputedStyle->StyleList()->mMozListReversed
== StyleMozListReversed::True &&
iter.item().mComputedStyle->StyleDisplay()->mDisplay == StyleDisplay::ListItem) {
auto* list = mCounterManager.CounterListFor(NS_LITERAL_STRING("list-item"));
iter.item().mComputedStyle->StyleList()->mMozListReversed ==
StyleMozListReversed::True &&
iter.item().mComputedStyle->StyleDisplay()->mDisplay ==
StyleDisplay::ListItem) {
auto* list =
mCounterManager.CounterListFor(NS_LITERAL_STRING("list-item"));
list->SetDirty();
CountersDirty();
listItemListIsDirty = true;
@ -9679,13 +9682,13 @@ void nsCSSFrameConstructor::ProcessChildren(
if (aCanHaveGeneratedContent) {
auto* styleParentFrame =
nsFrame::CorrectStyleParentFrame(aFrame, PseudoStyleType::NotPseudo);
nsFrame::CorrectStyleParentFrame(aFrame, PseudoStyleType::NotPseudo);
computedStyle = styleParentFrame->Style();
if (computedStyle->StyleDisplay()->mDisplay == StyleDisplay::ListItem &&
(listItem = do_QueryFrame(aFrame)) &&
!styleParentFrame->IsFieldSetFrame()) {
isOutsideMarker = computedStyle->StyleList()->mListStylePosition ==
NS_STYLE_LIST_STYLE_POSITION_OUTSIDE;
NS_STYLE_LIST_STYLE_POSITION_OUTSIDE;
CreateGeneratedContentItem(aState, aFrame, *aContent->AsElement(),
*computedStyle, PseudoStyleType::marker,
itemsToConstruct);
@ -9741,17 +9744,19 @@ void nsCSSFrameConstructor::ProcessChildren(
// SetMarkerFrameForListItem will add childFrame to the kBulletList
aFrameList.RemoveFrame(childFrame);
auto* grandParent = listItem->GetParent()->GetParent();
if (listItem->Style()->GetPseudoType() == PseudoStyleType::columnContent &&
grandParent &&
grandParent->IsColumnSetWrapperFrame()) {
if (listItem->Style()->GetPseudoType() ==
PseudoStyleType::columnContent &&
grandParent && grandParent->IsColumnSetWrapperFrame()) {
listItem = do_QueryFrame(grandParent);
MOZ_ASSERT(listItem, "ColumnSetWrapperFrame is expected to be "
"a nsBlockFrame subclass");
MOZ_ASSERT(listItem,
"ColumnSetWrapperFrame is expected to be "
"a nsBlockFrame subclass");
childFrame->SetParent(listItem);
}
}
listItem->SetMarkerFrameForListItem(childFrame);
MOZ_ASSERT(listItem->HasAnyStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER) == isOutsideMarker);
MOZ_ASSERT(listItem->HasAnyStateBits(
NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER) == isOutsideMarker);
break;
}
}

View File

@ -165,8 +165,7 @@ void nsCounterList::RecalcAll() {
node->mValueAfter = 1;
} else if ((node->mType == nsCounterChangeNode::INCREMENT ||
node->mType == nsCounterChangeNode::SET) &&
node->mScopeStart &&
node->mScopeStart->IsContentBasedReset()) {
node->mScopeStart && node->mScopeStart->IsContentBasedReset()) {
++node->mScopeStart->mValueAfter;
}
}
@ -188,10 +187,10 @@ void nsCounterList::RecalcAll() {
}
if (oldValue != node->mValueAfter && node->mPseudoFrame &&
node->mPseudoFrame->StyleDisplay()->mDisplay == StyleDisplay::ListItem) {
node->mPseudoFrame->StyleDisplay()->mDisplay ==
StyleDisplay::ListItem) {
auto* shell = node->mPseudoFrame->PresShell();
shell->FrameNeedsReflow(node->mPseudoFrame,
nsIPresShell::eStyleChange,
shell->FrameNeedsReflow(node->mPseudoFrame, nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}
@ -200,8 +199,7 @@ void nsCounterList::RecalcAll() {
bool nsCounterManager::AddCounterChanges(nsIFrame* aFrame) {
const nsStyleContent* styleContent = aFrame->StyleContent();
if (!styleContent->CounterIncrementCount() &&
!styleContent->CounterResetCount() &&
!styleContent->CounterSetCount()) {
!styleContent->CounterResetCount() && !styleContent->CounterSetCount()) {
MOZ_ASSERT(!aFrame->HasAnyStateBits(NS_FRAME_HAS_CSS_COUNTER_STYLE));
return false;
}
@ -221,8 +219,9 @@ bool nsCounterManager::AddCounterChanges(nsIFrame* aFrame) {
nsCounterChangeNode::SET);
}
for (i = 0, i_end = styleContent->CounterIncrementCount(); i != i_end; ++i) {
dirty |= AddCounterChangeNode(aFrame, i, styleContent->CounterIncrementAt(i),
nsCounterChangeNode::INCREMENT);
dirty |=
AddCounterChangeNode(aFrame, i, styleContent->CounterIncrementAt(i),
nsCounterChangeNode::INCREMENT);
}
return dirty;
}

View File

@ -120,13 +120,16 @@ struct nsCounterChangeNode : public nsCounterNode {
// that comes before all the real content, with
// the resets first, in order, and then the sets and
// then the increments.
aPropIndex + (aChangeType == RESET ? (INT32_MIN) :
(aChangeType == SET ? ((INT32_MIN / 3) * 2) : INT32_MIN / 3)),
aPropIndex + (aChangeType == RESET
? (INT32_MIN)
: (aChangeType == SET ? ((INT32_MIN / 3) * 2)
: INT32_MIN / 3)),
aChangeType),
mChangeValue(aChangeValue) {
NS_ASSERTION(aPropIndex >= 0, "out of range");
NS_ASSERTION(aChangeType == INCREMENT || aChangeType == SET
|| aChangeType == RESET, "bad type");
NS_ASSERTION(
aChangeType == INCREMENT || aChangeType == SET || aChangeType == RESET,
"bad type");
mPseudoFrame = aPseudoFrame;
CheckFrameAssertions();
}
@ -157,7 +160,7 @@ inline bool nsCounterNode::IsContentBasedReset() {
return mType == RESET &&
ChangeNode()->mChangeValue == std::numeric_limits<int32_t>::min();
}
class nsCounterList : public nsGenConList {
public:
nsCounterList() : nsGenConList(), mDirty(false) {}

View File

@ -12,12 +12,12 @@
#include "nsISupports.h"
// 1295f7c0-96b3-41fc-93ed-c95dfb712ce7
# define NS_ILAYOUT_DEBUGGER_IID \
{ \
0x1295f7c0, 0x96b3, 0x41fc, { \
0x93, 0xed, 0xc9, 0x5d, 0xfb, 0x71, 0x2c, 0xe7 \
} \
}
#define NS_ILAYOUT_DEBUGGER_IID \
{ \
0x1295f7c0, 0x96b3, 0x41fc, { \
0x93, 0xed, 0xc9, 0x5d, 0xfb, 0x71, 0x2c, 0xe7 \
} \
}
/**
* API for access and control of layout debugging

View File

@ -1709,7 +1709,7 @@ void nsPresContext::UserFontSetUpdated(gfxUserFontEntry* aUpdatedFont) {
// potentially changed.
if (!aUpdatedFont) {
auto hint =
UsesExChUnits() ? RestyleHint::RecascadeSubtree() : RestyleHint{0};
UsesExChUnits() ? RestyleHint::RecascadeSubtree() : RestyleHint{0};
PostRebuildAllStyleDataEvent(NS_STYLE_HINT_REFLOW, hint);
return;
}

View File

@ -578,9 +578,8 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
// Handle this case similarly to the code above, but just
// use idle queue.
TimeDuration rate = mVsyncRefreshDriverTimer->GetTimerRate();
uint32_t slowRate =
static_cast<uint32_t>(rate.ToMilliseconds() *
frameRateMultiplier);
uint32_t slowRate = static_cast<uint32_t>(
rate.ToMilliseconds() * frameRateMultiplier);
pctx->DidUseFrameRateMultiplier();
nsCOMPtr<nsIRunnable> vsyncEvent = NewRunnableMethod<>(
"RefreshDriverVsyncObserver::NormalPriorityNotify[IDLE]",

View File

@ -2540,7 +2540,8 @@ void ReflowInput::InitConstraints(nsPresContext* aPresContext,
mStyleDisplay->mDisplay != StyleDisplay::InlineTable &&
!alignCB->IsFlexOrGridContainer() &&
!(mFrame->Style()->GetPseudoType() == PseudoStyleType::marker &&
mFrame->GetParent()->StyleList()->mListStylePosition == NS_STYLE_LIST_STYLE_POSITION_OUTSIDE)) {
mFrame->GetParent()->StyleList()->mListStylePosition ==
NS_STYLE_LIST_STYLE_POSITION_OUTSIDE)) {
CalculateBlockSideMargins(aFrameType);
}
}

View File

@ -2665,8 +2665,9 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState) {
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* marker = GetOutsideMarker();
WritingMode wm = aState.mReflowInput.GetWritingMode();
ReflowOutsideMarker(marker, aState, metrics,
aState.mReflowInput.ComputedPhysicalBorderPadding().top);
ReflowOutsideMarker(
marker, aState, metrics,
aState.mReflowInput.ComputedPhysicalBorderPadding().top);
NS_ASSERTION(!MarkerIsEmpty() || metrics.BSize(wm) == 0,
"empty ::marker frame took up space");
@ -6792,7 +6793,8 @@ void nsBlockFrame::GetSpokenMarkerText(nsAString& aText) const {
void nsBlockFrame::ReflowOutsideMarker(nsIFrame* aMarkerFrame,
BlockReflowInput& aState,
ReflowOutput& aMetrics, nscoord aLineTop) {
ReflowOutput& aMetrics,
nscoord aLineTop) {
const ReflowInput& ri = aState.mReflowInput;
WritingMode markerWM = aMarkerFrame->GetWritingMode();

View File

@ -167,9 +167,9 @@ void nsBulletFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
!newStyleList->mCounterStyle.IsNone();
if (hadBullet != hasBullet) {
nsIContent* listItem = mContent->GetParent();
accService->UpdateListBullet(PresContext()->GetPresShell(), listItem,
hasBullet);
nsIContent* listItem = mContent->GetParent();
accService->UpdateListBullet(PresContext()->GetPresShell(), listItem,
hasBullet);
}
}
}

View File

@ -10560,8 +10560,8 @@ void nsIFrame::SetParent(nsContainerFrame* aParent) {
void nsIFrame::CreateOwnLayerIfNeeded(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
bool* aCreatedContainerItem) {
wr::RenderRoot renderRoot = gfxUtils::GetRenderRootForFrame(this)
.valueOr(wr::RenderRoot::Default);
wr::RenderRoot renderRoot =
gfxUtils::GetRenderRootForFrame(this).valueOr(wr::RenderRoot::Default);
if (renderRoot != wr::RenderRoot::Default) {
aList->AppendToTop(MakeDisplayItem<nsDisplayRenderRoot>(

View File

@ -563,7 +563,8 @@ FRAME_STATE_BIT(Block, 28, NS_BLOCK_CLIP_PAGINATED_OVERFLOW)
FRAME_STATE_BIT(Block, 29, NS_BLOCK_HAS_FIRST_LETTER_STYLE)
// NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER and NS_BLOCK_FRAME_HAS_INSIDE_MARKER
// means the block has an associated ::marker frame, they are mutually exclusive.
// means the block has an associated ::marker frame, they are mutually
// exclusive.
FRAME_STATE_BIT(Block, 30, NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER)
FRAME_STATE_BIT(Block, 31, NS_BLOCK_FRAME_HAS_INSIDE_MARKER)

View File

@ -1110,7 +1110,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList {
public:
RefPtr<RawServoQuotes> mQuotes;
nsRect mImageRegion; // the rect to use within an image
mozilla::StyleMozListReversed mMozListReversed; // true in an <ol reversed> scope
mozilla::StyleMozListReversed
mMozListReversed; // true in an <ol reversed> scope
};
struct nsStyleGridLine {
@ -1879,8 +1880,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
mozilla::StyleOverflowClipBox mOverflowClipBoxInline;
mozilla::StyleResize mResize;
mozilla::StyleOrient mOrient;
uint8_t mIsolation; // NS_STYLE_ISOLATION_*
uint8_t mTopLayer; // NS_STYLE_TOP_LAYER_*
uint8_t mIsolation; // NS_STYLE_ISOLATION_*
uint8_t mTopLayer; // NS_STYLE_TOP_LAYER_*
// Stores a bitfield representation of the properties that are frequently
// queried. This should match mWillChange. Also tracks if any of the
// properties in the will-change list require a stacking context.

View File

@ -92,8 +92,8 @@ const char *gInaccessibleProperties[] = {
"-x-text-zoom",
"-moz-context-properties",
"-moz-control-character-visibility",
"-moz-list-reversed", // parsed by UA sheets only
"-moz-script-level", // parsed by UA sheets only
"-moz-list-reversed", // parsed by UA sheets only
"-moz-script-level", // parsed by UA sheets only
"-moz-script-size-multiplier",
"-moz-script-min-size",
"-moz-math-variant",

View File

@ -18,7 +18,7 @@ LazyLogModule gFuzzingLog("nsFuzzingNecko");
MOZ_LOG(mozilla::net::gFuzzingLog, mozilla::LogLevel::Verbose, args)
// These will be set by setNetworkFuzzingBuffer below
static Atomic<const uint8_t*> gFuzzingBuf(NULL);
static Atomic<const uint8_t *> gFuzzingBuf(NULL);
static Atomic<size_t> gFuzzingSize(0);
/*
@ -39,7 +39,7 @@ Atomic<bool> gFuzzingConnClosed(true);
Atomic<bool> gFuzzingAllowNewConn(false);
Atomic<bool> gFuzzingAllowRead(false);
void setNetworkFuzzingBuffer(const uint8_t* data, size_t size) {
void setNetworkFuzzingBuffer(const uint8_t *data, size_t size) {
if (size > INT32_MAX) {
MOZ_CRASH("Unsupported buffer size");
}
@ -53,21 +53,21 @@ static PRDescIdentity sFuzzyLayerIdentity;
static PRIOMethods sFuzzyLayerMethods;
static PRIOMethods *sFuzzyLayerMethodsPtr = nullptr;
static PRInt16 PR_CALLBACK FuzzyPoll(
PRFileDesc *fd, PRInt16 in_flags, PRInt16 *out_flags) {
*out_flags = 0;
static PRInt16 PR_CALLBACK FuzzyPoll(PRFileDesc *fd, PRInt16 in_flags,
PRInt16 *out_flags) {
*out_flags = 0;
if (in_flags & PR_POLL_READ && gFuzzingAllowRead) {
*out_flags = PR_POLL_READ;
return PR_POLL_READ;
}
if (in_flags & PR_POLL_READ && gFuzzingAllowRead) {
*out_flags = PR_POLL_READ;
return PR_POLL_READ;
}
if (in_flags & PR_POLL_WRITE) {
*out_flags = PR_POLL_WRITE;
return PR_POLL_WRITE;
}
if (in_flags & PR_POLL_WRITE) {
*out_flags = PR_POLL_WRITE;
return PR_POLL_WRITE;
}
return in_flags;
return in_flags;
}
static PRStatus FuzzyConnect(PRFileDesc *fd, const PRNetAddr *addr,
@ -118,12 +118,10 @@ static PRInt32 FuzzyRecv(PRFileDesc *fd, void *buf, PRInt32 amount,
}
// No data left, act as if the connection was closed.
if (!gFuzzingSize)
return 0;
if (!gFuzzingSize) return 0;
// Use the remains of fuzzing buffer, if too little is left
if (gFuzzingSize < (PRUint32)amount)
amount = gFuzzingSize;
if (gFuzzingSize < (PRUint32)amount) amount = gFuzzingSize;
// Consume buffer, copy data
memcpy(buf, gFuzzingBuf, amount);

View File

@ -913,8 +913,7 @@ nsresult NS_ShouldSecureUpgrade(
nsIURI *aURI, nsILoadInfo *aLoadInfo, nsIPrincipal *aChannelResultPrincipal,
bool aPrivateBrowsing, bool aAllowSTS,
const mozilla::OriginAttributes &aOriginAttributes, bool &aShouldUpgrade,
std::function<void(bool, nsresult)> &&aResultCallback,
bool &aWillCallback);
std::function<void(bool, nsresult)> &&aResultCallback, bool &aWillCallback);
/**
* Returns an https URI for channels that need to go through secure upgrades.

View File

@ -41,7 +41,8 @@ namespace net {
namespace {
void AppendMemoryStorageTag(nsAutoCString& key) {
// Using DEL as the very last ascii-7 character we can use in the list of attributes
// Using DEL as the very last ascii-7 character we can use in the list of
// attributes
key.Append('\x7f');
key.Append(',');
}

View File

@ -329,8 +329,7 @@ AddrInfo::AddrInfo(const AddrInfo *src) {
}
}
AddrInfo::~AddrInfo() {
}
AddrInfo::~AddrInfo() {}
void AddrInfo::AddAddress(NetAddrElement *address) {
MOZ_ASSERT(address, "Cannot add the address to an uninitialized list");

View File

@ -45,7 +45,8 @@ ClassifierDummyChannel::StorageAllowed(
aChannel->GetURI(getter_AddRefs(uri));
if (StaticPrefs::privacy_trackingprotection_annotate_channels()) {
dom::ContentChild* cc = static_cast<dom::ContentChild*>(gNeckoChild->Manager());
dom::ContentChild* cc =
static_cast<dom::ContentChild*>(gNeckoChild->Manager());
if (cc->IsShuttingDown()) {
return eStorageDenied;
}

View File

@ -69,7 +69,7 @@ using mozilla::ipc::FileDescriptor;
//
// This list must be kept sorted.
static const char sStaticFileExtensions[][5] = {
// clang-format off
// clang-format off
"bmp",
"gif",
"ico",
@ -77,7 +77,7 @@ static const char sStaticFileExtensions[][5] = {
"jpg",
"png",
"svg",
// clang-format on
// clang-format on
};
namespace mozilla {

View File

@ -643,9 +643,9 @@ void SetMediaPluginSandbox(const char* aFilePath) {
files->Add("/sys/devices/system/cpu/cpu0/tsc_freq_khz");
files->Add("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
files->Add("/proc/cpuinfo"); // Info also available via CPUID instruction.
# ifdef __i386__
#ifdef __i386__
files->Add("/proc/self/auxv"); // Info also in process's address space.
# endif
#endif
// Finally, start the sandbox.
SetCurrentProcessSandbox(GetMediaSandboxPolicy(files));

View File

@ -696,14 +696,14 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
rv = DoSyscall(__NR_fstatfs, fd, buf);
break;
}
# ifdef __NR_statfs64
#ifdef __NR_statfs64
case __NR_statfs64: {
auto sz = static_cast<size_t>(aArgs.args[1]);
auto buf = reinterpret_cast<void*>(aArgs.args[2]);
rv = DoSyscall(__NR_fstatfs64, fd, sz, buf);
break;
}
# endif
#endif
default:
MOZ_ASSERT(false);
rv = -ENOSYS;
@ -845,10 +845,10 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case SYS_SENDMMSG: // libresolv via libasyncns; see bug 1355274
return Some(Allow());
# ifdef ANDROID
#ifdef ANDROID
case SYS_SOCKET:
return Some(Error(EACCES));
# else // #ifdef DESKTOP
#else // #ifdef DESKTOP
case SYS_SOCKET: {
const auto trapFn = aHasArgs ? FakeSocketTrap : FakeSocketTrapLegacy;
return Some(AllowBelowLevel(4, Trap(trapFn, nullptr)));
@ -871,13 +871,13 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case SYS_GETPEERNAME:
case SYS_SHUTDOWN:
return Some(Allow());
# endif
#endif
default:
return SandboxPolicyCommon::EvaluateSocketCall(aCall, aHasArgs);
}
}
# ifdef DESKTOP
#ifdef DESKTOP
Maybe<ResultExpr> EvaluateIpcCall(int aCall) const override {
switch (aCall) {
// These are a problem: SysV IPC follows the Unix "same uid
@ -903,9 +903,9 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
return SandboxPolicyCommon::EvaluateIpcCall(aCall);
}
}
# endif
#endif
# ifdef MOZ_PULSEAUDIO
#ifdef MOZ_PULSEAUDIO
ResultExpr PrctlPolicy() const override {
if (BelowLevel(4)) {
Arg<int> op(0);
@ -914,7 +914,7 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
}
return SandboxPolicyCommon::PrctlPolicy();
}
# endif
#endif
ResultExpr EvaluateSyscall(int sysno) const override {
// Straight allow for anything that got overriden via prefs
@ -954,7 +954,7 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
}
switch (sysno) {
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_getppid:
return Trap(GetPPidTrap, nullptr);
@ -966,28 +966,28 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_getcwd:
return Error(ENOENT);
# ifdef MOZ_PULSEAUDIO
# ifdef MOZ_PULSEAUDIO
CASES_FOR_fchown:
case __NR_fchmod:
return AllowBelowLevel(4);
# endif
# endif
CASES_FOR_fstatfs: // fontconfig, pulseaudio, GIO (see also statfs)
case __NR_flock: // graphics
return Allow();
// Bug 1354731: proprietary GL drivers try to mknod() their devices
# ifdef __NR_mknod
# ifdef __NR_mknod
case __NR_mknod:
# endif
# endif
case __NR_mknodat: {
Arg<mode_t> mode(sysno == __NR_mknodat ? 2 : 1);
return If((mode & S_IFMT) == S_IFCHR, Error(EPERM))
.Else(InvalidSyscall());
}
// Bug 1438389: ...and nvidia GL will sometimes try to chown the devices
# ifdef __NR_chown
# ifdef __NR_chown
case __NR_chown:
# endif
# endif
case __NR_fchownat:
return Error(EPERM);
@ -995,7 +995,7 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
// settings. Can remove when bug 1325242 happens in some form.
case __NR_utime:
return Error(EPERM);
# endif
#endif
CASES_FOR_select:
case __NR_pselect6:
@ -1004,18 +1004,18 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
CASES_FOR_getdents:
case __NR_writev:
case __NR_pread64:
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_pwrite64:
case __NR_readahead:
# endif
#endif
return Allow();
case __NR_ioctl: {
# ifdef MOZ_ALSA
#ifdef MOZ_ALSA
if (BelowLevel(4)) {
return Allow();
}
# endif
#endif
static const unsigned long kTypeMask = _IOC_TYPEMASK << _IOC_TYPESHIFT;
static const unsigned long kTtyIoctls = TIOCSTI & kTypeMask;
// On some older architectures (but not x86 or ARM), ioctls are
@ -1067,14 +1067,14 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
.Case(F_DUPFD_CLOEXEC, Allow())
// Nvidia GL and fontconfig (newer versions) use fcntl file locking.
.Case(F_SETLK, Allow())
# ifdef F_SETLK64
#ifdef F_SETLK64
.Case(F_SETLK64, Allow())
# endif
#endif
// Pulseaudio uses F_SETLKW, as does fontconfig.
.Case(F_SETLKW, Allow())
# ifdef F_SETLKW64
#ifdef F_SETLKW64
.Case(F_SETLKW64, Allow())
# endif
#endif
.Default(SandboxPolicyCommon::EvaluateSyscall(sysno));
}
@ -1098,10 +1098,10 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_sigaltstack:
return Allow();
# ifdef __NR_set_thread_area
#ifdef __NR_set_thread_area
case __NR_set_thread_area:
return Allow();
# endif
#endif
case __NR_getrusage:
case __NR_times:
@ -1128,17 +1128,17 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_sched_setscheduler:
case __NR_sched_getparam:
case __NR_sched_setparam:
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_sched_getaffinity:
# endif
#endif
return Allow();
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_sched_setaffinity:
return Error(EPERM);
# endif
#endif
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_pipe2:
return Allow();
@ -1179,9 +1179,9 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
}
case __NR_wait4:
# ifdef __NR_waitpid
# ifdef __NR_waitpid
case __NR_waitpid:
# endif
# endif
// NSPR will start a thread to wait for child processes even if
// fork() fails; see bug 227246 and bug 1299581.
return Error(ECHILD);
@ -1189,18 +1189,18 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_eventfd2:
return Allow();
# ifdef __NR_memfd_create
# ifdef __NR_memfd_create
case __NR_memfd_create:
return Allow();
# endif
# endif
# ifdef __NR_rt_tgsigqueueinfo
# ifdef __NR_rt_tgsigqueueinfo
// Only allow to send signals within the process.
case __NR_rt_tgsigqueueinfo: {
Arg<pid_t> tgid(0);
return If(tgid == getpid(), Allow()).Else(InvalidSyscall());
}
# endif
# endif
case __NR_mlock:
case __NR_munlock:
@ -1215,15 +1215,15 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_clone:
return ClonePolicy(Error(EPERM));
# ifdef __NR_fadvise64
# ifdef __NR_fadvise64
case __NR_fadvise64:
return Allow();
# endif
# endif
# ifdef __NR_fadvise64_64
# ifdef __NR_fadvise64_64
case __NR_fadvise64_64:
return Allow();
# endif
# endif
case __NR_fallocate:
return Allow();
@ -1231,25 +1231,25 @@ class ContentSandboxPolicy : public SandboxPolicyCommon {
case __NR_get_mempolicy:
return Allow();
# endif // DESKTOP
#endif // DESKTOP
# ifdef __NR_getrandom
#ifdef __NR_getrandom
case __NR_getrandom:
return Allow();
# endif
#endif
// nsSystemInfo uses uname (and we cache an instance, so
// the info remains present even if we block the syscall)
case __NR_uname:
# ifdef DESKTOP
#ifdef DESKTOP
case __NR_sysinfo:
# endif
#endif
return Allow();
# ifdef MOZ_JPROF
#ifdef MOZ_JPROF
case __NR_setitimer:
return Allow();
# endif // MOZ_JPROF
#endif // MOZ_JPROF
default:
return SandboxPolicyCommon::EvaluateSyscall(sysno);
@ -1274,12 +1274,12 @@ class GMPSandboxPolicy : public SandboxPolicyCommon {
int flags;
switch (aArgs.nr) {
# ifdef __NR_open
#ifdef __NR_open
case __NR_open:
path = reinterpret_cast<const char*>(aArgs.args[0]);
flags = static_cast<int>(aArgs.args[1]);
break;
# endif
#endif
case __NR_openat:
// The path has to be absolute to match the pre-opened file (see
// assertion in ctor) so the dirfd argument is ignored.
@ -1353,9 +1353,9 @@ class GMPSandboxPolicy : public SandboxPolicyCommon {
ResultExpr EvaluateSyscall(int sysno) const override {
switch (sysno) {
// Simulate opening the plugin file.
# ifdef __NR_open
#ifdef __NR_open
case __NR_open:
# endif
#endif
case __NR_openat:
return Trap(OpenTrap, mFiles);
@ -1393,7 +1393,6 @@ UniquePtr<sandbox::bpf_dsl::Policy> GetMediaSandboxPolicy(
return UniquePtr<sandbox::bpf_dsl::Policy>(new GMPSandboxPolicy(aFiles));
}
// The policy for the data decoder process is similar to the one for
// media plugins, but the codec code is all in-tree so it's better
// behaved and doesn't need special exceptions (or the ability to load

View File

@ -370,7 +370,7 @@ SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
}
}
# ifdef DEBUG
#ifdef DEBUG
char* bloatLog = PR_GetEnv("XPCOM_MEM_BLOAT_LOG");
// XPCOM_MEM_BLOAT_LOG has the format
// /tmp/tmpd0YzFZ.mozrunner/runtests_leaks.log
@ -384,7 +384,7 @@ SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
policy->AddPrefix(rdwrcr, bloatStr.get());
}
}
# endif
#endif
// Allow Primus to contact the Bumblebee daemon to manage GPU
// switching on NVIDIA Optimus systems.
@ -394,20 +394,20 @@ SandboxBrokerPolicyFactory::SandboxBrokerPolicyFactory() {
}
policy->AddPath(SandboxBroker::MAY_CONNECT, bumblebeeSocket);
# if defined(MOZ_WIDGET_GTK)
#if defined(MOZ_WIDGET_GTK)
// Allow local X11 connections, for Primus and VirtualGL to contact
// the secondary X server. No exception for Wayland.
# if defined(MOZ_WAYLAND)
# if defined(MOZ_WAYLAND)
if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
policy->AddPrefix(SandboxBroker::MAY_CONNECT, "/tmp/.X11-unix/X");
}
# else
# else
policy->AddPrefix(SandboxBroker::MAY_CONNECT, "/tmp/.X11-unix/X");
# endif
# endif
if (const auto xauth = PR_GetEnv("XAUTHORITY")) {
policy->AddPath(rdonly, xauth);
}
# endif
#endif
mCommonContentPolicy.reset(policy);
}
@ -510,12 +510,12 @@ UniquePtr<SandboxBroker::Policy> SandboxBrokerPolicyFactory::GetContentPolicy(
bool allowPulse = false;
bool allowAlsa = false;
if (level < 4) {
# ifdef MOZ_PULSEAUDIO
#ifdef MOZ_PULSEAUDIO
allowPulse = true;
# endif
# ifdef MOZ_ALSA
#endif
#ifdef MOZ_ALSA
allowAlsa = true;
# endif
#endif
}
if (allowAlsa) {
@ -529,7 +529,7 @@ UniquePtr<SandboxBroker::Policy> SandboxBrokerPolicyFactory::GetContentPolicy(
AddSharedMemoryPaths(policy.get(), aPid);
}
# ifdef MOZ_WIDGET_GTK
#ifdef MOZ_WIDGET_GTK
if (const auto userDir = g_get_user_runtime_dir()) {
// Bug 1321134: DConf's single bit of shared memory
// The leaf filename is "user" by default, but is configurable.
@ -544,7 +544,7 @@ UniquePtr<SandboxBroker::Policy> SandboxBrokerPolicyFactory::GetContentPolicy(
policy->AddPath(rdonly, pulsePath.get());
}
}
# endif // MOZ_WIDGET_GTK
#endif // MOZ_WIDGET_GTK
if (allowPulse) {
// PulseAudio also needs access to read the $XAUTHORITY file (see

View File

@ -368,7 +368,6 @@ static sandbox::ResultCode SetJobLevel(sandbox::TargetPolicy* aPolicy,
return aPolicy->SetJobLevel(sandbox::JOB_NONE, 0);
}
void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
bool aIsFileProcess) {
MOZ_RELEASE_ASSERT(mPolicy, "mPolicy must be set before this call.");
@ -423,13 +422,13 @@ void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
}
}
# if defined(DEBUG)
#if defined(DEBUG)
// This is required for a MOZ_ASSERT check in WindowsMessageLoop.cpp
// WinEventHook, see bug 1366694 for details.
DWORD uiExceptions = JOB_OBJECT_UILIMIT_HANDLES;
# else
#else
DWORD uiExceptions = 0;
# endif
#endif
sandbox::ResultCode result = SetJobLevel(mPolicy, jobLevel, uiExceptions);
MOZ_RELEASE_ASSERT(sandbox::SBOX_ALL_OK == result,
"Setting job level failed, have you set memory limit when "
@ -529,11 +528,11 @@ void SandboxBroker::SetSecurityLevelForContentProcess(int32_t aSandboxLevel,
AddCachedDirRule(mPolicy, sandbox::TargetPolicy::FILES_ALLOW_READONLY,
sUserExtensionsDevDir, NS_LITERAL_STRING("\\*"));
# ifdef ENABLE_SYSTEM_EXTENSION_DIRS
#ifdef ENABLE_SYSTEM_EXTENSION_DIRS
// Add rule to allow read access to the per-user extensions directory.
AddCachedDirRule(mPolicy, sandbox::TargetPolicy::FILES_ALLOW_READONLY,
sUserExtensionsDir, NS_LITERAL_STRING("\\*"));
# endif
#endif
}
// Add the policy for the client side of a pipe. It is just a file

View File

@ -297,9 +297,9 @@ const char* const ApplicationReputationService::kBinaryFileExtensions[] = {
".mhtml", // MS HTML
".mim", // MS Mail
//".mkv",
".mmc", // MS Office
".mmc", // MS Office
".mobileconfig", // Configuration file for Apple systems
".mof", // Windows
".mof", // Windows
//".mov",
//".mp3",
//".mp4",

View File

@ -59,6 +59,7 @@ typedef uint32_t GLenum;
#define GL_VERSION 0x1F02
// GLX_MESA_query_renderer
// clang-format off
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
@ -71,6 +72,7 @@ typedef uint32_t GLenum;
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
#define GLX_RENDERER_ID_MESA 0x818E
// clang-format on
namespace mozilla {
namespace widget {
@ -217,9 +219,9 @@ void glxtest() {
///// Get GL vendor/renderer/versions strings /////
enum { bufsize = 2048 };
char buf[bufsize];
const GLubyte* versionString = glGetString(GL_VERSION);
const GLubyte* vendorString = glGetString(GL_VENDOR);
const GLubyte* rendererString = glGetString(GL_RENDERER);
const GLubyte *versionString = glGetString(GL_VERSION);
const GLubyte *vendorString = glGetString(GL_VENDOR);
const GLubyte *rendererString = glGetString(GL_RENDERER);
if (!versionString || !vendorString || !rendererString)
fatal_error("glGetString returned null");
@ -232,15 +234,22 @@ void glxtest() {
fatal_error("GL strings length too large for buffer size");
// If GLX_MESA_query_renderer is available, populate additional data.
typedef Bool (*PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int* value);
PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glXQueryCurrentRendererIntegerMESAProc =
cast<PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC>(glXGetProcAddress("glXQueryCurrentRendererIntegerMESA"));
typedef Bool (*PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)(
int attribute, unsigned int *value);
PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC
glXQueryCurrentRendererIntegerMESAProc =
cast<PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC>(
glXGetProcAddress("glXQueryCurrentRendererIntegerMESA"));
if (glXQueryCurrentRendererIntegerMESAProc) {
unsigned int vendorId, deviceId, accelerated, videoMemoryMB;
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VENDOR_ID_MESA, &vendorId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_DEVICE_ID_MESA, &deviceId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_ACCELERATED_MESA, &accelerated);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VIDEO_MEMORY_MESA, &videoMemoryMB);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VENDOR_ID_MESA,
&vendorId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_DEVICE_ID_MESA,
&deviceId);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_ACCELERATED_MESA,
&accelerated);
glXQueryCurrentRendererIntegerMESAProc(GLX_RENDERER_VIDEO_MEMORY_MESA,
&videoMemoryMB);
// Truncate IDs to 4 digits- that's all PCI IDs are.
vendorId &= 0xFFFF;
@ -259,11 +268,11 @@ void glxtest() {
}
// From Mesa's GL/internal/dri_interface.h, to be used by DRI clients.
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (Display *dpy, int scrNum);
typedef const char *(*PFNGLXGETSCREENDRIVERPROC)(Display * dpy, int scrNum);
PFNGLXGETSCREENDRIVERPROC glXGetScreenDriverProc =
cast<PFNGLXGETSCREENDRIVERPROC>(glXGetProcAddress("glXGetScreenDriver"));
cast<PFNGLXGETSCREENDRIVERPROC>(glXGetProcAddress("glXGetScreenDriver"));
if (glXGetScreenDriverProc) {
const char* driDriver = glXGetScreenDriverProc(dpy, DefaultScreen(dpy));
const char *driDriver = glXGetScreenDriverProc(dpy, DefaultScreen(dpy));
if (driDriver) {
length += snprintf(buf + length, bufsize, "DRI_DRIVER\n%s\n", driDriver);
if (length >= bufsize)

View File

@ -1982,8 +1982,7 @@ static nsresult LockProfile(nsINativeAppSupport* aNative, nsIFile* aRootDir,
// 6) display the profile-manager UI
static nsresult SelectProfile(nsToolkitProfileService* aProfileSvc,
nsINativeAppSupport* aNative, nsIFile** aRootDir,
nsIFile** aLocalDir,
nsIToolkitProfile** aProfile,
nsIFile** aLocalDir, nsIToolkitProfile** aProfile,
bool* aWasDefaultSelection) {
StartupTimeline::Record(StartupTimeline::SELECT_PROFILE);

View File

@ -29,8 +29,8 @@
// This must be included last:
#include "nsObjCExceptions.h"
nsresult GetNativeWindowPointerFromDOMWindow(mozIDOMWindowProxy *a_window,
NSWindow **a_nativeWindow) {
nsresult GetNativeWindowPointerFromDOMWindow(mozIDOMWindowProxy* a_window,
NSWindow** a_nativeWindow) {
*a_nativeWindow = nil;
if (!a_window) return NS_ERROR_INVALID_ARG;
@ -45,7 +45,7 @@ nsresult GetNativeWindowPointerFromDOMWindow(mozIDOMWindowProxy *a_window,
nsCOMPtr<nsIWidget> mruWidget = nullptr;
mruBaseWindow->GetMainWidget(getter_AddRefs(mruWidget));
if (mruWidget) {
*a_nativeWindow = (NSWindow *)mruWidget->GetNativeData(NS_NATIVE_WINDOW);
*a_nativeWindow = (NSWindow*)mruWidget->GetNativeData(NS_NATIVE_WINDOW);
}
}
}
@ -61,12 +61,9 @@ nsresult GetNativeWindowPointerFromDOMWindow(mozIDOMWindowProxy *a_window,
// other new copies just broadcast this notification and quit (unless -no-remote
// was specified in either of these processes), making the original process handle
// the arguments passed to this handler.
void
remoteClientNotificationCallback(CFNotificationCenterRef aCenter,
void* aObserver, CFStringRef aName,
const void* aObject,
CFDictionaryRef aUserInfo)
{
void remoteClientNotificationCallback(CFNotificationCenterRef aCenter, void* aObserver,
CFStringRef aName, const void* aObject,
CFDictionaryRef aUserInfo) {
// Autorelease pool to prevent memory leaks, in case there is no outer pool.
mozilla::MacAutoreleasePool pool;
NSDictionary* userInfoDict = (__bridge NSDictionary*)aUserInfo;
@ -85,8 +82,7 @@ remoteClientNotificationCallback(CFNotificationCenterRef aCenter,
// We're not currently passing the working dir as third argument because it
// does not appear to be required.
nsresult rv = cmdLine->Init(argc, argv, nullptr,
nsICommandLine::STATE_REMOTE_AUTO);
nsresult rv = cmdLine->Init(argc, argv, nullptr, nsICommandLine::STATE_REMOTE_AUTO);
// Cleaning up C array.
delete[] argv;
@ -101,8 +97,8 @@ remoteClientNotificationCallback(CFNotificationCenterRef aCenter,
cmdLine->Run();
// And bring the app's window to front.
[[NSRunningApplication currentApplication] activateWithOptions:
NSApplicationActivateIgnoringOtherApps];
[[NSRunningApplication currentApplication]
activateWithOptions:NSApplicationActivateIgnoringOtherApps];
}
}
@ -110,7 +106,7 @@ class nsNativeAppSupportCocoa : public nsNativeAppSupportBase {
public:
nsNativeAppSupportCocoa() : mCanShowUI(false) {}
NS_IMETHOD Start(bool *aRetVal) override;
NS_IMETHOD Start(bool* aRetVal) override;
NS_IMETHOD ReOpen() override;
NS_IMETHOD Enable() override;
@ -124,7 +120,7 @@ nsNativeAppSupportCocoa::Enable() {
return NS_OK;
}
NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool *_retval) {
NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool* _retval) {
int major, minor, bugfix;
nsCocoaFeatures::GetSystemVersion(major, minor, bugfix);
@ -166,7 +162,7 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool *_retval) {
BOOL mozillaRestarting = NO;
if ([[[[NSProcessInfo processInfo] environment] objectForKey:@"MOZ_APP_RESTART"]
isEqualToString:@"1"]) {
isEqualToString:@"1"]) {
// Update process completed or restarting the app for another reason.
// Triggered by an old instance that just quit.
mozillaRestarting = YES;
@ -198,22 +194,22 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool *_retval) {
// So, let's check if this is the first instance ever of the process for the
// current user.
NSString* notificationName = [[[NSBundle mainBundle] bundleIdentifier]
stringByAppendingString:
@".distributedNotification.commandLineArgs"];
stringByAppendingString:@".distributedNotification.commandLineArgs"];
BOOL runningInstanceFound = NO;
if (!shallProceedLikeNoRemote) {
// We check for other running instances only if -no-remote was not specified.
// The check is needed so the marAppApplyUpdateSuccess.js test doesn't fail on next call.
runningInstanceFound = [[NSRunningApplication runningApplicationsWithBundleIdentifier:
[[NSBundle mainBundle] bundleIdentifier]] count] > 1;
runningInstanceFound =
[[NSRunningApplication
runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]]
count] > 1;
}
if (!shallProceedLikeNoRemote && !mozillaRestarting && runningInstanceFound) {
// There is another instance of this app already running!
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
CFDictionaryRef userInfoDict = (__bridge CFDictionaryRef)@{@"commandLineArgs":
arguments};
CFDictionaryRef userInfoDict = (__bridge CFDictionaryRef) @{@"commandLineArgs" : arguments};
// This code is shared between Firefox, Thunderbird and other Mozilla products.
// So we need a notification name that is unique to the product, so we
@ -226,9 +222,7 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool *_retval) {
// logged in user. Distributed notifications is the best candidate
// (while darwin notifications ignore the user context).
CFNotificationCenterPostNotification(CFNotificationCenterGetDistributedCenter(),
(__bridge CFStringRef)notificationName,
NULL,
userInfoDict,
(__bridge CFStringRef)notificationName, NULL, userInfoDict,
true);
// Do not continue start up sequence for this process - just self-terminate,
@ -240,11 +234,9 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool *_retval) {
// In case future instances would want to notify us about command line arguments
// passed to them. Note, that if mozilla process is restarting, we still need to
// register for notifications.
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(),
NULL,
CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL,
remoteClientNotificationCallback,
(__bridge CFStringRef)notificationName,
NULL,
(__bridge CFStringRef)notificationName, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
// Continue the start up sequence of this process.
@ -291,7 +283,7 @@ nsNativeAppSupportCocoa::ReOpen() {
windowList->HasMoreElements(&more);
continue;
}
NSWindow *cocoaWindow = (NSWindow *)widget->GetNativeData(NS_NATIVE_WINDOW);
NSWindow* cocoaWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
if (![cocoaWindow isMiniaturized]) {
haveNonMiniaturized = true;
break; // have un-minimized windows, nothing to do
@ -305,7 +297,7 @@ nsNativeAppSupportCocoa::ReOpen() {
wm->GetMostRecentWindow(nullptr, getter_AddRefs(mru));
if (mru) {
NSWindow *cocoaMru = nil;
NSWindow* cocoaMru = nil;
GetNativeWindowPointerFromDOMWindow(mru, &cocoaMru);
if (cocoaMru) {
[cocoaMru deminiaturize:nil];
@ -315,7 +307,7 @@ nsNativeAppSupportCocoa::ReOpen() {
} // end if have non miniaturized
if (!haveOpenWindows && !done) {
char *argv[] = {nullptr};
char* argv[] = {nullptr};
// use an empty command line to make the right kind(s) of window open
nsCOMPtr<nsICommandLineRunner> cmdLine(new nsCommandLine());
@ -336,7 +328,7 @@ nsNativeAppSupportCocoa::ReOpen() {
#pragma mark -
// Create and return an instance of class nsNativeAppSupportCocoa.
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport **aResult) {
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport** aResult) {
*aResult = new nsNativeAppSupportCocoa;
if (!*aResult) return NS_ERROR_OUT_OF_MEMORY;

View File

@ -533,9 +533,7 @@ NS_IMETHODIMP GfxInfo::SpoofOSVersion(uint32_t aVersion) {
return NS_OK;
}
NS_IMETHODIMP GfxInfo::FireTestProcess() {
return NS_OK;
}
NS_IMETHODIMP GfxInfo::FireTestProcess() { return NS_OK; }
#endif

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