Quelle devtools-experimental-prefs.js
Sprache: JAVA
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const PREFERENCES = [
[ "fission.autostart", "Enable fission in Firefox. When navigating between two domains, you " + "will switch between two distinct processes. And if an iframe is " + "hosted from another domain, it will run in another process",
],
[ "devtools.every-frame-target.enabled", "When enabled, targets will be created for all iframes, no matter if " + "they are remote or not, independently of Fission being enabled or not",
],
[ "fission.bfcacheInParent", "Enable bfcache navigation in parent process (requires Fission and involve " + "more top level target switching",
],
[ "devtools.debugger.features.javascript-tracing", "Enable the JavaScript tracer. (You need to restart Firefox / the Browser Toolbox to apply this setting)",
],
];
/** * Temporary module to show a Tooltip with the currently enabled preferences * relevant for DevTools ongoing architectural work (e.g. Fission, EFT, …). * * This module should be deleted once all experimental prefs are preffed on in Nightly.
*/ function showTooltip(toolbox) { if (!toolbox._experimentalPrefsTooltip) {
toolbox._experimentalPrefsTooltip = new HTMLTooltip(toolbox.doc, {
type: "doorhanger",
useXulWrapper: true,
});
toolbox.once("destroy", () => toolbox._experimentalPrefsTooltip.destroy());
}
// Terrible hack to allow to toggle using the command button. if (toolbox._experimentalPrefsTooltip.preventShow) { return;
}
// Follows a hack to be able to close the tooltip when clicking on the // command button. Otherwise it will flicker and reopen.
toolbox._experimentalPrefsTooltip.preventShow = true;
toolbox._experimentalPrefsTooltip.once("hidden", () => {
toolbox.win.setTimeout(
() => (toolbox._experimentalPrefsTooltip.preventShow = false),
250
);
});
}
exports.showTooltip = showTooltip; function updateTooltipContent(toolbox) { const container = toolbox.doc.createElement("div");
/* * This is the grid we want to have: * +--------------------------------------------+---------------+ * | Header text | Reset button | * +------+-----------------------------+-------+---------------+ * | Icon | Preference name | Value | Toggle button | * +------+-----------------------------+-------+---------------+ * | Icon | Preference name | Value | Toggle button | * +------+-----------------------------+-------+---------------+
*/
const headerContainer = toolbox.doc.createElement("header"); /** * The grid layout of the header container is as follows: * * +-------------------------+--------------+ * | Header text | Reset button | * +-------------------------+--------------+
*/
for (const [name, desc] of PREFERENCES) { const prefEl = createPreferenceListItem(toolbox, name, desc);
prefList.appendChild(prefEl);
}
container.append(headerContainer, prefList);
toolbox._experimentalPrefsTooltip.panel.innerHTML = ""; // There is a hardcoded 320px max width for doorhanger tooltips, // see Bug 1654020.
toolbox._experimentalPrefsTooltip.panel.style.maxWidth = "unset";
toolbox._experimentalPrefsTooltip.panel.appendChild(container);
}
function createPreferenceListItem(toolbox, name, desc) { const isPrefEnabled = Services.prefs.getBoolPref(name, false);
const prefEl = toolbox.doc.createElement("li");
/** * The grid layout of a preference line is as follows: * * +------+-----------------------------+-------+---------------+ * | Icon | Preference name | Value | Toggle button | * +------+-----------------------------+-------+---------------+
*/
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 ist noch experimentell.