commit | 26f26cd82a8159dff52fdef10b0a7ebb84c48040 | [log] [tgz] |
---|---|---|
author | Han Leon <leon.han@intel.com> | Sat Jun 23 22:45:06 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Sat Jun 23 22:45:06 2018 |
tree | 199c2e52fdc779ae95466535072cb1eaebc30f37 | |
parent | 20190791026106431288bb521870e9ec5ff00622 [diff] |
[ServiceWorker] Avoid using stale pointer of EmbeddedWorkerInstance We're saving the raw pointer of an EmbeddedWorkerInstance in a base::ScopedObserver member of ServiceWorkerRegisterJob, but, the EmbeddedWorkerInstance is not guaranteed to outlive the ServiceWorkerRegisterJob, it may get destroyed and lead to a situation that ServiceWorkerRegisterJob holds a stale pointer, which could lead to crash. This CL lets ServiceWorkerRegisterJob listen OnDetached() from the EmbeddedWorkerInstance so it can be aware that the EmbeddedWorkerInstanc pointer is going to be stale and should be removed from the source list of base::ScopedObserver. This fix should be safe enough now, but in longer term we'll try to remove EmbeddedWorkerInstance::Listener interface and let EmbeddedWorkerInstance talk directly to its owner ServiceWorkerVersion, then let ServiceWorkerRegisterJob observe the ServiceWorkerVersion it's manipulating to get OnScriptLoaded() notification. BUG=854063,855394 Change-Id: I9c5a46beda1aafff32a86b9055be2b53d50fda97 Reviewed-on: https://chromium-review.googlesource.com/1112904 Commit-Queue: Han Leon <leon.han@intel.com> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#569906}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .