Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Issue 2162983002: [Extensions] Ensure ordering of extension [un]loaded, activated messages (Closed)

Created:
4 years, 5 months ago by Devlin
Modified:
4 years, 4 months ago
Reviewers:
lazyboy
CC:
chromium-reviews, extensions-reviews_chromium.org, creis+watch_chromium.org, nasko+codewatch_chromium.org, jam, darin-cc_chromium.org, chromium-apps-reviews_chromium.org, asargent_no_longer_on_chrome
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

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 Committed: https://crrev.com/5e510e8037bb3cdf0bfb5cf07bbb7fe3c94450f9 Cr-Commit-Position: refs/heads/master@{#407796}

Patch Set 1 : Ready for review #

Total comments: 12

Patch Set 2 : Istiaque's #

Unified diffs Side-by-side diffs Delta from patch set Stats (+188 lines, -39 lines) Patch
M chrome/browser/extensions/extension_service.h View 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_service.cc View 4 chunks +6 lines, -30 lines 0 comments Download
A chrome/browser/extensions/renderer_initialization_browsertest.cc View 1 chunk +40 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/test/data/extensions/simple_with_file/file.html View 1 chunk +9 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/simple_with_file/manifest.json View 1 chunk +2 lines, -1 line 0 comments Download
M extensions/browser/extension_web_contents_observer.cc View 2 chunks +4 lines, -1 line 0 comments Download
M extensions/browser/renderer_startup_helper.h View 4 chunks +41 lines, -1 line 0 comments Download
M extensions/browser/renderer_startup_helper.cc View 1 3 chunks +69 lines, -3 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 3 chunks +11 lines, -3 lines 0 comments Download

Messages

Total messages: 49 (42 generated)
Devlin
Istiaque, mind taking a look? I think this is what's causing the OnActivateExtension crashes. +asargent@ ...
4 years, 5 months ago (2016-07-21 21:49:25 UTC) #35
lazyboy
Few comments, nothing too major. https://codereview.chromium.org/2162983002/diff/160001/extensions/browser/renderer_startup_helper.cc File extensions/browser/renderer_startup_helper.cc (right): https://codereview.chromium.org/2162983002/diff/160001/extensions/browser/renderer_startup_helper.cc#newcode111 extensions/browser/renderer_startup_helper.cc:111: process->Send(new ExtensionMsg_ActivateExtension(id)); DCHECK(extensions.Contains(id)) or ...
4 years, 5 months ago (2016-07-22 00:29:31 UTC) #37
Devlin
https://codereview.chromium.org/2162983002/diff/160001/extensions/browser/renderer_startup_helper.cc File extensions/browser/renderer_startup_helper.cc (right): https://codereview.chromium.org/2162983002/diff/160001/extensions/browser/renderer_startup_helper.cc#newcode111 extensions/browser/renderer_startup_helper.cc:111: process->Send(new ExtensionMsg_ActivateExtension(id)); On 2016/07/22 00:29:31, lazyboy wrote: > DCHECK(extensions.Contains(id)) ...
4 years, 4 months ago (2016-07-26 03:45:09 UTC) #42
lazyboy
lgtm
4 years, 4 months ago (2016-07-26 05:53:28 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2162983002/180001
4 years, 4 months ago (2016-07-26 15:06:32 UTC) #45
commit-bot: I haz the power
Committed patchset #2 (id:180001)
4 years, 4 months ago (2016-07-26 15:09:36 UTC) #47
commit-bot: I haz the power
4 years, 4 months ago (2016-07-26 15:11:12 UTC) #49
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/5e510e8037bb3cdf0bfb5cf07bbb7fe3c94450f9
Cr-Commit-Position: refs/heads/master@{#407796}

Powered by Google App Engine
This is Rietveld 408576698