summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-01-26 22:42:46 +0000
committerMoonchild <moonchild@palemoon.org>2021-01-26 22:42:46 +0000
commit8fd57ace20e1e6bb59dd83ed59f513954c0aed9d (patch)
tree7d35359f7361ec1a649429085010b2464f17059a
parent2836e514661df0ffd816cf957ecc35c968377fbe (diff)
downloaduxp-8fd57ace20e1e6bb59dd83ed59f513954c0aed9d.tar.gz
[DOM] Try to avoid slow shrinking GC during sync calls
-rw-r--r--dom/canvas/ImageBitmap.cpp2
-rw-r--r--dom/workers/WorkerPrivate.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp
index bb47618a63..62de20763b 100644
--- a/dom/canvas/ImageBitmap.cpp
+++ b/dom/canvas/ImageBitmap.cpp
@@ -930,7 +930,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, ImageData& aImageData,
const Maybe<IntRect>& aCropRect, ErrorResult& aRv)
{
// Copy data into SourceSurface.
- dom::Uint8ClampedArray array;
+ RootedTypedArray<Uint8ClampedArray> array(RootingCx());
DebugOnly<bool> inited = array.Init(aImageData.GetDataObject());
MOZ_ASSERT(inited);
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index 860bf8468e..1f8b3b70c4 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -6392,7 +6392,7 @@ WorkerPrivate::GarbageCollectInternal(JSContext* aCx, bool aShrinking,
if (aShrinking || aCollectChildren) {
JS::PrepareForFullGC(aCx);
- if (aShrinking) {
+ if (aShrinking && mSyncLoopStack.IsEmpty()) {
JS::GCForReason(aCx, GC_SHRINK, JS::gcreason::DOM_WORKER);
if (!aCollectChildren) {