Skip to content
Commit e687ee6f authored by Yoshisato Yanagisawa's avatar Yoshisato Yanagisawa Committed by Chromium LUCI CQ
Browse files

Prevent SendSetControllerServiceWorker() before |container_| association

Since |container_| is AssociatedRemote, it must be called after it has
been associated.  Otherwise, calling its method will cause the browser
crash due to null pointer assignment.

This CL is a fix for SendSetControllerServiceWorker() callers
by preventing it called before |container_| is associated.
SendSetControllerServiceWorker() can be called in two ways;
OnExecutionReady() and UpdateController().

Since OnExecutionReady() is an mojo IPC method in ServiceWorkerContainerHost, which is AssociatedReceiver,
it must be called after |container_| is associated.

On the other hand, UpdateController() can be called anywhere
ServiceWorkerVersion need to be updated.  However, since
ControllerServiceWorkerInfoPtr is also sent when the |container_|
gets associated, we do not need to remember it and resend.
Let me avoid calling SendSetControllerServiceWorker() if the
|container_| is not associated yet.

Bug: 331156650
Change-Id: I59d6961e8886748fc4294b99a0136fff1d17d845
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5411636


Reviewed-by: default avatarMinoru Chikamune <chikamune@chromium.org>
Reviewed-by: default avatarShunya Shishido <sisidovski@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281718}
parent 38f34505
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment