import from UXP: Issue #1442 - Part 14 - Starting body consuming and passing the JSContext down from the binding entrypoints to where the ReadableStream could be read. https://bugzilla.mozilla.org/show_bug.cgi?id=1128959 (842b9d47)

This commit is contained in:
2023-10-05 09:52:09 +08:00
parent c6cb042467
commit 2a63ffbdfc
15 changed files with 203 additions and 88 deletions
+6 -4
View File
@@ -403,7 +403,7 @@ public:
return;
}
WriteToCache(cache);
WriteToCache(aCx, cache);
return;
}
@@ -536,7 +536,7 @@ private:
}
void
WriteToCache(Cache* aCache)
WriteToCache(JSContext* aCx, Cache* aCache)
{
AssertIsOnMainThread();
MOZ_ASSERT(aCache);
@@ -569,8 +569,10 @@ private:
// For now we have to wait until the Put Promise is fulfilled before we can
// continue since Cache does not yet support starting a read that is being
// written to.
RefPtr<Promise> cachePromise = aCache->Put(request, *response, result);
RefPtr<Promise> cachePromise = aCache->Put(aCx, request, *response, result);
if (NS_WARN_IF(result.Failed())) {
// No exception here because there are no ReadableStreams involved here.
MOZ_ASSERT(!result.IsJSException());
MOZ_ASSERT(!result.IsErrorWithMessage());
Fail(result.StealNSResult());
return;
@@ -915,7 +917,7 @@ CompareCache::ManageCacheResult(JSContext* aCx, JS::Handle<JS::Value> aValue)
request.SetAsUSVString().Rebind(mURL.Data(), mURL.Length());
ErrorResult error;
CacheQueryOptions params;
RefPtr<Promise> promise = cache->Match(request, params, error);
RefPtr<Promise> promise = cache->Match(aCx, request, params, error);
if (NS_WARN_IF(error.Failed())) {
mManager->CacheFinished(error.StealNSResult(), false);
return;