Bug 1535384 part 8. Remove MOZ_CAN_RUN_SCRIPT_BOUNDARY for Web IDL Function. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D23779

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-03-19 20:52:03 +00:00
Родитель 295d09cba1
Коммит 3cd3acc695
9 изменённых файлов: 24 добавлений и 15 удалений

Просмотреть файл

@ -221,8 +221,9 @@ void TimeoutExecutor::Cancel() {
mDeadline = TimeStamp();
}
NS_IMETHODIMP
TimeoutExecutor::Run() {
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until Runnable::Run is MOZ_CAN_RUN_SCRIPT. See
// bug 1535398.
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP TimeoutExecutor::Run() {
// If the executor is canceled and then rescheduled its possible to get
// spurious executions here. Ignore these unless our current mode matches.
MOZ_LOG(gTimeoutLog, LogLevel::Debug,
@ -233,7 +234,9 @@ TimeoutExecutor::Run() {
return NS_OK;
}
NS_IMETHODIMP
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until nsITimerCallback::Notify is
// MOZ_CAN_RUN_SCRIPT.
MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP
TimeoutExecutor::Notify(nsITimer* aTimer) {
// If the executor is canceled and then rescheduled its possible to get
// spurious executions here. Ignore these unless our current mode matches.

Просмотреть файл

@ -66,7 +66,7 @@ class TimeoutExecutor final : public nsIRunnable,
nsresult MaybeReschedule(const TimeStamp& aDeadline,
const TimeDuration& aMinDelay);
void MaybeExecute();
MOZ_CAN_RUN_SCRIPT void MaybeExecute();
public:
TimeoutExecutor(TimeoutManager* aOwner, bool aIsIdleQueue,

Просмотреть файл

@ -741,11 +741,10 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
// Make sure that the window and the script context don't go away as
// a result of running timeouts
nsCOMPtr<nsIScriptGlobalObject> windowKungFuDeathGrip(&mWindow);
// Silence the static analysis error about windowKungFuDeathGrip. Accessing
// members of mWindow here is safe, because the lifetime of TimeoutManager is
// the same as the lifetime of the containing nsGlobalWindow.
Unused << windowKungFuDeathGrip;
RefPtr<nsGlobalWindowInner> window(&mWindow);
// Accessing members of mWindow here is safe, because the lifetime of
// TimeoutManager is the same as the lifetime of the containing
// nsGlobalWindow.
// A native timer has gone off. See which of our timeouts need
// servicing
@ -976,8 +975,9 @@ void TimeoutManager::RunTimeout(const TimeStamp& aNow,
MOZ_ASSERT(timeout->mFiringIndex > mLastFiringIndex);
mLastFiringIndex = timeout->mFiringIndex;
#endif
// This timeout is good to run
bool timeout_was_cleared = mWindow.RunTimeoutHandler(timeout, scx);
// This timeout is good to run.
bool timeout_was_cleared =
window->RunTimeoutHandler(timeout, scx);
#if MOZ_GECKO_PROFILER
if (profiler_is_active()) {
TimeDuration elapsed = now - timeout->SubmitTime();

Просмотреть файл

@ -52,6 +52,7 @@ class TimeoutManager final {
bool aIsIdle);
// The timeout implementation functions.
MOZ_CAN_RUN_SCRIPT
void RunTimeout(const TimeStamp& aNow, const TimeStamp& aTargetDeadline,
bool aProcessIdle);

Просмотреть файл

@ -5559,6 +5559,8 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
nsIScriptContext* aScx) {
// Hold on to the timeout in case mExpr or mFunObj releases its
// doc.
// XXXbz Our caller guarantees it'll hold on to the timeout (because
// we're MOZ_CAN_RUN_SCRIPT), so we can probably stop doing that...
RefPtr<Timeout> timeout = aTimeout;
Timeout* last_running_timeout = mTimeoutManager->BeginRunningTimeout(timeout);
timeout->mRunning = true;

Просмотреть файл

@ -1053,6 +1053,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
mozilla::ErrorResult& aError);
// Return true if |aTimeout| was cleared while its handler ran.
MOZ_CAN_RUN_SCRIPT
bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout,
nsIScriptContext* aScx);

Просмотреть файл

@ -10,7 +10,6 @@
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
[MOZ_CAN_RUN_SCRIPT_BOUNDARY]
callback Function = any(any... arguments);
callback VoidFunction = void ();

Просмотреть файл

@ -551,6 +551,9 @@ class TimerRunnable final : public WorkerRunnable,
// Silence bad assertions.
}
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until worker runnables are generally
// MOZ_CAN_RUN_SCRIPT.
MOZ_CAN_RUN_SCRIPT_BOUNDARY
virtual bool WorkerRun(JSContext* aCx,
WorkerPrivate* aWorkerPrivate) override {
return aWorkerPrivate->RunExpiredTimeouts(aCx);
@ -4267,8 +4270,8 @@ bool WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) {
} else {
ErrorResult rv;
JS::Rooted<JS::Value> ignoredVal(aCx);
callback->Call(GlobalScope(), info->mHandler->GetArgs(), &ignoredVal, rv,
reason);
RefPtr<WorkerGlobalScope> scope = GlobalScope();
callback->Call(scope, info->mHandler->GetArgs(), &ignoredVal, rv, reason);
if (rv.IsUncatchableException()) {
rv.SuppressException();
retval = false;

Просмотреть файл

@ -254,7 +254,7 @@ class WorkerPrivate : public RelativeTimeline {
void ClearTimeout(int32_t aId);
bool RunExpiredTimeouts(JSContext* aCx);
MOZ_CAN_RUN_SCRIPT bool RunExpiredTimeouts(JSContext* aCx);
bool RescheduleTimeoutTimer(JSContext* aCx);