Bug 703069 - Do a better job of guessing plugin package name r=blassey

This commit is contained in:
James Willcox 2011-11-17 13:26:08 -05:00
parent 4866903b3c
commit 1c68992047
2 changed files with 18 additions and 2 deletions

View File

@ -326,6 +326,23 @@ abstract public class GeckoApp
return result;
}
String getPluginPackage(String pluginLib) {
if (pluginLib == null || pluginLib.length() == 0) {
return null;
}
synchronized(mPackageInfoCache) {
for (PackageInfo pkgInfo : mPackageInfoCache) {
if (pluginLib.contains(pkgInfo.packageName)) {
return pkgInfo.packageName;
}
}
}
return null;
}
Class<?> getPluginClass(String packageName, String className)
throws NameNotFoundException, ClassNotFoundException {
Context pluginContext = this.mAppContext.createPackageContext(packageName,

View File

@ -1274,8 +1274,7 @@ public class GeckoAppShell
Log.i(LOGTAG, "libName: " + libName);
try {
String[] split = libName.split("/");
String packageName = split[split.length - 3];
String packageName = GeckoApp.mAppContext.getPluginPackage(libName);
Log.i(LOGTAG, "load \"" + className + "\" from \"" + packageName +
"\" for \"" + libName + "\"");
Context pluginContext =