diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 2834aa173705..c83774ab05a8 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -295,9 +295,10 @@ private: friend void mozilla::TimelineConsumers::AddConsumer(nsDocShell*); friend void mozilla::TimelineConsumers::RemoveConsumer(nsDocShell*); friend void mozilla::TimelineConsumers::AddMarkerForDocShell( - nsDocShell*, const char*, MarkerTracingType); + nsDocShell*, const char*, MarkerTracingType, MarkerStackRequest); friend void mozilla::TimelineConsumers::AddMarkerForDocShell( - nsDocShell*, const char*, const TimeStamp&, MarkerTracingType); + nsDocShell*, const char*, const TimeStamp&, MarkerTracingType, + MarkerStackRequest); friend void mozilla::TimelineConsumers::AddMarkerForDocShell( nsDocShell*, UniquePtr&&); friend void mozilla::TimelineConsumers::PopMarkers(nsDocShell*, diff --git a/docshell/base/timeline/TimelineConsumers.cpp b/docshell/base/timeline/TimelineConsumers.cpp index c59beef074b1..2668cdc9b625 100644 --- a/docshell/base/timeline/TimelineConsumers.cpp +++ b/docshell/base/timeline/TimelineConsumers.cpp @@ -173,11 +173,12 @@ TimelineConsumers::IsEmpty() void TimelineConsumers::AddMarkerForDocShell(nsDocShell* aDocShell, const char* aName, - MarkerTracingType aTracingType) + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest) { MOZ_ASSERT(NS_IsMainThread()); if (HasConsumer(aDocShell)) { - aDocShell->mObserved->AddMarker(Move(MakeUnique(aName, aTracingType))); + aDocShell->mObserved->AddMarker(Move(MakeUnique(aName, aTracingType, aStackRequest))); } } @@ -185,11 +186,12 @@ void TimelineConsumers::AddMarkerForDocShell(nsDocShell* aDocShell, const char* aName, const TimeStamp& aTime, - MarkerTracingType aTracingType) + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest) { MOZ_ASSERT(NS_IsMainThread()); if (HasConsumer(aDocShell)) { - aDocShell->mObserved->AddMarker(Move(MakeUnique(aName, aTime, aTracingType))); + aDocShell->mObserved->AddMarker(Move(MakeUnique(aName, aTime, aTracingType, aStackRequest))); } } @@ -206,20 +208,22 @@ TimelineConsumers::AddMarkerForDocShell(nsDocShell* aDocShell, void TimelineConsumers::AddMarkerForDocShell(nsIDocShell* aDocShell, const char* aName, - MarkerTracingType aTracingType) + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest) { MOZ_ASSERT(NS_IsMainThread()); - AddMarkerForDocShell(static_cast(aDocShell), aName, aTracingType); + AddMarkerForDocShell(static_cast(aDocShell), aName, aTracingType, aStackRequest); } void TimelineConsumers::AddMarkerForDocShell(nsIDocShell* aDocShell, const char* aName, const TimeStamp& aTime, - MarkerTracingType aTracingType) + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest) { MOZ_ASSERT(NS_IsMainThread()); - AddMarkerForDocShell(static_cast(aDocShell), aName, aTime, aTracingType); + AddMarkerForDocShell(static_cast(aDocShell), aName, aTime, aTracingType, aStackRequest); } void diff --git a/docshell/base/timeline/TimelineConsumers.h b/docshell/base/timeline/TimelineConsumers.h index 9119a3bab85f..04099e1b9e65 100644 --- a/docshell/base/timeline/TimelineConsumers.h +++ b/docshell/base/timeline/TimelineConsumers.h @@ -71,19 +71,23 @@ public: // Main thread only. void AddMarkerForDocShell(nsDocShell* aDocShell, const char* aName, - MarkerTracingType aTracingType); + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest = MarkerStackRequest::STACK); void AddMarkerForDocShell(nsIDocShell* aDocShell, const char* aName, - MarkerTracingType aTracingType); + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest = MarkerStackRequest::STACK); void AddMarkerForDocShell(nsDocShell* aDocShell, const char* aName, const TimeStamp& aTime, - MarkerTracingType aTracingType); + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest = MarkerStackRequest::STACK); void AddMarkerForDocShell(nsIDocShell* aDocShell, const char* aName, const TimeStamp& aTime, - MarkerTracingType aTracingType); + MarkerTracingType aTracingType, + MarkerStackRequest aStackRequest = MarkerStackRequest::STACK); // These methods register and receive ownership of an already created marker, // relevant for a specific docshell. diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 77b4701650a8..d6660ffd3137 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3157,10 +3157,16 @@ TabChild::DidRequestComposite(const TimeStamp& aCompositeReqStart, RefPtr timelines = TimelineConsumers::Get(); if (timelines && timelines->HasConsumer(docShell)) { + // Since we're assuming that it's impossible for content JS to directly + // trigger a synchronous paint, we can avoid capturing a stack trace here, + // which means we won't run into JS engine reentrancy issues like bug + // 1310014. timelines->AddMarkerForDocShell(docShell, - "CompositeForwardTransaction", aCompositeReqStart, MarkerTracingType::START); + "CompositeForwardTransaction", aCompositeReqStart, + MarkerTracingType::START, MarkerStackRequest::NO_STACK); timelines->AddMarkerForDocShell(docShell, - "CompositeForwardTransaction", aCompositeReqEnd, MarkerTracingType::END); + "CompositeForwardTransaction", aCompositeReqEnd, + MarkerTracingType::END, MarkerStackRequest::NO_STACK); } }