diff --git a/dom/streams/ReadableStreamPipeTo.cpp b/dom/streams/ReadableStreamPipeTo.cpp
index 45cc79b0b200474207392d822acdd92c8d598e9f..ed5db4f0863b3210ed4d8651e5f217e655a44013 100644
--- a/dom/streams/ReadableStreamPipeTo.cpp
+++ b/dom/streams/ReadableStreamPipeTo.cpp
@@ -607,7 +607,7 @@ void PipeToPump::OnReadFulfilled(JSContext* aCx, JS::Handle<JS::Value> aChunk,
   // matches other engines' behavior. See
   // https://github.com/whatwg/streams/issues/1243.
   RefPtr<Promise> promise =
-      Promise::CreateInfallible(mWriter->GetParentObject());
+      Promise::CreateInfallible(xpc::CurrentNativeGlobal(aCx));
   promise->MaybeResolveWithUndefined();
   auto result = promise->ThenWithCycleCollectedArgsJS(
       [](JSContext* aCx, JS::Handle<JS::Value>, ErrorResult& aRv,