diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-22 19:28:33 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:49 -0500 |
commit | 43a8113072b96affb2b7a3a7a4e965547d3d0c41 (patch) | |
tree | dd685edd37f2bffec27c55060e50ba8289e05760 /dom/base/nsJSUtils.cpp | |
parent | 14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f (diff) | |
download | uxp-43a8113072b96affb2b7a3a7a4e965547d3d0c41.tar.gz |
Bug 1405821 - Move microtask handling to CycleCollectedJSContext
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/nsJSUtils.cpp')
-rw-r--r-- | dom/base/nsJSUtils.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 98b367b663..b6c8430657 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -25,7 +25,7 @@ #include "xpcpublic.h" #include "nsContentUtils.h" #include "nsGlobalWindow.h" - +#include "mozilla/CycleCollectedJSContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/Date.h" #include "mozilla/dom/Element.h" @@ -159,7 +159,8 @@ nsJSUtils::EvaluateString(JSContext* aCx, aEvaluationGlobal); MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval); MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(nsContentUtils::IsInMicroTask()); + MOZ_ASSERT(CycleCollectedJSContext::Get() && + CycleCollectedJSContext::Get()->MicroTaskLevel()); // Unfortunately, the JS engine actually compiles scripts with a return value // in a different, less efficient way. Furthermore, it can't JIT them in many @@ -293,7 +294,8 @@ nsJSUtils::CompileModule(JSContext* aCx, aEvaluationGlobal); MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx) == aEvaluationGlobal); MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(nsContentUtils::IsInMicroTask()); + MOZ_ASSERT(CycleCollectedJSContext::Get() && + CycleCollectedJSContext::Get()->MicroTaskLevel()); NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK); @@ -330,7 +332,8 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule) MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext()); MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(nsContentUtils::IsInMicroTask()); + MOZ_ASSERT(CycleCollectedJSContext::Get() && + CycleCollectedJSContext::Get()->MicroTaskLevel()); NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK); |