diff options
Diffstat (limited to 'devtools/client/webconsole/components')
10 files changed, 48 insertions, 36 deletions
diff --git a/devtools/client/webconsole/components/FilterBar/FilterBar.js b/devtools/client/webconsole/components/FilterBar/FilterBar.js index fa9ab15e87..f1438f0f5b 100644 --- a/devtools/client/webconsole/components/FilterBar/FilterBar.js +++ b/devtools/client/webconsole/components/FilterBar/FilterBar.js @@ -105,7 +105,7 @@ class FilterBar extends Component { this.resizeObserver.observe(this.wrapperNode); } - shouldComponentUpdate(nextProps, nextState) { + shouldComponentUpdate(nextProps) { const { closeButtonVisible, displayMode, diff --git a/devtools/client/webconsole/components/Input/EagerEvaluation.js b/devtools/client/webconsole/components/Input/EagerEvaluation.js index 52d5467b45..7dd1053cd1 100644 --- a/devtools/client/webconsole/components/Input/EagerEvaluation.js +++ b/devtools/client/webconsole/components/Input/EagerEvaluation.js @@ -45,7 +45,7 @@ class EagerEvaluation extends Component { }; } - static getDerivedStateFromError(error) { + static getDerivedStateFromError() { return { hasError: true }; } diff --git a/devtools/client/webconsole/components/Input/JSTerm.js b/devtools/client/webconsole/components/Input/JSTerm.js index f00ddd66b0..6a5cbc31bb 100644 --- a/devtools/client/webconsole/components/Input/JSTerm.js +++ b/devtools/client/webconsole/components/Input/JSTerm.js @@ -758,7 +758,7 @@ class JSTerm extends Component { async _openFile() { const fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); fp.init( - this.webConsoleUI.document.defaultView, + this.webConsoleUI.document.defaultView.browsingContext, l10n.getStr("webconsole.input.openJavaScriptFile"), Ci.nsIFilePicker.modeOpen ); @@ -891,9 +891,8 @@ class JSTerm extends Component { * * @param {CodeMirror} cm: codeMirror instance * @param {String} key: The key that was handled - * @param {Event} e: The keypress event */ - _onEditorKeyHandled(cm, key, e) { + _onEditorKeyHandled(cm, key) { // The autocloseBracket addon handle closing brackets keys when they're typed, but // there's already an existing closing bracket. // ex: diff --git a/devtools/client/webconsole/components/Output/ConsoleOutput.js b/devtools/client/webconsole/components/Output/ConsoleOutput.js index a2469b3b46..b8ba82c5c6 100644 --- a/devtools/client/webconsole/components/Output/ConsoleOutput.js +++ b/devtools/client/webconsole/components/Output/ConsoleOutput.js @@ -84,7 +84,7 @@ class ConsoleOutput extends Component { this.ref = createRef(); this.lazyMessageListRef = createRef(); - this.resizeObserver = new ResizeObserver(entries => { + this.resizeObserver = new ResizeObserver(() => { // If we don't have the outputNode reference, or if the outputNode isn't connected // anymore, we disconnect the resize observer (componentWillUnmount is never called // on this component, so we have to do it here). @@ -141,7 +141,7 @@ class ConsoleOutput extends Component { } // FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1774507 - UNSAFE_componentWillUpdate(nextProps, nextState) { + UNSAFE_componentWillUpdate(nextProps) { this.isUpdating = true; if (nextProps.cacheGeneration !== this.props.cacheGeneration) { this.messageIdsToKeepAlive = new Set(); @@ -356,7 +356,7 @@ class ConsoleOutput extends Component { } } -function mapStateToProps(state, props) { +function mapStateToProps(state) { const mutableMessages = getMutableMessagesById(state); return { initialized: state.ui.initialized, diff --git a/devtools/client/webconsole/components/Output/ConsoleTable.js b/devtools/client/webconsole/components/Output/ConsoleTable.js index f41afce96d..9f7780dfe5 100644 --- a/devtools/client/webconsole/components/Output/ConsoleTable.js +++ b/devtools/client/webconsole/components/Output/ConsoleTable.js @@ -71,7 +71,7 @@ class ConsoleTable extends Component { const { dispatch, serviceContainer, setExpanded } = this.props; const rows = []; - items.forEach((item, index) => { + items.forEach(item => { const cells = []; columns.forEach((value, key) => { diff --git a/devtools/client/webconsole/components/Output/GripMessageBody.js b/devtools/client/webconsole/components/Output/GripMessageBody.js index 6ecfe55b8e..a99c0ad547 100644 --- a/devtools/client/webconsole/components/Output/GripMessageBody.js +++ b/devtools/client/webconsole/components/Output/GripMessageBody.js @@ -81,7 +81,7 @@ function GripMessageBody(props) { maybeScrollToBottom, setExpanded, customFormat, - onCmdCtrlClick: (node, { depth, event, focused, expanded }) => { + onCmdCtrlClick: node => { const front = objectInspector.utils.node.getFront(node); if (front) { dispatch(actions.showObjectInSidebar(front)); diff --git a/devtools/client/webconsole/components/Output/LazyMessageList.js b/devtools/client/webconsole/components/Output/LazyMessageList.js index 931b5bb8bd..203efbded6 100644 --- a/devtools/client/webconsole/components/Output/LazyMessageList.js +++ b/devtools/client/webconsole/components/Output/LazyMessageList.js @@ -86,7 +86,7 @@ class LazyMessageList extends Component { } // FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=1774507 - UNSAFE_componentWillUpdate(nextProps, nextState) { + UNSAFE_componentWillUpdate(nextProps) { if (nextProps.cacheGeneration !== this.props.cacheGeneration) { this.#cachedHeights = []; this.#startIndex = 0; @@ -158,10 +158,6 @@ class LazyMessageList extends Component { #cachedHeights; #scrollHandlerBinding; - get #maxIndex() { - return this.props.items.length - 1; - } - get #overdrawHeight() { return this.props.scrollOverdrawCount * this.props.itemDefaultHeight; } @@ -269,7 +265,7 @@ class LazyMessageList extends Component { #addListeners() { const { viewportRef } = this.props; viewportRef.current.addEventListener("scroll", this.#scrollHandlerBinding); - this.#resizeObserver = new ResizeObserver(entries => { + this.#resizeObserver = new ResizeObserver(() => { this.#viewportHeight = viewportRef.current.parentNode.parentNode.clientHeight; this.forceUpdate(); diff --git a/devtools/client/webconsole/components/Output/message-types/DefaultRenderer.js b/devtools/client/webconsole/components/Output/message-types/DefaultRenderer.js index 893e6b04c6..089feff8a8 100644 --- a/devtools/client/webconsole/components/Output/message-types/DefaultRenderer.js +++ b/devtools/client/webconsole/components/Output/message-types/DefaultRenderer.js @@ -8,7 +8,7 @@ const dom = require("resource://devtools/client/shared/vendor/react-dom-factorie DefaultRenderer.displayName = "DefaultRenderer"; -function DefaultRenderer(props) { +function DefaultRenderer() { return dom.div({}, "This message type is not supported yet."); } diff --git a/devtools/client/webconsole/components/Output/message-types/JSTracerTrace.js b/devtools/client/webconsole/components/Output/message-types/JSTracerTrace.js index 7d6ddd2623..241fa15bd1 100644 --- a/devtools/client/webconsole/components/Output/message-types/JSTracerTrace.js +++ b/devtools/client/webconsole/components/Output/message-types/JSTracerTrace.js @@ -62,8 +62,27 @@ function JSTracerTrace(props) { relatedTraceId, // See tracer.jsm FRAME_EXIT_REASONS why, + + // Attributes specific to DOM Mutations + mutationType, + mutationElement, } = message; + let messageBodyConfig; + if (parameters || why || mutationType) { + messageBodyConfig = { + dispatch, + serviceContainer, + maybeScrollToBottom, + setExpanded, + type: "", + useQuotes: true, + + // Disable custom formatter for now in traces + customFormat: false, + }; + } + // When we are logging a DOM event, we have the `eventName` defined. let messageBody; if (eventName) { @@ -73,31 +92,27 @@ function JSTracerTrace(props) { dom.span({ className: "jstracer-io" }, "⟵ "), dom.span({ className: "jstracer-display-name" }, displayName), ]; - } else { + } else if (mutationType) { + messageBody = [ + dom.span( + { className: "jstracer-dom-mutation" }, + // Add an extra space at the end to have nice copy-paste messages + "— DOM Mutation | " + mutationType + " " + ), + formatRep(messageBodyConfig, mutationElement), + ]; + } else if (displayName) { messageBody = [ dom.span({ className: "jstracer-io" }, "⟶ "), dom.span({ className: "jstracer-implementation" }, implementation), // Add a space in order to improve copy paste rendering dom.span({ className: "jstracer-display-name" }, " " + displayName), ]; + } else { + messageBody = [dom.span({ className: "jstracer-io" }, "—")]; } - let messageBodyConfig; - if (parameters || why) { - messageBodyConfig = { - dispatch, - serviceContainer, - maybeScrollToBottom, - setExpanded, - type: "", - useQuotes: true, - - // Disable custom formatter for now in traces - customFormat: false, - }; - } // Arguments will only be passed on-demand - if (parameters) { messageBody.push("(", ...formatReps(messageBodyConfig, parameters), ")"); } @@ -105,9 +120,11 @@ function JSTracerTrace(props) { if (why) { messageBody.push( // Add a spaces in order to improve copy paste rendering - dom.span({ className: "jstracer-exit-frame-reason" }, " " + why + " "), - formatRep(messageBodyConfig, returnedValue) + dom.span({ className: "jstracer-exit-frame-reason" }, " " + why + " ") ); + if (returnedValue !== undefined) { + messageBody.push(formatRep(messageBodyConfig, returnedValue)); + } } if (prefix) { diff --git a/devtools/client/webconsole/components/SideBar.js b/devtools/client/webconsole/components/SideBar.js index e29d7dbbed..412bd8064f 100644 --- a/devtools/client/webconsole/components/SideBar.js +++ b/devtools/client/webconsole/components/SideBar.js @@ -119,7 +119,7 @@ class SideBar extends Component { } } -function mapStateToProps(state, props) { +function mapStateToProps(state) { return { front: state.ui.frontInSidebar, }; |