Backed out changeset b6ac1853674e (bug 1528661) for build bustages on GMPChild.cpp . CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Fri, 01 Mar 2019 04:43:56 +0200
changeset 461847 9d39099e5fc5768e979dda950af84df76ba4734d
parent 461846 86bf081288cd630adca5b0669d3cd35efe9cd7f7
child 461848 78b1e168cb736aa2b43f22f1687102343736c9b3
child 461957 53c9ecc53bbfb67ba5d90271398bf54cb80a5f25
push id79326
push usernbeleuzu@mozilla.com
push dateFri, 01 Mar 2019 02:45:06 +0000
treeherderautoland@9d39099e5fc5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1528661
milestone67.0a1
backs outb6ac1853674e3aeddeddc4ffafbd1521d0d6faa1
first release with
nightly linux32
9d39099e5fc5 / 67.0a1 / 20190301052057 / files
nightly linux64
9d39099e5fc5 / 67.0a1 / 20190301052057 / files
nightly mac
9d39099e5fc5 / 67.0a1 / 20190301052057 / files
nightly win32
9d39099e5fc5 / 67.0a1 / 20190301052057 / files
nightly win64
9d39099e5fc5 / 67.0a1 / 20190301052057 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset b6ac1853674e (bug 1528661) for build bustages on GMPChild.cpp . CLOSED TREE
dom/media/gmp/GMPChild.cpp
media/gmp-clearkey/0.1/gmp-clearkey.cpp
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -326,86 +326,46 @@ bool GMPChild::GetUTF8LibPath(nsACString
   nsAutoString path;
   libFile->GetPath(path);
   aOutLibPath = NS_ConvertUTF16toUTF8(path);
 
   return true;
 #endif
 }
 
-static nsCOMPtr<nsIFile> AppendFile(nsCOMPtr<nsIFile>&& aFile,
-                                    const nsString& aStr) {
-  return (aFile && NS_SUCCEEDED(aFile->Append(aStr))) ? aFile : nullptr;
-}
-
-static nsCOMPtr<nsIFile> CloneFile(const nsCOMPtr<nsIFile>& aFile) {
-  nsCOMPtr<nsIFile> clone;
-  return (aFile && NS_SUCCEEDED(aFile->Clone(getter_AddRefs(clone)))) ? clone
-                                                                      : nullptr;
-}
-
-static nsCOMPtr<nsIFile> GetParentFile(const nsCOMPtr<nsIFile>& aFile) {
-  nsCOMPtr<nsIFile> parent;
-  return (aFile && NS_SUCCEEDED(aFile->GetParent(getter_AddRefs(parent))))
-             ? parent
-             : nullptr;
-}
-
-#if defined(XP_WIN)
-static bool IsFileLeafEqualToASCII(const nsCOMPtr<nsIFile>& aFile,
-                                   const char* aStr) {
-  nsAutoString leafName;
-  return aFile && NS_SUCCEEDED(aFile->GetLeafName(leafName)) &&
-         leafName.EqualsASCII(aStr);
-}
-#endif
-
 #if defined(XP_WIN)
 #  define FIREFOX_FILE NS_LITERAL_STRING("firefox.exe")
 #  define XUL_LIB_FILE NS_LITERAL_STRING("xul.dll")
 #elif defined(XP_MACOSX)
 #  define FIREFOX_FILE NS_LITERAL_STRING("firefox")
 #  define XUL_LIB_FILE NS_LITERAL_STRING("XUL")
 #else
 #  define FIREFOX_FILE NS_LITERAL_STRING("firefox")
 #  define XUL_LIB_FILE NS_LITERAL_STRING("libxul.so")
 #endif
 
-static nsCOMPtr<nsIFile> GetFirefoxAppPath(
-    nsCOMPtr<nsIFile> aPluginContainerPath) {
-  MOZ_ASSERT(aPluginContainerPath);
 #if defined(XP_MACOSX)
-  // On MacOS the firefox binary is a few parent directories up from
-  // plugin-container.
+static bool GetFirefoxAppPath(nsCOMPtr<nsIFile> aPluginContainerPath,
+                              nsCOMPtr<nsIFile>& aOutFirefoxAppPath) {
   // aPluginContainerPath will end with something like:
   // xxxx/NightlyDebug.app/Contents/MacOS/plugin-container.app/Contents/MacOS/plugin-container
+  MOZ_ASSERT(aPluginContainerPath);
   nsCOMPtr<nsIFile> path = aPluginContainerPath;
   for (int i = 0; i < 4; i++) {
     nsCOMPtr<nsIFile> parent;
     if (NS_WARN_IF(NS_FAILED(path->GetParent(getter_AddRefs(parent))))) {
-      return nullptr;
+      return false;
     }
     path = parent;
   }
   MOZ_ASSERT(path);
-  return aOutFirefoxAppPath
-#else
-  nsCOMPtr<nsIFile> parent = GetParentFile(aPluginContainerPath);
-#  if XP_WIN
-  if (IsFileLeafEqualToASCII(parent, "i686")) {
-    // We must be on Windows on ARM64, where the plugin-container path will
-    // be in the 'i686' subdir. The firefox.exe is in the parent directory.
-    parent = GetParentFile(parent);
-  }
-#  endif
-  return parent;
-#endif
+  aOutFirefoxAppPath = path;
+  return true;
 }
 
-#if defined(XP_MACOSX)
 static bool GetSigPath(const int aRelativeLayers,
                        const nsString& aTargetSigFileName,
                        nsCOMPtr<nsIFile> aExecutablePath,
                        nsCOMPtr<nsIFile>& aOutSigPath) {
   // The sig file will be located in
   // xxxx/NightlyDebug.app/Contents/Resources/XUL.sig
   // xxxx/NightlyDebug.app/Contents/Resources/firefox.sig
   // xxxx/NightlyDebug.app/Contents/MacOS/plugin-container.app/Contents/Resources/plugin-container.sig
@@ -473,66 +433,57 @@ nsTArray<Pair<nsCString, nsCString>> GMP
 #endif
     paths.AppendElement(MakePair(std::move(filePath), std::move(sigFilePath)));
   } else {
     // Without successfully determining plugin-container's path, we can't
     // determine libxul's or Firefox's. So give up.
     return paths;
   }
 
-#if defined(XP_WIN)
-  // On Windows on ARM64, we should also append the x86 plugin-container's
-  // xul.dll.
-  const bool isWindowsOnARM64 =
-      IsFileLeafEqualToASCII(GetParentFile(path), "i686");
-  if (isWindowsOnARM64) {
-    nsCOMPtr<nsIFile> x86XulPath =
-        AppendFile(GetParentFile(path), XUL_LIB_FILE);
-    if (FileExists(x86XulPath) && ResolveLinks(x86XulPath) &&
-        NS_SUCCEEDED(x86XulPath->GetPath(str))) {
-      nsCString filePath = NS_ConvertUTF16toUTF8(str);
-      nsCString sigFilePath = filePath + NS_LITERAL_CSTRING(".sig");
-      paths.AppendElement(
-          MakePair(std::move(filePath), std::move(sigFilePath)));
-    }
-  }
-#endif
-
   // Firefox application binary path.
-  nsCOMPtr<nsIFile> appDir = GetFirefoxAppPath(path);
-  path = AppendFile(CloneFile(appDir), FIREFOX_FILE);
-  if (FileExists(path) && ResolveLinks(path) &&
-      NS_SUCCEEDED(path->GetPath(str))) {
+  nsCOMPtr<nsIFile> appDir;
 #if defined(XP_MACOSX)
+  // On MacOS the firefox binary is a few parent directories up from
+  // plugin-container.
+  if (GetFirefoxAppPath(path, appDir) &&
+      NS_SUCCEEDED(appDir->Clone(getter_AddRefs(path))) &&
+      NS_SUCCEEDED(path->Append(FIREFOX_FILE)) && FileExists(path) &&
+      ResolveLinks(path) && NS_SUCCEEDED(path->GetPath(str))) {
     nsCString filePath = NS_ConvertUTF16toUTF8(str);
     nsCString sigFilePath;
     nsCOMPtr<nsIFile> sigFile;
     if (GetSigPath(2, NS_LITERAL_STRING("firefox.sig"), path, sigFile) &&
         NS_SUCCEEDED(sigFile->GetPath(str))) {
       sigFilePath = NS_ConvertUTF16toUTF8(str);
     } else {
       // Cannot successfully get the sig file path.
       // Assume it is located at the same place as firefox alternatively.
       sigFilePath =
           nsCString(NS_ConvertUTF16toUTF8(str) + NS_LITERAL_CSTRING(".sig"));
     }
     paths.AppendElement(MakePair(std::move(filePath), std::move(sigFilePath)));
+  }
 #else
+  // Note: re-using 'path' var here, as on Windows/Linux we assume Firefox
+  // executable is in the same directory as plugin-container.
+  if (NS_SUCCEEDED(path->GetParent(getter_AddRefs(appDir))) &&
+      NS_SUCCEEDED(appDir->Clone(getter_AddRefs(path))) &&
+      NS_SUCCEEDED(path->Append(FIREFOX_FILE)) && FileExists(path) &&
+      ResolveLinks(path) && NS_SUCCEEDED(path->GetPath(str))) {
     paths.AppendElement(MakePair(
         nsCString(NS_ConvertUTF16toUTF8(str)),
         nsCString(NS_ConvertUTF16toUTF8(str) + NS_LITERAL_CSTRING(".sig"))));
+  }
 #endif
-  }
-
   // Libxul path. Note: re-using 'path' var here, as we assume libxul is in
   // the same directory as Firefox executable.
   appDir->GetPath(str);
-  path = AppendFile(CloneFile(appDir), XUL_LIB_FILE);
-  if (FileExists(path) && ResolveLinks(path) &&
-      NS_SUCCEEDED(path->GetPath(str))) {
+  if (NS_SUCCEEDED(appDir->Clone(getter_AddRefs(path))) &&
+      NS_SUCCEEDED(path->Append(XUL_LIB_FILE)) && FileExists(path) &&
+      ResolveLinks(path) && NS_SUCCEEDED(path->GetPath(str))) {
     nsCString filePath = NS_ConvertUTF16toUTF8(str);
     nsCString sigFilePath;
 #if defined(XP_MACOSX)
     nsCOMPtr<nsIFile> sigFile;
     if (GetSigPath(2, NS_LITERAL_STRING("XUL.sig"), path, sigFile) &&
         NS_SUCCEEDED(sigFile->GetPath(str))) {
       sigFilePath = NS_ConvertUTF16toUTF8(str);
     } else {
--- a/media/gmp-clearkey/0.1/gmp-clearkey.cpp
+++ b/media/gmp-clearkey/0.1/gmp-clearkey.cpp
@@ -13,17 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
 #include <vector>
-#include <string>
 
 #include "ClearKeyCDM.h"
 #include "ClearKeySessionManager.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
 #include "content_decryption_module.h"
 #include "content_decryption_module_ext.h"
@@ -98,50 +97,20 @@ bool CanReadSome(cdm::PlatformFile aFile
 void ClosePlatformFile(cdm::PlatformFile aFile) {
 #ifdef XP_WIN
   CloseHandle(aFile);
 #else
   close(aFile);
 #endif
 }
 
-static uint32_t NumExpectedHostFiles(const cdm::HostFile* aHostFiles,
-                                     uint32_t aNumFiles) {
-#if !defined(XP_WIN)
-  // We expect 4 binaries: clearkey, libxul, plugin-container, and Firefox.
-  return 4;
-#else
-  // Windows running x64 or x86 natively should also have 4 as above.
-  // For Windows on ARM64, we run an x86 plugin-contianer process under
-  // emulation, and so we expect one additional binary; the x86
-  // xul.dll used by plugin-container.exe.
-  bool i686underAArch64 = false;
-  // Assume that we're running under x86 emulation on an aarch64 host if
-  // one of the paths ends with the x86 plugin-container path we'd expect.
-  const std::wstring plugincontainer = L"i686\\plugin-container.exe";
-  for (uint32_t i = 0; i < aNumFiles; i++) {
-    const cdm::HostFile& hostFile = aHostFiles[i];
-    if (hostFile.file != cdm::kInvalidPlatformFile) {
-      std::wstring path = hostFile.file_path;
-      auto offset = path.find(plugincontainer);
-      if (offset != std::string::npos &&
-          offset == path.size() - plugincontainer.size()) {
-        i686underAArch64 = true;
-        break;
-      }
-    }
-  }
-  return i686underAArch64 ? 5 : 4;
-#endif
-}
-
 CDM_API
 bool VerifyCdmHost_0(const cdm::HostFile* aHostFiles, uint32_t aNumFiles) {
-  // Check that we've received the expected number of host files.
-  bool rv = (aNumFiles == NumExpectedHostFiles(aHostFiles, aNumFiles));
+  // We expect 4 binaries: clearkey, libxul, plugin-container, and Firefox.
+  bool rv = (aNumFiles == 4);
   // Verify that each binary is readable inside the sandbox,
   // and close the handle.
   for (uint32_t i = 0; i < aNumFiles; i++) {
     const cdm::HostFile& hostFile = aHostFiles[i];
     if (hostFile.file != cdm::kInvalidPlatformFile) {
       if (!CanReadSome(hostFile.file)) {
         rv = false;
       }