icecat: add release icecat-140.10.1-1gnu1 for ecne
This commit is contained in:
parent
a5f93cb214
commit
ff85d7c623
1256 changed files with 63469 additions and 24141 deletions
|
|
@ -1018,18 +1018,40 @@ class FinalizationRegistryCleanup::CleanupRunnable
|
|||
: public DiscardableRunnable {
|
||||
public:
|
||||
explicit CleanupRunnable(FinalizationRegistryCleanup* aCleanupWork)
|
||||
: DiscardableRunnable("CleanupRunnable"), mCleanupWork(aCleanupWork) {}
|
||||
: DiscardableRunnable("CleanupRunnable"), mCleanupWork(aCleanupWork) {
|
||||
MOZ_ASSERT(aCleanupWork);
|
||||
}
|
||||
|
||||
virtual ~CleanupRunnable() {
|
||||
if (mCleanupWork) {
|
||||
clearPendingRunnable();
|
||||
}
|
||||
}
|
||||
|
||||
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until Runnable::Run is MOZ_CAN_RUN_SCRIPT. See
|
||||
// bug 1535398.
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||
NS_IMETHOD Run() override {
|
||||
if (!mCleanupWork) {
|
||||
// The FinalizationRegistryCleanup has been destroyed.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
clearPendingRunnable();
|
||||
|
||||
mCleanupWork->DoCleanup();
|
||||
mCleanupWork = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void clearPendingRunnable() {
|
||||
MOZ_ASSERT(mCleanupWork->mPendingRunnable == this);
|
||||
mCleanupWork->mPendingRunnable = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
FinalizationRegistryCleanup* mCleanupWork;
|
||||
friend class FinalizationRegistryCleanup;
|
||||
};
|
||||
|
||||
FinalizationRegistryCleanup::FinalizationRegistryCleanup(
|
||||
|
|
@ -1039,6 +1061,10 @@ FinalizationRegistryCleanup::FinalizationRegistryCleanup(
|
|||
void FinalizationRegistryCleanup::Destroy() {
|
||||
// This must happen before the CycleCollectedJSContext destructor calls
|
||||
// JS_DestroyContext().
|
||||
if (mPendingRunnable) {
|
||||
MOZ_ASSERT(mPendingRunnable->mCleanupWork == this);
|
||||
mPendingRunnable->mCleanupWork = nullptr;
|
||||
}
|
||||
mCallbacks.reset();
|
||||
}
|
||||
|
||||
|
|
@ -1059,7 +1085,7 @@ void FinalizationRegistryCleanup::QueueCallback(JSFunction* aDoCleanup,
|
|||
|
||||
void FinalizationRegistryCleanup::QueueCallback(JSFunction* aDoCleanup,
|
||||
JSObject* aHostDefinedData) {
|
||||
bool firstCallback = mCallbacks.empty();
|
||||
MOZ_ASSERT_IF(!mCallbacks.empty(), mPendingRunnable);
|
||||
|
||||
JSObject* incumbentGlobal = nullptr;
|
||||
|
||||
|
|
@ -1074,9 +1100,9 @@ void FinalizationRegistryCleanup::QueueCallback(JSFunction* aDoCleanup,
|
|||
|
||||
MOZ_ALWAYS_TRUE(mCallbacks.append(Callback{aDoCleanup, incumbentGlobal}));
|
||||
|
||||
if (firstCallback) {
|
||||
RefPtr<CleanupRunnable> cleanup = new CleanupRunnable(this);
|
||||
NS_DispatchToCurrentThread(cleanup.forget());
|
||||
if (!mPendingRunnable) {
|
||||
mPendingRunnable = new CleanupRunnable(this);
|
||||
NS_DispatchToCurrentThread(mPendingRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue