Skip to content

Commit

Permalink
Bug 1423913 P2 Make callers expect infallble CreateSource() and Creat…
Browse files Browse the repository at this point in the history
…eHandle(). r=baku
  • Loading branch information
wanderview committed Dec 8, 2017
1 parent 10e891e commit 65e9628
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
4 changes: 1 addition & 3 deletions docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3442,9 +3442,7 @@ nsDocShell::MaybeCreateInitialClientSource(nsIPrincipal* aPrincipal)
ClientManager::CreateSource(ClientType::Window,
win->EventTargetFor(TaskCategory::Other),
principal);
if (NS_WARN_IF(!mInitialClientSource)) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(mInitialClientSource);

// Mark the initial client as execution ready, but owned by the docshell.
// If the client is actually used this will cause ClientSource to force
Expand Down
8 changes: 2 additions & 6 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1796,9 +1796,7 @@ nsGlobalWindowInner::EnsureClientSource()
mClientSource = ClientManager::CreateSource(ClientType::Window,
EventTargetFor(TaskCategory::Other),
mDoc->NodePrincipal());
if (NS_WARN_IF(!mClientSource)) {
return NS_ERROR_FAILURE;
}
MOZ_DIAGNOSTIC_ASSERT(mClientSource);
newClientSource = true;
}

Expand Down Expand Up @@ -1828,9 +1826,7 @@ nsGlobalWindowInner::EnsureClientSource()
ClientManager::CreateSource(ClientType::Window,
EventTargetFor(TaskCategory::Other),
mDoc->NodePrincipal());
if (NS_WARN_IF(!mClientSource)) {
return NS_ERROR_FAILURE;
}
MOZ_DIAGNOSTIC_ASSERT(mClientSource);
newClientSource = true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion dom/clients/manager/ClientChannelHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class ClientChannelHelper final : public nsIInterfaceRequestor
reservedClient.reset();
reservedClient = ClientManager::CreateSource(ClientType::Window,
mEventTarget, principal);
MOZ_DIAGNOSTIC_ASSERT(reservedClient);

newLoadInfo->GiveReservedClientSource(Move(reservedClient));
}
Expand Down Expand Up @@ -228,7 +229,7 @@ AddClientChannelHelper(nsIChannel* aChannel,
reservedClient = ClientManager::CreateSource(ClientType::Window,
aEventTarget,
channelPrincipal);
NS_ENSURE_TRUE(reservedClient, NS_ERROR_FAILURE);
MOZ_DIAGNOSTIC_ASSERT(reservedClient);
}

RefPtr<ClientChannelHelper> helper =
Expand Down
8 changes: 2 additions & 6 deletions dom/workers/ServiceWorkerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2376,9 +2376,7 @@ ServiceWorkerManager::StartControllingADocument(ServiceWorkerRegistrationInfo* a
RefPtr<ClientHandle> clientHandle =
ClientManager::CreateHandle(clientInfo.ref(),
SystemGroup::EventTargetFor(TaskCategory::Other));
if (clientHandle) {
ref = Move(clientHandle->Control(activeWorker->Descriptor()));
}
ref = Move(clientHandle->Control(activeWorker->Descriptor()));
}
}

Expand Down Expand Up @@ -2724,9 +2722,7 @@ ServiceWorkerManager::DispatchFetchEvent(const OriginAttributes& aOriginAttribut
RefPtr<ClientHandle> clientHandle =
ClientManager::CreateHandle(clientInfo.ref(),
SystemGroup::EventTargetFor(TaskCategory::Other));
if (clientHandle) {
clientHandle->Control(serviceWorker->Descriptor());
}
clientHandle->Control(serviceWorker->Descriptor());
}

// But we also note the reserved state on the LoadInfo. This allows the
Expand Down
4 changes: 1 addition & 3 deletions dom/workers/WorkerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5332,9 +5332,7 @@ WorkerPrivate::EnsureClientSource()

mClientSource = ClientManager::CreateSource(type, mWorkerHybridEventTarget,
GetPrincipalInfo());
if (!mClientSource) {
return false;
}
MOZ_DIAGNOSTIC_ASSERT(mClientSource);

if (mFrozen) {
mClientSource->Freeze();
Expand Down

0 comments on commit 65e9628

Please sign in to comment.