Bug 1350640 - Send blocklist state on plugin list update; r=bsmedberg

Instead of synchronously checking the blocklist, package each plugin's
blocklist state with it when sending the information to the content
process. Whenever the blocklist is changed, just resend the whole
plugin list.

MozReview-Commit-ID: 1AX1EDdTRqb
This commit is contained in:
Kyle Machulis
2017-07-13 17:11:55 -07:00
parent f75e6f88c2
commit 1627fac44e
5 changed files with 54 additions and 29 deletions

View File

@@ -2365,6 +2365,7 @@ nsPluginHost::SetPluginsInContent(uint32_t aPluginEpoch,
// Don't add the same plugin again.
if (nsPluginTag* existing = PluginWithId(tag.id())) {
UpdateInMemoryPluginInfo(existing);
existing->SetBlocklistState(tag.blocklistState());
continue;
}
@@ -2382,7 +2383,8 @@ nsPluginHost::SetPluginsInContent(uint32_t aPluginEpoch,
tag.supportsAsyncRender(),
tag.lastModifiedTime(),
tag.isFromExtension(),
tag.sandboxLevel());
tag.sandboxLevel(),
tag.blocklistState());
AddPluginTag(pluginTag);
}
@@ -2611,6 +2613,11 @@ nsPluginHost::SendPluginsToContent()
/// to be more sane and avoid this dance
nsPluginTag *tag = static_cast<nsPluginTag *>(basetag.get());
uint32_t blocklistState;
if (NS_WARN_IF(NS_FAILED(tag->GetBlocklistState(&blocklistState)))) {
return NS_ERROR_FAILURE;
}
pluginTags.AppendElement(PluginTag(tag->mId,
tag->Name(),
tag->Description(),
@@ -2624,7 +2631,8 @@ nsPluginHost::SendPluginsToContent()
tag->Version(),
tag->mLastModifiedTime,
tag->IsFromExtension(),
tag->mSandboxLevel));
tag->mSandboxLevel,
blocklistState));
}
nsTArray<dom::ContentParent*> parents;
dom::ContentParent::GetAll(parents);
@@ -3489,6 +3497,13 @@ NS_IMETHODIMP nsPluginHost::Observe(nsISupports *aSubject,
plugin->InvalidateBlocklistState();
plugin = plugin->mNext;
}
// We update blocklists asynchronously by just sending a new plugin list to
// content.
if (XRE_IsParentProcess()) {
// We'll need to repack our tags and send them to content again.
IncrementChromeEpoch();
SendPluginsToContent();
}
}
#ifdef MOZ_WIDGET_ANDROID
if (!strcmp("application-background", aTopic)) {