mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
Issue #1442 - Part 15 - Setting the correct global when ReadableStream.getReader() is called. https://bugzilla.mozilla.org/show_bug.cgi?id=1128959
This commit is contained in:
parent
842b9d47b3
commit
b124e54fc7
2 changed files with 10 additions and 10 deletions
|
|
@ -1139,6 +1139,10 @@ FetchBody<Derived>::LockStream(JSContext* aCx,
|
||||||
JS::HandleObject aStream,
|
JS::HandleObject aStream,
|
||||||
ErrorResult& aRv)
|
ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(JS::ReadableStreamGetMode(aStream) ==
|
||||||
|
JS::ReadableStreamMode::ExternalSource);
|
||||||
|
|
||||||
|
// This is native stream, creating a reader will not execute any JS code.
|
||||||
JS::Rooted<JSObject*> reader(aCx,
|
JS::Rooted<JSObject*> reader(aCx,
|
||||||
JS::ReadableStreamGetReader(aCx, aStream,
|
JS::ReadableStreamGetReader(aCx, aStream,
|
||||||
JS::ReadableStreamReaderMode::Default));
|
JS::ReadableStreamReaderMode::Default));
|
||||||
|
|
|
||||||
|
|
@ -169,17 +169,13 @@ FetchStreamReader::OnOutputStreamReady(nsIAsyncOutputStream* aStream)
|
||||||
return WriteBuffer();
|
return WriteBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoJSAPI jsapi;
|
// TODO: We need to verify this is the correct global per the spec.
|
||||||
if (NS_WARN_IF(!jsapi.Init(mGlobal))) {
|
// See bug 1385890.
|
||||||
CloseAndRelease(NS_ERROR_DOM_INVALID_STATE_ERR);
|
AutoEntryScript aes(mGlobal, "ReadableStreamReader.read", !mWorkerHolder);
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSContext* cx = jsapi.cx();
|
JS::Rooted<JSObject*> reader(aes.cx(), mReader);
|
||||||
|
JS::Rooted<JSObject*> promise(aes.cx(),
|
||||||
JS::Rooted<JSObject*> reader(cx, mReader);
|
JS::ReadableStreamDefaultReaderRead(aes.cx(),
|
||||||
JS::Rooted<JSObject*> promise(cx,
|
|
||||||
JS::ReadableStreamDefaultReaderRead(cx,
|
|
||||||
reader));
|
reader));
|
||||||
if (NS_WARN_IF(!promise)) {
|
if (NS_WARN_IF(!promise)) {
|
||||||
// Let's close the stream.
|
// Let's close the stream.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue