Bug 1582348 - Properly clear the temporarily-pending TypeError created in WritableStreamDefaultWriterRelease. r=arai
authorJeff Walden <jwalden@mit.edu>
Thu, 07 Nov 2019 00:19:26 +0000
changeset 501033 3ba2ca38372d8e90caf3bc186ebdf0408931aa87
parent 501032 9e620f21ea4ff9cbfd1219ca02785749aa0e292a
child 501034 8caeb3eb603ccd6ed3540823f56516b093408a0b
push id99940
push userjwalden@mit.edu
push dateThu, 07 Nov 2019 00:41:19 +0000
treeherderautoland@8caeb3eb603c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1582348
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1582348 - Properly clear the temporarily-pending TypeError created in WritableStreamDefaultWriterRelease. r=arai Differential Revision: https://phabricator.services.mozilla.com/D51968
js/src/builtin/streams/WritableStreamWriterOperations.cpp
--- a/js/src/builtin/streams/WritableStreamWriterOperations.cpp
+++ b/js/src/builtin/streams/WritableStreamWriterOperations.cpp
@@ -19,16 +19,17 @@
 #include "builtin/streams/WritableStream.h"  // js::WritableStream
 #include "builtin/streams/WritableStreamDefaultController.h"  // js::WritableStream::controller
 #include "builtin/streams/WritableStreamDefaultControllerOperations.h"  // js::WritableStreamDefaultController{Close,GetDesiredSize}
 #include "builtin/streams/WritableStreamDefaultWriter.h"  // js::WritableStreamDefaultWriter
 #include "builtin/streams/WritableStreamOperations.h"  // js::WritableStream{Abort,CloseQueuedOrInFlight}
 #include "js/Promise.h"                                // JS::PromiseState
 #include "js/Value.h"  // JS::Value, JS::{Int32,Null}Value
 #include "vm/Compartment.h"  // JS::Compartment
+#include "vm/Interpreter.h"  // js::GetAndClearException
 #include "vm/JSContext.h"    // JSContext
 
 #include "builtin/streams/MiscellaneousOperations-inl.h"  // js::ResolveUnwrappedPromiseWithUndefined
 #include "builtin/streams/WritableStream-inl.h"  // js::WritableStream::setCloseRequest
 #include "builtin/streams/WritableStreamDefaultWriter-inl.h"  // js::UnwrapStreamFromWriter
 #include "vm/Compartment-inl.h"  // js::UnwrapAnd{DowncastObject,TypeCheckThis}
 #include "vm/JSContext-inl.h"    // JSContext::check
 #include "vm/Realm-inl.h"        // js::AutoRealm
@@ -274,17 +275,17 @@ bool js::WritableStreamDefaultWriterRele
     MOZ_ASSERT(unwrappedStreamWriter == unwrappedWriter);
   }
 #endif
 
   // Step 4: Let releasedError be a new TypeError.
   Rooted<Value> releasedError(cx);
   JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                             JSMSG_WRITABLESTREAM_CANT_RELEASE_ALREADY_CLOSED);
-  if (!cx->isExceptionPending() || !cx->getPendingException(&releasedError)) {
+  if (!cx->isExceptionPending() || !GetAndClearException(cx, &releasedError)) {
     return false;
   }
 
   // Step 5: Perform
   //         ! WritableStreamDefaultWriterEnsureReadyPromiseRejected(
   //               writer, releasedError).
   if (!WritableStreamDefaultWriterEnsureReadyPromiseRejected(
           cx, unwrappedWriter, releasedError)) {