Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created June 21, 2022 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/2c4dcc8576a8bd7b2b9b87a3524501dd to your computer and use it in GitHub Desktop.
Save jasonLaster/2c4dcc8576a8bd7b2b9b87a3524501dd to your computer and use it in GitHub Desktop.
diff --git a/accessible/generic/LocalAccessible.h b/accessible/generic/LocalAccessible.h
index 7f0b130c05c9..3b60481a43bc 100644
--- a/accessible/generic/LocalAccessible.h
+++ b/accessible/generic/LocalAccessible.h
@@ -178,14 +178,14 @@ class LocalAccessible : public nsISupports, public Accessible {
// When recording or replaying, use an ID which will be consistent when
// recording/replaying (pointer values are not consistent), so that IPC
// messages from the parent process can be handled when replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("UniqueID")) {
return reinterpret_cast<void*>(recordreplay::ThingIndex(this));
}
return static_cast<void*>(this);
}
static LocalAccessible* FromUniqueID(uint64_t aId) {
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("FromUniqueID")) {
return reinterpret_cast<LocalAccessible*>(recordreplay::IndexThing(aId));
}
return reinterpret_cast<LocalAccessible*>(aId);
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
index 63058c486099..0881aa3c6877 100644
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -2963,7 +2963,7 @@ mozilla::dom::TouchEventsOverride BrowsingContext::TouchEventsOverride() const {
// We map `watchedByDevTools` WebIDL attribute to `watchedByDevToolsInternal`
// BC field. And we map it to the top level BrowsingContext.
bool BrowsingContext::WatchedByDevTools() {
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("WatchedByDevTools")) {
return true;
}
return Top()->GetWatchedByDevToolsInternal();
diff --git a/dom/base/CCGCScheduler.cpp b/dom/base/CCGCScheduler.cpp
index 568bd4bb620b..bbf67988a453 100644
--- a/dom/base/CCGCScheduler.cpp
+++ b/dom/base/CCGCScheduler.cpp
@@ -207,7 +207,7 @@ void CCGCScheduler::PokeShrinkingGC() {
void CCGCScheduler::PokeFullGC() {
// GC timers aren't supported when recording/replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("PokeFullGC")) {
return;
}
@@ -266,7 +266,7 @@ void CCGCScheduler::EnsureGCRunner(uint32_t aDelay) {
}
// Incremental GC is disabled when recording/replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("Incremental GC")) {
return;
}
@@ -322,7 +322,7 @@ void CCGCScheduler::EnsureCCRunner(TimeDuration aDelay, TimeDuration aBudget) {
MOZ_ASSERT(!mDidShutdown);
// Incremental CC is disabled when recording/replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("Incremental CC")) {
return;
}
diff --git a/dom/base/ChromeUtils.cpp b/dom/base/ChromeUtils.cpp
index 3bb0053f2fae..1a5e8dfcdf28 100644
--- a/dom/base/ChromeUtils.cpp
+++ b/dom/base/ChromeUtils.cpp
@@ -270,7 +270,7 @@ void ChromeUtils::AddProfilerMarker(
/* static */
bool ChromeUtils::IsRecordingOrReplaying(GlobalObject& aGlobal) {
- return recordreplay::IsRecordingOrReplaying();
+ return recordreplay::IsRecordingOrReplaying("ChromeUtils::IsRecordingOrReplaying");
}
/* static */
diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp
index 5b146963865a..3b47b9010136 100644
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1508,7 +1508,7 @@ void nsJSContext::EndCycleCollectionCallback(CycleCollectorResults& aResults) {
bool CCGCScheduler::CCRunnerFired(TimeStamp aDeadline) {
bool didDoWork = false;
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("CCRunnerFired")) {
return false;
}
diff --git a/dom/cache/ReadStream.cpp b/dom/cache/ReadStream.cpp
index 362f226ff8fb..15ea3b7f3804 100644
--- a/dom/cache/ReadStream.cpp
+++ b/dom/cache/ReadStream.cpp
@@ -578,7 +578,7 @@ ReadStream::ReadStream(SafeRefPtr<ReadStream::Inner> aInner)
// Leak this class when recording/replaying, to avoid problems with the
// destructor being called at non-deterministic points.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("ReadStream")) {
AddRef();
}
}
diff --git a/dom/canvas/CanvasRenderingContextHelper.cpp b/dom/canvas/CanvasRenderingContextHelper.cpp
index 7f1a7d36dd59..a15e141fc5e3 100644
--- a/dom/canvas/CanvasRenderingContextHelper.cpp
+++ b/dom/canvas/CanvasRenderingContextHelper.cpp
@@ -167,7 +167,7 @@ already_AddRefed<nsISupports> CanvasRenderingContextHelper::GetContext(
if (!CanvasUtils::GetCanvasContextType(aContextId, &contextType))
return nullptr;
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("CanvasRenderingContextHelper::GetContext")) {
// GL/GPU contexts are not supported when recording/replaying.
if (contextType == CanvasContextType::WebGL1 ||
contextType == CanvasContextType::WebGL2 ||
diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp
index 21de42336abb..dc11671b58c2 100644
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -249,7 +249,7 @@ bool WebGLContext::CreateAndInitGL(
const FuncScope funcScope(*this, "<Create>");
// WebGL can't be used when recording/replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("WebGLContext::CreateAndInitGL")) {
recordreplay::ReportUnsupportedFeature("WebGL", 58);
FailureReason reason;
reason.info =
diff --git a/dom/file/ipc/RemoteLazyInputStream.cpp b/dom/file/ipc/RemoteLazyInputStream.cpp
index 873484166e03..22a2a77751a1 100644
--- a/dom/file/ipc/RemoteLazyInputStream.cpp
+++ b/dom/file/ipc/RemoteLazyInputStream.cpp
@@ -152,7 +152,7 @@ RemoteLazyInputStream::RemoteLazyInputStream(RemoteLazyInputStreamChild* aActor)
}
// Avoid non-deterministic behavior in destructor when recording/replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("RemoteLazyInputStream::RemoteLazyInputStream")) {
AddRef();
}
}
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index 94d386aadd60..cb216ee99589 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -1273,7 +1273,7 @@ HTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aRequest) {
// Media element playback is not currently supported when recording or
// replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("HTMLMediaElement::MediaLoadListener::OnStartRequest")) {
recordreplay::ReportUnsupportedFeature("MediaPlayback", 54);
mElement->ReportLoadError("Media elements not available when recording");
return NS_ERROR_NOT_AVAILABLE;
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp
index 521d2a873836..da1481f04e15 100644
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -1264,7 +1264,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvUpdateDimensions(
const DimensionInfo& aDimensionInfo) {
// When recording/replaying we need to make sure the dimensions are up to
// date on the compositor used in this process.
- if (mLayersConnected.isNothing() && !recordreplay::IsRecordingOrReplaying()) {
+ if (mLayersConnected.isNothing() && !recordreplay::IsRecordingOrReplaying("BrowserChild::RecvUpdateDimensions")) {
return IPC_OK();
}
@@ -1637,7 +1637,7 @@ void BrowserChild::FlushAllCoalescedMouseData() {
mozilla::ipc::IPCResult BrowserChild::RecvRealMouseMoveEvent(
const WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) {
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("BrowserChild::RecvRealMouseMoveEvent")) {
recordreplay::OnMouseEvent(this, aEvent);
}
@@ -1712,7 +1712,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvNormalPrioritySynthMouseMoveEvent(
mozilla::ipc::IPCResult BrowserChild::RecvRealMouseButtonEvent(
const WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) {
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("BrowserChild::RecvRealMouseButtonEvent")) {
recordreplay::OnMouseEvent(this, aEvent);
}
@@ -2121,7 +2121,7 @@ void BrowserChild::UpdateRepeatedKeyEventEndTime(
mozilla::ipc::IPCResult BrowserChild::RecvRealKeyEvent(
const WidgetKeyboardEvent& aEvent) {
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("BrowserChild::RecvRealKeyEvent")) {
recordreplay::OnKeyboardEvent(this, aEvent);
}
@@ -3724,7 +3724,7 @@ NS_IMETHODIMP BrowserChild::OnLocationChange(nsIWebProgress* aWebProgress,
"Toplevel content BrowsingContext which isn't GetBrowsingContext()?");
// Record top-level document navigation in the browser child.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("BrowserChild::OnLocationChange")) {
recordreplay::OnLocationChange(this, aLocation, aFlags);
}
diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp
index 963776032681..e8bfc2d1044b 100644
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -339,7 +339,7 @@ bool HangMonitorChild::InterruptCallback() {
// The interrupt callback is triggered at non-deterministic points when
// recording/replaying, so don't perform any operations that can interact
// with the recording.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("HangMonitorChild::InterruptCallback")) {
return true;
}
diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp
index 7af21d3fa464..a73aef121f4b 100644
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -356,7 +356,7 @@ void MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData) {
}
// Media playback is not supported when recording or replaying.
- if (recordreplay::IsRecordingOrReplaying()) {
+ if (recordreplay::IsRecordingOrReplaying("MediaFormatReader::DecoderFactory::DoCreateDecoder")) {
recordreplay::ReportUnsupportedFeature("MediaPlayback", 54);
return;
}
diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp
index fecf566daa15..8edf390bd559 100644
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -563,7 +563,7 @@ gfx::IntRect Compositor::ComputeBackdropCopyRect(
void Compositor::SetInvalid() { mParent = nullptr; }
bool Compositor::IsValid() const {
- return recordreplay::IsRecordingOrReplaying() || !!mParent;
+ return recordreplay::IsRecordingOrReplaying("Compositor::IsValid") || !!mParent;
}
void Compositor::UnlockAfterComposition(TextureHost* aTexture) {
diff --git a/mfbt/RecordReplay.h b/mfbt/RecordReplay.h
index 5d022879b3d5..f66cbb0a36d3 100644
--- a/mfbt/RecordReplay.h
+++ b/mfbt/RecordReplay.h
@@ -80,7 +80,13 @@ extern MFBT_DATA bool gIsReplaying;
extern MFBT_DATA bool gIsProfiling;
// Get the kind of recording/replaying process this is, if any.
-static inline bool IsRecordingOrReplaying() { return gIsRecordingOrReplaying; }
+static inline bool IsRecordingOrReplaying() {
+ if (TestEnv("RECORD_REPLAY_PRETEND_NOT_RECORDING")) {
+ const ids = TestEnv("RECORD_REPLAY_PRETEND_NOT_RECORDING");
+ return !ids.includes(id);
+ }
+ return gIsRecordingOrReplaying;
+}
static inline bool IsRecording() { return gIsRecording; }
static inline bool IsReplaying() { return gIsReplaying; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment