summaryrefslogtreecommitdiff
path: root/dom/base/nsDocument.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-22 19:28:33 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:49 -0500
commite028d32ad14d7092bc17bcab8c8d380f10bd6f07 (patch)
treedd685edd37f2bffec27c55060e50ba8289e05760 /dom/base/nsDocument.cpp
parentb528068af722a20d010400803b9d968c194cffca (diff)
downloaduxp-e028d32ad14d7092bc17bcab8c8d380f10bd6f07.tar.gz
Bug 1405821 - Move microtask handling to CycleCollectedJSContext
Tag UXP Issue mcp-graveyard/UXP#1344
Diffstat (limited to 'dom/base/nsDocument.cpp')
-rw-r--r--dom/base/nsDocument.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index f3e4925893..293e48eb0d 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12610,8 +12610,12 @@ MarkDocumentTreeToBeInSyncOperation(nsIDocument* aDoc, void* aData)
nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
{
- mMicroTaskLevel = nsContentUtils::MicroTaskLevel();
- nsContentUtils::SetMicroTaskLevel(0);
+ mMicroTaskLevel = 0;
+ CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
+ if (ccjs) {
+ mMicroTaskLevel = ccjs->MicroTaskLevel();
+ ccjs->SetMicroTaskLevel(0);
+ }
if (aDoc) {
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
@@ -12627,7 +12631,10 @@ nsAutoSyncOperation::~nsAutoSyncOperation()
for (int32_t i = 0; i < mDocuments.Count(); ++i) {
mDocuments[i]->SetIsInSyncOperation(false);
}
- nsContentUtils::SetMicroTaskLevel(mMicroTaskLevel);
+ CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
+ if (ccjs) {
+ ccjs->SetMicroTaskLevel(mMicroTaskLevel);
+ }
}
gfxUserFontSet*