diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index e2db14243861..053d3906436f 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1269,19 +1269,21 @@ void nsPresContext::RecordInteractionTime(InteractionType aType, // Record the interaction time if it occurs after the first paint // of the top level content document. - nsPresContext* topContentPresContext = + nsPresContext* inProcessRootPresContext = GetInProcessRootContentDocumentPresContext(); - if (!topContentPresContext) { - // There is no top content pres context so we don't care - // about the interaction time. Record a value anyways to avoid - // trying to find the top content pres context in future interactions. + if (!inProcessRootPresContext || + !inProcessRootPresContext->IsRootContentDocumentCrossProcess()) { + // There is no top content pres context, or we are in a cross process + // document so we don't care about the interaction time. Record a value + // anyways to avoid trying to find the top content pres context in future + // interactions. interactionTime = TimeStamp::Now(); return; } - if (topContentPresContext->mFirstNonBlankPaintTime.IsNull() || - topContentPresContext->mFirstNonBlankPaintTime > aTimeStamp) { + if (inProcessRootPresContext->mFirstNonBlankPaintTime.IsNull() || + inProcessRootPresContext->mFirstNonBlankPaintTime > aTimeStamp) { // Top content pres context has not had a non-blank paint yet // or the event timestamp is before the first non-blank paint, // so don't record interaction time. @@ -1301,7 +1303,7 @@ void nsPresContext::RecordInteractionTime(InteractionType aType, interactionTime = TimeStamp::Now(); // Only the top level content pres context reports first interaction // time to telemetry (if it hasn't already done so). - if (this == topContentPresContext) { + if (this == inProcessRootPresContext) { if (Telemetry::CanRecordExtended()) { double millis = (interactionTime - mFirstNonBlankPaintTime).ToMilliseconds(); @@ -1312,7 +1314,7 @@ void nsPresContext::RecordInteractionTime(InteractionType aType, } } } else { - topContentPresContext->RecordInteractionTime(aType, aTimeStamp); + inProcessRootPresContext->RecordInteractionTime(aType, aTimeStamp); } }