Bug 1330998 - Invalidate pluginreg.dat based on whether the flash-only pref is flipped, so that if users switch between 52 and 52ESR it gets updated correctly. r?qdot draft
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 17 Jan 2017 13:44:13 -0500
changeset 462552 a67ee927457f16d9ed19567219e0ffc0ea9cc9c7
parent 462402 3e275d37a06236981bff399b7d7aa0646be3fee7
child 542443 374b2c440a221859cafd932d699e4415ff8df540
push id41803
push userbsmedberg@mozilla.com
push dateTue, 17 Jan 2017 18:46:02 +0000
reviewersqdot
bugs1330998
milestone53.0a1
Bug 1330998 - Invalidate pluginreg.dat based on whether the flash-only pref is flipped, so that if users switch between 52 and 52ESR it gets updated correctly. r?qdot MozReview-Commit-ID: 64yamsyIudD
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2803,21 +2803,24 @@ nsPluginHost::WritePluginInfo()
   }
 
   nsAutoCString arch;
   rv = runtime->GetXPCOMABI(arch);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
+  bool flashOnly = Preferences::GetBool("plugin.load_flash_only", true);
+
   PR_fprintf(fd, "Generated File. Do not edit.\n");
 
-  PR_fprintf(fd, "\n[HEADER]\nVersion%c%s%c%c\nArch%c%s%c%c\n",
+  PR_fprintf(fd, "\n[HEADER]\nVersion%c%s%c%c%c\nArch%c%s%c%c\n",
              PLUGIN_REGISTRY_FIELD_DELIMITER,
              kPluginRegistryVersion,
+             flashOnly ? 't' : 'f',
              PLUGIN_REGISTRY_FIELD_DELIMITER,
              PLUGIN_REGISTRY_END_OF_LINE_MARKER,
              PLUGIN_REGISTRY_FIELD_DELIMITER,
              arch.get(),
              PLUGIN_REGISTRY_FIELD_DELIMITER,
              PLUGIN_REGISTRY_END_OF_LINE_MARKER);
 
   // Store all plugins in the mPlugins list - all plugins currently in use.
@@ -3003,17 +3006,22 @@ nsPluginHost::ReadPluginInfo()
   if (2 != reader.ParseLine(values, 2))
     return rv;
 
   // VersionLiteral
   if (PL_strcmp(values[0], "Version"))
     return rv;
 
   // If we're reading an old registry, ignore it
-  if (strcmp(values[1], kPluginRegistryVersion) != 0) {
+  // If we flipped the flash-only pref, ignore it
+  bool flashOnly = Preferences::GetBool("plugin.load_flash_only", true);
+  nsAutoCString expectedVersion(kPluginRegistryVersion);
+  expectedVersion.Append(flashOnly ? 't' : 'f');
+
+  if (!expectedVersion.Equals(values[1])) {
     return rv;
   }
 
   char* archValues[6];
   if (!reader.NextLine()) {
     return rv;
   }