/* 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/. */ "use strict";
/** * This is header that should be displayed on top of the toolbox when using * about:devtools-toolbox.
*/ class DebugTargetInfo extends PureComponent { static get propTypes() { return {
alwaysOnTop: PropTypes.bool.isRequired,
focusedState: PropTypes.bool,
toggleAlwaysOnTop: PropTypes.func.isRequired,
debugTargetData: PropTypes.shape({
connectionType: PropTypes.oneOf(Object.values(CONNECTION_TYPES))
.isRequired,
runtimeInfo: PropTypes.shape({
deviceName: PropTypes.string,
icon: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
version: PropTypes.string.isRequired,
}).isRequired,
descriptorType: PropTypes.oneOf(Object.values(DESCRIPTOR_TYPES))
.isRequired,
descriptorName: PropTypes.string.isRequired,
}).isRequired,
L10N: PropTypes.object.isRequired,
toolbox: PropTypes.object.isRequired,
};
}
onSubmit(event) {
event.preventDefault();
let url = this.state.urlValue;
if (!url || !url.length) { return;
}
try { // Get the URL from the fixup service: const flags = Services.uriFixup.FIXUP_FLAG_FIX_SCHEME_TYPOS; const uriInfo = Services.uriFixup.getFixupURIInfo(url, flags);
url = uriInfo.fixedURI.spec;
} catch (ex) { // The getFixupURIInfo service will throw an error if a malformed URI is // produced from the input.
console.error(ex);
}
renderRuntime() { if (
!this.props.debugTargetData.runtimeInfo ||
(this.props.debugTargetData.connectionType ===
CONNECTION_TYPES.THIS_FIREFOX && this.props.debugTargetData.descriptorType ===
DESCRIPTOR_TYPES.EXTENSION)
) { // Skip the runtime render if no runtimeInfo is available. // Runtime info is retrieved from the remote-client-manager, which might not be // setup if about:devtools-toolbox was not opened from about:debugging. // // Also skip the runtime if we are debugging firefox itself, mainly to save some space. returnnull;
}
// Avoid displaying the target url for web extension as it is always // the fallback document URL. Keeps rendering the url component // as it use flex to align the "always on top" button on the right. if (isWebExtension) { return dom.span({
className: "debug-target-url",
});
}
renderAlwaysOnTopButton() { // This is only displayed for local web extension debugging const { descriptorType, connectionType } = this.props.debugTargetData; const isLocalWebExtension =
descriptorType === DESCRIPTOR_TYPES.EXTENSION &&
connectionType === CONNECTION_TYPES.THIS_FIREFOX; if (!isLocalWebExtension) { return [];
}
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.