Bug 1456677: Make the blocklist service a JSM, with an XPCOM service stub. r=Gijs

Aside from making things easier for JS callers, this also makes it harder to
accidentally trigger an early load of the service, which can be expensive
during startup.

This also makes a slight change to nsPluginHost to initially preserve the
previous blocklist state when a plugin is updated, to avoid the risk of the
possible additioanl asynchrony unblocking a plugin that should stay blocked.

MozReview-Commit-ID: 4EvIGJ1Ke0Z
This commit is contained in:
Kris Maglione
2018-04-24 17:46:44 -07:00
parent 33f37ef1d9
commit fab8e5086a
29 changed files with 168 additions and 86 deletions

View File

@@ -2142,9 +2142,11 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
RemoveCachedPluginsInfo(filePath.get(), getter_AddRefs(pluginTag));
bool seenBefore = false;
uint32_t blocklistState = nsIBlocklistService::STATE_NOT_BLOCKED;
if (pluginTag) {
seenBefore = true;
blocklistState = pluginTag->GetBlocklistState();
// If plugin changed, delete cachedPluginTag and don't use cache
if (fileModTime != pluginTag->mLastModifiedTime) {
// Plugins has changed. Don't use cached plugin info.
@@ -2216,8 +2218,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
continue;
}
uint32_t state = nsIBlocklistService::STATE_NOT_BLOCKED;
pluginTag = new nsPluginTag(&info, fileModTime, fromExtension, state);
pluginTag = new nsPluginTag(&info, fileModTime, fromExtension, blocklistState);
pluginTag->mLibrary = library;
pluginFile.FreePluginInfo(info);
// Pass whether we've seen this plugin before. If the plugin is