Bug 1502977 - Reinstate the code blocking the "Facebook Photo Uploader" plugin on Mac and update the associated annotation r=jmathies
authorGabriele Svelto <gsvelto@mozilla.com>
Wed, 28 Nov 2018 18:52:41 +0000
changeset 507782 646caf2d457718a4931d31f637be2e2757c72127
parent 507781 48f92342f2638cca29f13430046b1294fcb18c17
child 507783 3b3c190f79e5bcba826f3446ca09fd7ee556c426
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmathies
bugs1502977
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1502977 - Reinstate the code blocking the "Facebook Photo Uploader" plugin on Mac and update the associated annotation r=jmathies Differential Revision: https://phabricator.services.mozilla.com/D12354
dom/plugins/base/nsPluginsDirDarwin.cpp
toolkit/crashreporter/CrashAnnotations.yaml
--- a/dom/plugins/base/nsPluginsDirDarwin.cpp
+++ b/dom/plugins/base/nsPluginsDirDarwin.cpp
@@ -393,24 +393,53 @@ nsresult nsPluginFile::GetPluginInfo(nsP
   // First look for data in a bundle plist
   if (bundle) {
     ParsePlistPluginInfo(info, bundle);
     ::CFRelease(bundle);
     if (info.fVariantCount > 0)
       return NS_OK;
   }
 
+  // Don't load "fbplugin" or any plugins whose name starts with "fbplugin_"
+  // (Facebook plugins) if we're running on OS X 10.10 (Yosemite) or later.
+  // A "fbplugin" file crashes on load, in the call to LoadPlugin() below.
+  // See bug 1086977.
+  if (nsCocoaFeatures::OnYosemiteOrLater()) {
+    if (fileName.EqualsLiteral("fbplugin") ||
+        StringBeginsWith(fileName, NS_LITERAL_CSTRING("fbplugin_"))) {
+      nsAutoCString msg;
+      msg.AppendPrintf("Preventing load of %s (see bug 1086977)",
+                       fileName.get());
+      NS_WARNING(msg.get());
+      return NS_ERROR_FAILURE;
+    }
+
+    // The block above assumes that "fbplugin" is the filename of the plugin
+    // to be blocked, or that the filename starts with "fbplugin_".  But we
+    // don't yet know for sure if this is always true.  So for the time being
+    // record extra information in our crash logs.
+    CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::Bug_1086977,
+                                       fileName);
+  }
+
   // It's possible that our plugin has 2 entry points that'll give us mime type
   // info. Quicktime does this to get around the need of having admin rights to
   // change mime info in the resource fork. We need to use this info instead of
   // the resource. See bug 113464.
 
   // Sadly we have to load the library for this to work.
   rv = LoadPlugin(outLibrary);
 
+  if (nsCocoaFeatures::OnYosemiteOrLater()) {
+    // If we didn't crash in LoadPlugin(), remove the annotation so we don't
+    // sow confusion.
+    CrashReporter::RemoveCrashReportAnnotation(
+      CrashReporter::Annotation::Bug_1086977);
+  }
+
   if (NS_FAILED(rv))
     return rv;
 
   // Try to get data from NP_GetMIMEDescription
   if (pLibrary) {
     NP_GETMIMEDESCRIPTION pfnGetMimeDesc = (NP_GETMIMEDESCRIPTION)PR_FindFunctionSymbol(pLibrary, NP_GETMIMEDESCRIPTION_NAME);
     if (pfnGetMimeDesc)
       ParsePluginMimeDescription(pfnGetMimeDesc(), info);
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -143,16 +143,22 @@ BreakpadReserveAddress:
     Address of the buffer reserved by Breakpad.
   type: string
 
 BreakpadReserveSize:
   description: >
     Size of the buffer reserved by Breakpad.
   type: string
 
+Bug_1086977:
+  description: >
+    Mac-only annotation which should be present only if Firefox crashed when
+    loading a facebook plugin.
+  type: string
+
 BuildID:
   description: >
     Application build ID, the format is YYYYMMDDHHMMSS.
   type: string
   ping: true
 
 ClassRegistrationInfoChild:
   description: >