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, a=jcristau
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 17 Jan 2017 13:44:13 -0500
changeset 350331 9bb207f947d83100c0f5bcd2b6baecc6ec24d431
parent 350330 38d2a128e0a96f24a7c02a636318f2c7387de960
child 350332 313fd5d293cdf66a4dfd6a76a2ac7e77506d8e2a
push id10604
push userryanvm@gmail.com
push dateThu, 19 Jan 2017 17:28:07 +0000
treeherdermozilla-aurora@338a1630d1db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot, jcristau
bugs1330998
milestone52.0a2
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, a=jcristau MozReview-Commit-ID: 64yamsyIudD
dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2862,21 +2862,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.
@@ -3062,17 +3065,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;
   }