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:Minoru Chikamune <chikamune@chromium.org> Reviewed-by:
Shunya Shishido <sisidovski@chromium.org> Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org> Reviewed-by:
Hiroki Nakagawa <nhiroki@chromium.org> Cr-Commit-Position: refs/heads/main@{#1281718}
Loading
Please register or sign in to comment