Bug 1245256 - GMP Plugins now installed in flat manner to accomodate widevine. r=spohl
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 06 Apr 2016 18:08:17 -0700
changeset 330626 61731903f2bf3da555b7575d8a74d5b07c2bb525
parent 330625 775cb61df22f176cd47baf4dc0389a3a06050ef6
child 330627 85a28619dd12113740470b2a3b6178ddc5c1c1bd
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1245256
milestone48.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 1245256 - GMP Plugins now installed in flat manner to accomodate widevine. r=spohl MozReview-Commit-ID: 6aSKMD6oox7
toolkit/modules/GMPInstallManager.jsm
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -399,31 +399,39 @@ GMPExtractor.prototype = {
 
       // Initialize a zipReader and obtain the entries
       var zipReader = Cc["@mozilla.org/libjar/zip-reader;1"].
                       createInstance(Ci.nsIZipReader);
       zipReader.open(zipFile)
       let entries = this._getZipEntries(zipReader);
       let extractedPaths = [];
 
+      let destDir = Cc["@mozilla.org/file/local;1"].
+                    createInstance(Ci.nsILocalFile);
+      destDir.initWithPath(this.installToDirPath);
+      // Make sure the destination exists
+      if(!destDir.exists()) {
+        destDir.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8));
+      }
+
       // Extract each of the entries
       entries.forEach(entry => {
         // We don't need these types of files
-        if (entry.includes("__MACOSX")) {
+        if (entry.includes("__MACOSX") ||
+            entry == "_metadata/verified_contents.json" ||
+            entry == "imgs/icon-128x128.png") {
           return;
         }
-        let outFile = Cc["@mozilla.org/file/local;1"].
-                      createInstance(Ci.nsILocalFile);
-        outFile.initWithPath(this.installToDirPath);
-        outFile.appendRelativePath(entry);
+        let outFile = destDir.clone();
+        // Do not extract into directories. Extract all files to the same
+        // directory. DO NOT use |OS.Path.basename()| here, as in Windows it
+        // does not work properly with forward slashes (which we must use here).
+        let outBaseName = entry.slice(entry.lastIndexOf("/") + 1);
+        outFile.appendRelativePath(outBaseName);
 
-        // Make sure the directory hierarchy exists
-        if(!outFile.parent.exists()) {
-          outFile.parent.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0755", 8));
-        }
         zipReader.extract(entry, outFile);
         extractedPaths.push(outFile.path);
         // Ensure files are writable and executable. Otherwise we may be unable to
         // execute or uninstall them.
         outFile.permissions |= parseInt("0700", 8);
         log.info(entry + " was successfully extracted to: " +
             outFile.path);
       });