Description[Extensions] Ensure ordering of extension [un]loaded, activated messages
We send three messages to the renderer in order to maintain extension
lifetime and active state: extension loaded, extension unloaded, and
extension activated. The loaded message is sent when a) an extension is
loaded and b) initially when the render process starts. Unloaded
messages are sent when an extension is unloaded to any running process.
Activated messages are sent to a renderer when a render view
corresponding to an extension is created.
Unfortunately, the existent render processes are not always initialized.
We have code to queue up messages until the render process is properly
initialized, which ensures that at least the loaded message with all
currently-loaded extensions is sent first, followed by queued messages
in FIFO. However, this breaks in the following scenario:
- Renderer created, not fully initialized (channel not created)
- Render view created, activate extension 'A' message sent. Since the
process is not initialized, this message is queued.
- Extension unloaded. Extension 'A' unloaded message is also queued.
- Renderer initialized. We initialize the renderer with all loaded
extensions, however, Extension 'A' is no longer loaded, so is
(rightly) included in the list.
- Extension renderer receives messages for loaded extensions, activate
extension 'A', unload extension 'A'. Since extension 'A' was never
loaded, the queued messages break assumptions (and cause a crash).
Fix this by passing all loaded, unloaded, and activated messages through
a common source that keeps track of initialized render processes, and
will not send messages until the process is initialized, as well as
cleaning up unnecessary messages (such as activating extensions that
have since been unloaded).
Also add a regression test.
BUG=528026
Review-Url: https://codereview.chromium.org/2162983002
Cr-Commit-Position: refs/heads/master@{#407796}
(cherry picked from commit 5e510e8037bb3cdf0bfb5cf07bbb7fe3c94450f9)
Committed: https://chromium.googlesource.com/chromium/src/+/1719b2ac728c8745554ca458188af7f6d20b3d0f
Patch Set 1 #Messages
Total messages: 3 (1 generated)
|