diff options
author | kalman <kalman@chromium.org> | 2015-06-03 16:12:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-03 23:13:03 +0000 |
commit | 8bcbc759e797556b4bd4ec80d22e597a8ca12695 (patch) | |
tree | 1a6419d9a7a7988dce982f0036cbf003741489df /extensions/renderer/dispatcher.h | |
parent | 6c62dd97b4dc6d5ed852a8951249219f556f71a3 (diff) | |
download | chromium_src-8bcbc759e797556b4bd4ec80d22e597a8ca12695.zip chromium_src-8bcbc759e797556b4bd4ec80d22e597a8ca12695.tar.gz chromium_src-8bcbc759e797556b4bd4ec80d22e597a8ca12695.tar.bz2 |
Don't send unnecessary ExtensionMsg_Loaded IPCs.
Each time ExtensionMsg_Loaded is sent it re-creates the set of Extensions it
gives, invalidating the existing ones. This means that anything that holds onto
Extensions for long periods of time - like ScriptContextSet - can end up in
situations where they have an Extension with the same ID as an installed
Extension, but different in pointer equality.
It turns out that we send ExtensionMsg_Loaded every time a RenderViewHost is
created, but it should only be send every time a RenderProcessHost is created,
because the Extension sets are process-wide.
While this bug is fundamental, one way it manifests itself is by the
chrome.permissions.request API not updating the JavaScript context when
permissions are granted.
BUG=435141
Review URL: https://codereview.chromium.org/1142993002
Cr-Commit-Position: refs/heads/master@{#332720}
Diffstat (limited to 'extensions/renderer/dispatcher.h')
-rw-r--r-- | extensions/renderer/dispatcher.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h index f85c1ad..982473b 100644 --- a/extensions/renderer/dispatcher.h +++ b/extensions/renderer/dispatcher.h @@ -137,10 +137,18 @@ class Dispatcher : public content::RenderProcessObserver, bool WasWebRequestUsedBySomeExtensions() const { return webrequest_used_; } private: + // The RendererPermissionsPolicyDelegateTest.CannotScriptWebstore test needs + // to call LoadExtensionForTest and the OnActivateExtension IPCs. friend class ::ChromeRenderViewTest; FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, CannotScriptWebstore); + // Inserts an Extension into |extensions_|. Normally the only way to do this + // would be through the ExtensionMsg_Loaded IPC (OnLoaded) but this can't be + // triggered for tests, because in the process of serializing then + // deserializing the IPC, Extension IDs manually set for testing are lost. + void LoadExtensionForTest(const Extension* extension); + // RenderProcessObserver implementation: bool OnControlMessageReceived(const IPC::Message& message) override; void WebKitInitialized() override; @@ -158,7 +166,6 @@ class Dispatcher : public content::RenderProcessObserver, void OnDispatchOnDisconnect(int port_id, const std::string& error_message); void OnLoaded( const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); - void OnLoadedInternal(scoped_refptr<const Extension> extension); void OnMessageInvoke(const std::string& extension_id, const std::string& module_name, const std::string& function_name, |