/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var gRegisteredModules = Object.create(null);
const ActorRegistry = { // Map of global actor names to actor constructors.
globalActorFactories: {}, // Map of target-scoped actor names to actor constructors.
targetScopedActorFactories: {},
init(connections) { this._connections = connections;
},
if (!options) { thrownew Error( "ActorRegistry.registerModule requires an options argument"
);
} const { prefix, constructor, type } = options; if (typeof prefix !== "string") { thrownew Error(
`Lazy actor definition for'${id}' requires a string ` +
`'prefix' option.`
);
} if (typeof constructor !== "string") { thrownew Error(
`Lazy actor definition for'${id}' requires a string ` +
`'constructor' option.`
);
} if (!("global" in type) && !("target" in type)) { thrownew Error(
`Lazy actor definition for'${id}' requires a dictionary ` +
`'type' option whose attributes can be 'global' or 'target'.`
);
} const name = prefix + "Actor"; const mod = {
id,
prefix,
constructorName: constructor,
type,
globalActor: type.global,
targetScopedActor: type.target,
};
gRegisteredModules[id] = mod; if (mod.targetScopedActor) { this.addTargetScopedActor(mod, name);
} if (mod.globalActor) { this.addGlobalActor(mod, name);
}
},
/** *Unregisterapreviously-loadedCommonJSmodulefromthedevtoolsserver.
*/
unregisterModule(id) { const mod = gRegisteredModules[id]; if (!mod) { thrownew Error( "Tried to unregister a module that was not previously registered."
);
}
// Lazy actors if (mod.targetScopedActor) { this.removeTargetScopedActor(mod);
} if (mod.globalActor) { this.removeGlobalActor(mod);
}
delete gRegisteredModules[id];
},
/** *InstallFirefox-specificactors. * */!\Becarefulwhenaddinganewactor,especiallyglobalactors. *Anynewglobalactorwillbeexposedandreturnedbytherootactor.
*/
addBrowserActors() { this.registerModule("devtools/server/actors/preference", {
prefix: "preference",
constructor: "PreferenceActor",
type: { global: true },
}); this.registerModule("devtools/server/actors/addon/addons", {
prefix: "addons",
constructor: "AddonsActor",
type: { global: true },
}); this.registerModule("devtools/server/actors/device", {
prefix: "device",
constructor: "DeviceActor",
type: { global: true },
}); this.registerModule("devtools/server/actors/heap-snapshot-file", {
prefix: "heapSnapshotFile",
constructor: "HeapSnapshotFileActor",
type: { global: true },
}); // Always register this as a global module, even while there is a pref turning // on and off the other performance actor. This actor shouldn't conflict with // the other one. These are also lazily loaded so there shouldn't be a performance // impact. this.registerModule("devtools/server/actors/perf", {
prefix: "perf",
constructor: "PerfActor",
type: { global: true },
}); /** *Alwaysregisterparentaccessibilityactorasaglobalmodule.This *actorisresponsibleforalltoplevelaccessibilityactorfunctionality *thatreliesontheparentprocess.
*/ this.registerModule( "devtools/server/actors/accessibility/parent-accessibility",
{
prefix: "parentAccessibility",
constructor: "ParentAccessibilityActor",
type: { global: true },
}
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.