Bug 1167197 - Fix GMPProvider on Android r=cpearce

This commit is contained in:
James Willcox 2015-05-21 11:42:07 -05:00
parent 982518a10b
commit a1024c6502
4 changed files with 14 additions and 37 deletions

View File

@ -158,6 +158,9 @@ this.AppConstants = Object.freeze({
false,
#endif
DLL_PREFIX: "@DLL_PREFIX@",
DLL_SUFFIX: "@DLL_SUFFIX@",
MOZ_APP_NAME: "@MOZ_APP_NAME@",
MOZ_APP_VERSION: "@MOZ_APP_VERSION@",
MOZ_BUILD_APP: "@MOZ_BUILD_APP@",

View File

@ -97,7 +97,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
for var in ('ANDROID_PACKAGE_NAME',
'MOZ_APP_NAME',
'MOZ_APP_VERSION',
'MOZ_WIDGET_TOOLKIT'):
'MOZ_WIDGET_TOOLKIT',
'DLL_PREFIX',
'DLL_SUFFIX'):
DEFINES[var] = CONFIG[var]
for var in ('MOZILLA_OFFICIAL',

View File

@ -18,6 +18,7 @@ Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/GMPUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(
this, "GMPInstallManager", "resource://gre/modules/GMPInstallManager.jsm");
@ -464,28 +465,11 @@ GMPWrapper.prototype = {
return f.exists();
};
// Determine the name of the GMP dynamic library; it differs on every
// platform. Note: we can't use Services.appInfo.OS here, as that's
// "XPCShell" in our tests.
let isWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
let isOSX = ("nsILocalFileMac" in Ci);
let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
let libName = "";
let id = this._plugin.id;
if (isWindows) {
libName = id.substring(4) + ".dll";
} else if (isOSX) {
libName = "lib" + id.substring(4) + ".dylib";
} else if (isLinux) {
libName = id.substring(4) + ".so";
} else {
this._info.error("_arePluginFilesOnDisk - unsupported platform.");
return false;
}
let id = this._plugin.id.substring(4);
let libName = AppConstants.DLL_PREFIX + id + AppConstants.DLL_SUFFIX;
return fileExists(this.gmpPath, libName) &&
fileExists(this.gmpPath, id.substring(4) + ".info");
fileExists(this.gmpPath, id + ".info");
},
validate: function() {

View File

@ -5,6 +5,7 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
let GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
() => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
@ -229,24 +230,11 @@ function createMockPluginFilesIfNeeded(aFile, aPluginId) {
}
};
// Note: we can't use Services.appInfo.OS, as that's "XPCShell" in our tests.
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
let isOSX = ("nsILocalFileMac" in Components.interfaces);
let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Components.classes);
let id = aPluginId.substring(4);
let libName = AppConstants.DLL_PREFIX + id + AppConstants.DLL_SUFFIX;
let libName = "";
if (isWindows) {
libName = aPluginId.substring(4) + ".dll";
} else if (isOSX) {
libName = "lib" + aPluginId.substring(4) + ".dylib";
} else if (isLinux) {
libName = aPluginId.substring(4) + ".so";
} else {
// FAIL!
return;
}
createFile(libName);
createFile(aPluginId.substring(4) + ".info");
createFile(id + ".info");
}
// Array.includes() is only in Nightly channel, so polyfill so we don't fail