Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-01-09 12:01:14 +08:00
commit d4a80aa2c4
42 changed files with 538 additions and 364 deletions

View file

@ -5,7 +5,6 @@
#include "mozilla/dom/CustomElementRegistry.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/dom/CustomElementRegistryBinding.h"
#include "mozilla/dom/HTMLElementBinding.h"
#include "mozilla/dom/WebComponentsBinding.h"
@ -1153,7 +1152,7 @@ CustomElementReactionsStack::Enqueue(Element* aElement,
CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
RefPtr<BackupQueueMicroTask> bqmt = new BackupQueueMicroTask(this);
context->DispatchMicroTaskRunnable(bqmt.forget());
context->DispatchToMicroTask(bqmt.forget());
}
void

View file

@ -9,6 +9,7 @@
#include "js/GCHashTable.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/FunctionBinding.h"

View file

@ -5418,10 +5418,10 @@ nsContentUtils::RunInStableState(already_AddRefed<nsIRunnable> aRunnable)
/* static */
void
nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
nsContentUtils::AddPendingIDBTransaction(already_AddRefed<nsIRunnable> aTransaction)
{
MOZ_ASSERT(CycleCollectedJSContext::Get(), "Must be on a script thread!");
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
CycleCollectedJSContext::Get()->AddPendingIDBTransaction(Move(aTransaction));
}
/*
@ -6472,9 +6472,16 @@ nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
contentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer));
// If there are 2 viewers for the current docshell, that
// means the current document is a zombie document.
// Only navigate into the subdocument if it's not a zombie.
return !zombieViewer;
// means the current document may be a zombie document.
// While load and pageshow events are dispatched, zombie viewer is the old,
// to be hidden document.
if (zombieViewer) {
bool inOnLoad = false;
docShell->GetIsExecutingOnLoadHandler(&inOnLoad);
return inOnLoad;
}
return true;
}
bool

View file

@ -1766,17 +1766,12 @@ public:
*/
static void RunInStableState(already_AddRefed<nsIRunnable> aRunnable);
/* Add a "synchronous section", in the form of an nsIRunnable run once the
* event loop has reached a "metastable state". |aRunnable| must not cause any
* queued events to be processed (i.e. must not spin the event loop).
* We've reached a metastable state when the currently executing task or
* microtask has finished. This is not specced at this time.
* In practice this runs aRunnable once the currently executing task or
* microtask finishes. If called multiple times per microtask, all the
* runnables will be executed, in the order in which RunInMetastableState()
* was called
/* Add a pending IDBTransaction to be cleaned up at the end of performing a
* microtask checkpoint.
* See the step of "Cleanup Indexed Database Transactions" in
* https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint
*/
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
static void AddPendingIDBTransaction(already_AddRefed<nsIRunnable> aTransaction);
/* Process viewport META data. This gives us information for the scale
* and zoom of a page on mobile devices. We stick the information in

View file

@ -623,7 +623,7 @@ nsDOMMutationObserver::QueueMutationObserverMicroTask()
RefPtr<MutationObserverMicroTask> momt =
new MutationObserverMicroTask();
ccjs->DispatchMicroTaskRunnable(momt.forget());
ccjs->DispatchToMicroTask(momt.forget());
}
void
@ -644,9 +644,8 @@ nsDOMMutationObserver::RescheduleForRun()
return;
}
RefPtr<MutationObserverMicroTask> momt =
new MutationObserverMicroTask();
ccjs->DispatchMicroTaskRunnable(momt.forget());
RefPtr<MutationObserverMicroTask> momt = new MutationObserverMicroTask();
ccjs->DispatchToMicroTask(momt.forget());
sScheduledMutationObservers = new AutoTArray<RefPtr<nsDOMMutationObserver>, 4>;
}

View file

@ -908,6 +908,7 @@ GK_ATOM(onreadsuccess, "onreadsuccess")
GK_ATOM(onready, "onready")
GK_ATOM(onreadystatechange, "onreadystatechange")
GK_ATOM(onreceived, "onreceived")
GK_ATOM(onrejectionhandled, "onrejectionhandled")
GK_ATOM(onremoteheld, "onremoteheld")
GK_ATOM(onremoteresumed, "onremoteresumed")
GK_ATOM(onrequestprogress, "onrequestprogress")
@ -951,6 +952,7 @@ GK_ATOM(ontransitionend, "ontransitionend")
GK_ATOM(ontransitionrun, "ontransitionrun")
GK_ATOM(ontransitionstart, "ontransitionstart")
GK_ATOM(onunderflow, "onunderflow")
GK_ATOM(onunhandledrejection, "onunhandledrejection")
GK_ATOM(onunload, "onunload")
GK_ATOM(onupdatefound, "onupdatefound")
GK_ATOM(onupdateready, "onupdateready")

View file

@ -13011,12 +13011,6 @@ nsGlobalWindow::RunTimeoutHandler(Timeout* aTimeout,
// point anyway, and the script context should have already reported
// the script error in the usual way - so we just drop it.
// Since we might be processing more timeouts, go ahead and flush the promise
// queue now before we do that. We need to do that while we're still in our
// "running JS is safe" state (e.g. mRunningTimeout is set, timeout->mRunning
// is false).
Promise::PerformMicroTaskCheckpoint();
if (trackNestingLevel) {
sNestingLevel = nestingLevel;
}

View file

@ -145,6 +145,6 @@ void nsIGlobalObject::QueueMicrotask(VoidFunction& aCallback) {
CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
if (context) {
RefPtr<MicroTaskRunnable> mt = new QueuedMicrotask(this, aCallback);
context->DispatchMicroTaskRunnable(mt.forget());
context->DispatchToMicroTask(mt.forget());
}
}