Bug 1535384 part 4. Eliminate MOZ_CAN_RUN_SCRIPT_BOUNDARY for the reporting observer callback. r=baku

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-03-19 04:33:54 +00:00
Родитель 1443d56a82
Коммит adec753d03
5 изменённых файлов: 10 добавлений и 6 удалений

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

@ -7012,7 +7012,7 @@ void nsPIDOMWindowInner::BroadcastReport(Report* aReport) {
void nsPIDOMWindowInner::NotifyReportingObservers() {
nsTArray<RefPtr<ReportingObserver>> reportingObservers(mReportingObservers);
for (ReportingObserver* observer : reportingObservers) {
for (RefPtr<ReportingObserver>& observer : reportingObservers) {
observer->MaybeNotify();
}
}

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

@ -555,7 +555,7 @@ class nsPIDOMWindowInner : public mozIDOMWindow {
void BroadcastReport(mozilla::dom::Report* aReport);
void NotifyReportingObservers();
MOZ_CAN_RUN_SCRIPT void NotifyReportingObservers();
void SaveStorageAccessGranted(const nsACString& aPermissionKey);

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

@ -138,7 +138,11 @@ void ReportingObserver::MaybeReport(Report* aReport) {
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"ReportingObserver::MaybeReport",
[window]() { window->NotifyReportingObservers(); });
// MOZ_CAN_RUN_SCRIPT_BOUNDARY until at least we're able to have
// Runnable::Run be MOZ_CAN_RUN_SCRIPT. But even then, having a boundary
// here might make the most sense.
[window]()
MOZ_CAN_RUN_SCRIPT_BOUNDARY { window->NotifyReportingObservers(); });
NS_DispatchToCurrentThread(r);
}
@ -160,7 +164,8 @@ void ReportingObserver::MaybeNotify() {
}
// We should report if this throws exception. But where?
mCallback->Call(reports, *this);
RefPtr<ReportingObserverCallback> callback(mCallback);
callback->Call(reports, *this);
}
NS_IMETHODIMP

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

@ -54,7 +54,7 @@ class ReportingObserver final : public nsIObserver,
void MaybeReport(Report* aReport);
void MaybeNotify();
MOZ_CAN_RUN_SCRIPT void MaybeNotify();
private:
~ReportingObserver();

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

@ -26,7 +26,6 @@ interface ReportingObserver {
ReportList takeRecords();
};
[MOZ_CAN_RUN_SCRIPT_BOUNDARY]
callback ReportingObserverCallback = void (sequence<Report> reports, ReportingObserver observer);
dictionary ReportingObserverOptions {