зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1029926 - Add a field to install.rdf for add-ons that are compatible with electrolysis (r=irving)
This commit is contained in:
Родитель
926f8bfdd8
Коммит
9906629c7f
|
@ -851,9 +851,10 @@ function loadManifestFromRDF(aUri, aStream) {
|
|||
addon.strictCompatibility = !(addon.type in COMPATIBLE_BY_DEFAULT_TYPES) ||
|
||||
getRDFProperty(ds, root, "strictCompatibility") == "true";
|
||||
|
||||
// Only read the bootstrap property for extensions.
|
||||
// Only read these properties for extensions.
|
||||
if (addon.type == "extension") {
|
||||
addon.bootstrap = getRDFProperty(ds, root, "bootstrap") == "true";
|
||||
addon.multiprocessCompatible = getRDFProperty(ds, root, "multiprocessCompatible") == "true";
|
||||
if (addon.optionsType &&
|
||||
addon.optionsType != AddonManager.OPTIONS_TYPE_DIALOG &&
|
||||
addon.optionsType != AddonManager.OPTIONS_TYPE_INLINE &&
|
||||
|
@ -2941,7 +2942,8 @@ this.XPIProvider = {
|
|||
XPIProvider.bootstrappedAddons[aOldAddon.id] = {
|
||||
version: aOldAddon.version,
|
||||
type: aOldAddon.type,
|
||||
descriptor: aAddonState.descriptor
|
||||
descriptor: aAddonState.descriptor,
|
||||
multiprocessCompatible: aOldAddon.multiprocessCompatible
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4121,14 +4123,18 @@ this.XPIProvider = {
|
|||
* The add-on's version
|
||||
* @param aType
|
||||
* The type for the add-on
|
||||
* @param aMultiprocessCompatible
|
||||
* Boolean indicating whether the add-on is compatible with electrolysis.
|
||||
* @return a JavaScript scope
|
||||
*/
|
||||
loadBootstrapScope: function XPI_loadBootstrapScope(aId, aFile, aVersion, aType) {
|
||||
loadBootstrapScope: function XPI_loadBootstrapScope(aId, aFile, aVersion, aType,
|
||||
aMultiprocessCompatible) {
|
||||
// Mark the add-on as active for the crash reporter before loading
|
||||
this.bootstrappedAddons[aId] = {
|
||||
version: aVersion,
|
||||
type: aType,
|
||||
descriptor: aFile.persistentDescriptor
|
||||
descriptor: aFile.persistentDescriptor,
|
||||
multiprocessCompatible: aMultiprocessCompatible
|
||||
};
|
||||
this.persistBootstrappedAddons();
|
||||
this.addAddonsToCrashReporter();
|
||||
|
@ -4144,6 +4150,12 @@ this.XPIProvider = {
|
|||
let principal = Cc["@mozilla.org/systemprincipal;1"].
|
||||
createInstance(Ci.nsIPrincipal);
|
||||
|
||||
if (!aMultiprocessCompatible && Prefs.getBoolPref("browser.tabs.remote.autostart", false)) {
|
||||
let interposition = Cc["@mozilla.org/addons/multiprocess-shims;1"].
|
||||
getService(Ci.nsIAddonInterposition);
|
||||
Cu.setAddonInterposition(aId, interposition);
|
||||
}
|
||||
|
||||
if (!aFile.exists()) {
|
||||
this.bootstrapScopes[aId] =
|
||||
new Cu.Sandbox(principal, { sandboxName: aFile.path,
|
||||
|
@ -4210,6 +4222,10 @@ this.XPIProvider = {
|
|||
* The add-on's ID
|
||||
*/
|
||||
unloadBootstrapScope: function XPI_unloadBootstrapScope(aId) {
|
||||
// In case the add-on was not multiprocess-compatible, deregister
|
||||
// any interpositions for it.
|
||||
Cu.setAddonInterposition(aId, null);
|
||||
|
||||
delete this.bootstrapScopes[aId];
|
||||
delete this.bootstrappedAddons[aId];
|
||||
this.persistBootstrappedAddons();
|
||||
|
@ -4256,7 +4272,8 @@ this.XPIProvider = {
|
|||
try {
|
||||
// Load the scope if it hasn't already been loaded
|
||||
if (!(aAddon.id in this.bootstrapScopes))
|
||||
this.loadBootstrapScope(aAddon.id, aFile, aAddon.version, aAddon.type);
|
||||
this.loadBootstrapScope(aAddon.id, aFile, aAddon.version, aAddon.type,
|
||||
aAddon.multiprocessCompatible);
|
||||
|
||||
// Nothing to call for locales
|
||||
if (aAddon.type == "locale")
|
||||
|
|
|
@ -71,7 +71,7 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
|
|||
"skinnable", "size", "sourceURI", "releaseNotesURI",
|
||||
"softDisabled", "foreignInstall", "hasBinaryComponents",
|
||||
"strictCompatibility", "locales", "targetApplications",
|
||||
"targetPlatforms"];
|
||||
"targetPlatforms", "multiprocessCompatible"];
|
||||
|
||||
// Time to wait before async save of XPI JSON database, in milliseconds
|
||||
const ASYNC_SAVE_DELAY_MS = 20;
|
||||
|
@ -1468,6 +1468,15 @@ this.XPIDatabase = {
|
|||
fullCount += count;
|
||||
}
|
||||
|
||||
text += "\r\n[MultiprocessIncompatibleExtensions]\r\n";
|
||||
|
||||
count = 0;
|
||||
for (let row of activeAddons) {
|
||||
if (!row.multiprocessCompatible) {
|
||||
text += "Extension" + (count++) + "=" + row.id + "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (fullCount > 0) {
|
||||
logger.debug("Writing add-ons list");
|
||||
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
#include "nsXREDirProvider.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "xpcpublic.h"
|
||||
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIAddonInterposition.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIDirectoryEnumerator.h"
|
||||
#include "nsIFile.h"
|
||||
|
@ -538,6 +540,32 @@ nsXREDirProvider::GetFiles(const char* aProperty, nsISimpleEnumerator** aResult)
|
|||
return NS_SUCCESS_AGGREGATE_RESULT;
|
||||
}
|
||||
|
||||
static void
|
||||
RegisterExtensionInterpositions(nsINIParser &parser)
|
||||
{
|
||||
if (!mozilla::Preferences::GetBool("browser.tabs.remote.autostart", false))
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAddonInterposition> interposition =
|
||||
do_GetService("@mozilla.org/addons/multiprocess-shims;1");
|
||||
|
||||
nsresult rv;
|
||||
int32_t i = 0;
|
||||
do {
|
||||
nsAutoCString buf("Extension");
|
||||
buf.AppendInt(i++);
|
||||
|
||||
nsAutoCString addonId;
|
||||
rv = parser.GetString("MultiprocessIncompatibleExtensions", buf.get(), addonId);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
if (!xpc::SetAddonInterposition(addonId, interposition))
|
||||
continue;
|
||||
}
|
||||
while (true);
|
||||
}
|
||||
|
||||
static void
|
||||
LoadExtensionDirectories(nsINIParser &parser,
|
||||
const char *aSection,
|
||||
|
@ -600,6 +628,7 @@ nsXREDirProvider::LoadExtensionBundleDirectories()
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
RegisterExtensionInterpositions(parser);
|
||||
LoadExtensionDirectories(parser, "ExtensionDirs", mExtensionDirectories,
|
||||
NS_COMPONENT_LOCATION);
|
||||
LoadExtensionDirectories(parser, "ThemeDirs", mThemeDirectories,
|
||||
|
|
Загрузка…
Ссылка в новой задаче