Bug 1743439 - Part 2: Mark callers in dom/indexedDB and dom/workers as MOZ_CAN_RUN_SCRIPT_BOUNDARY r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D133361
This commit is contained in:
Kagami Sascha Rosylight
2021-12-09 19:56:08 +00:00
parent 7727c3cbab
commit 711d09f08e
4 changed files with 10 additions and 6 deletions

View File

@@ -460,7 +460,7 @@ nsresult IndexedDatabaseManager::CommonPostHandleEvent(
errorEvent->SetTrusted(true);
auto* target = static_cast<EventTarget*>(globalScope.get());
RefPtr<EventTarget> target = static_cast<EventTarget*>(globalScope.get());
if (NS_WARN_IF(NS_FAILED(EventDispatcher::DispatchDOMEvent(
target,

View File

@@ -133,8 +133,9 @@ class IndexedDatabaseManager final {
static const nsCString& GetLocale();
static nsresult CommonPostHandleEvent(EventChainPostVisitor& aVisitor,
const IDBFactory& aFactory);
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230)
MOZ_CAN_RUN_SCRIPT_BOUNDARY static nsresult CommonPostHandleEvent(
EventChainPostVisitor& aVisitor, const IDBFactory& aFactory);
static bool ResolveSandboxBinding(JSContext* aCx);

View File

@@ -322,7 +322,7 @@ void WorkerErrorReport::ReportError(
nsEventStatus status = nsEventStatus_eIgnore;
if (aWorkerPrivate) {
WorkerGlobalScope* globalScope = nullptr;
RefPtr<WorkerGlobalScope> globalScope;
UNWRAP_OBJECT(WorkerGlobalScope, &global, globalScope);
if (!globalScope) {
@@ -353,8 +353,10 @@ void WorkerErrorReport::ReportError(
ErrorEvent::Constructor(aTarget, u"error"_ns, init);
event->SetTrusted(true);
// TODO: Bug 1506441
if (NS_FAILED(EventDispatcher::DispatchDOMEvent(
ToSupports(globalScope), nullptr, event, nullptr, &status))) {
MOZ_KnownLive(ToSupports(globalScope)), nullptr, event, nullptr,
&status))) {
NS_WARNING("Failed to dispatch worker thread error event!");
status = nsEventStatus_eIgnore;
}

View File

@@ -53,7 +53,8 @@ class WorkerErrorReport : public WorkerErrorBase, public SerializedStackHolder {
// aWorkerPrivate is the worker thread we're on (or the main thread, if null)
// aTarget is the worker object that we are going to fire an error at
// (if any).
static void ReportError(
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1743443)
MOZ_CAN_RUN_SCRIPT_BOUNDARY static void ReportError(
JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aFireAtScope,
DOMEventTargetHelper* aTarget, UniquePtr<WorkerErrorReport> aReport,
uint64_t aInnerWindowId,