/* 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/. */
// Map of existing Commands objects, keyed by XULTab. const commandsMap = new WeakMap();
/** *FunctionsforcreatinguniqueCommandsforLocalTabs.
*/
exports.LocalTabCommandsFactory = { /** *Createauniquecommandsobjectforthegiventab. * *Ifacommandswasalreadycreatedbythisfactoryfortheprovidedtab, *itwillbereturnedandnonewcommandscreated. * *Otherwise,thiswillautomatically: *-spawnaDevToolsServerintheparentprocess, *-createaDevToolsClient *-connecttheDevToolsClienttotheDevToolsServer *-callRootActor's`getTab`requesttoretrievetheWindowGlobalTargetActor'sform * *@param{XULTab}tab *Thetabtouseincreatinganewcommands. * *@return{Commandsobject}Thecommandsobjectfortheprovidedtab.
*/
async createCommandsForTab(tab) {
let commands = commandsMap.get(tab); if (commands) { // Keep in mind that commands can be either a promise // or a commands object. return commands;
}
const promise = CommandsFactory.forTab(tab); // Immediately set the commands's promise in cache to prevent race
commandsMap.set(tab, promise);
commands = await promise; // Then replace the promise with the commands object
commandsMap.set(tab, commands);
/** *Retrieveanexistingcommandscreatedbythisfactoryfortheprovided *tab.Returnsnullifnocommandswascreatedyet. * *@param{XULTab}tab *Thetabforwhichthecommandsshouldberetrieved
*/
async getCommandsForTab(tab) { // commandsMap.get(tab) can either return an initialized commands, a promise // which will resolve a commands, or null if no commands was ever created // for this tab. return commandsMap.get(tab);
},
};
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet am 2026-08-25)
¤
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.