diff --git a/devtools/client/debugger/src/components/Editor/HighlightCalls.js b/devtools/client/debugger/src/components/Editor/HighlightCalls.js index 0d1142e2ad36..0063f66c7aed 100644 --- a/devtools/client/debugger/src/components/Editor/HighlightCalls.js +++ b/devtools/client/debugger/src/components/Editor/HighlightCalls.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../utils/connect"; import { getHighlightedCalls, @@ -16,6 +17,16 @@ import "./HighlightCalls.css"; export class HighlightCalls extends Component { previousCalls = null; + static get propTypes() { + return { + continueToHere: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + editor: PropTypes.object.isRequired, + highlightedCalls: PropTypes.array, + selectedSource: PropTypes.object, + }; + } + componentDidUpdate() { this.unhighlightFunctionCalls(); this.highlightFunctioCalls(); diff --git a/devtools/client/debugger/src/components/Editor/HighlightLine.js b/devtools/client/debugger/src/components/Editor/HighlightLine.js index 0a1a6d4e7e78..628944ba2bad 100644 --- a/devtools/client/debugger/src/components/Editor/HighlightLine.js +++ b/devtools/client/debugger/src/components/Editor/HighlightLine.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import { Component } from "react"; +import PropTypes from "prop-types"; import { toEditorLine, endOperation, startOperation } from "../../utils/editor"; import { getDocument, hasDocument } from "../../utils/editor/source-documents"; @@ -38,6 +39,21 @@ export class HighlightLine extends Component { isStepping = false; previousEditorLine = null; + static get propTypes() { + return { + pauseCommand: PropTypes.oneOf([ + "expression", + "resume", + "stepOver", + "stepIn", + "stepOut", + ]), + selectedFrame: PropTypes.object, + selectedLocation: PropTypes.object.isRequired, + selectedSourceTextContent: PropTypes.object.isRequired, + }; + } + shouldComponentUpdate(nextProps) { const { selectedLocation, selectedSourceTextContent } = nextProps; return this.shouldSetHighlightLine( diff --git a/devtools/client/debugger/src/components/Editor/HighlightLines.js b/devtools/client/debugger/src/components/Editor/HighlightLines.js index 8da513264d3b..294ab2430314 100644 --- a/devtools/client/debugger/src/components/Editor/HighlightLines.js +++ b/devtools/client/debugger/src/components/Editor/HighlightLines.js @@ -3,10 +3,18 @@ * file, You can obtain one at . */ import { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../utils/connect"; import { getHighlightedLineRange } from "../../selectors"; class HighlightLines extends Component { + static get propTypes() { + return { + editor: PropTypes.object.isRequired, + highlightedLineRange: PropTypes.object, + }; + } + componentDidMount() { this.highlightLineRange(); } diff --git a/devtools/client/debugger/src/components/Editor/InlinePreview.js b/devtools/client/debugger/src/components/Editor/InlinePreview.js index 2cad39ba8d24..c07eb4c18c40 100644 --- a/devtools/client/debugger/src/components/Editor/InlinePreview.js +++ b/devtools/client/debugger/src/components/Editor/InlinePreview.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { PureComponent } from "react"; +import PropTypes from "prop-types"; import Reps from "devtools/client/shared/components/reps/index"; const { @@ -15,6 +16,16 @@ const { // Renders single variable preview inside a codemirror line widget class InlinePreview extends PureComponent { + static get propTypes() { + return { + highlightDomElement: PropTypes.func.isRequired, + openElementInInspector: PropTypes.func.isRequired, + unHighlightDomElement: PropTypes.func.isRequired, + value: PropTypes.any.isRequired, + variable: PropTypes.string.isRequired, + }; + } + showInScopes(variable) { // TODO: focus on variable value in the scopes sidepanel // we will need more info from parent comp diff --git a/devtools/client/debugger/src/components/Editor/InlinePreviews.js b/devtools/client/debugger/src/components/Editor/InlinePreviews.js index a47809d0a2e9..889e2c2aeed2 100644 --- a/devtools/client/debugger/src/components/Editor/InlinePreviews.js +++ b/devtools/client/debugger/src/components/Editor/InlinePreviews.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import InlinePreviewRow from "./InlinePreviewRow"; import { connect } from "../../utils/connect"; import { @@ -16,6 +17,15 @@ function hasPreviews(previews) { } class InlinePreviews extends Component { + static get propTypes() { + return { + editor: PropTypes.object.isRequired, + previews: PropTypes.object, + selectedFrame: PropTypes.object.isRequired, + selectedSource: PropTypes.object.isRequired, + }; + } + shouldComponentUpdate({ previews }) { return hasPreviews(previews); } diff --git a/devtools/client/debugger/src/components/Editor/Preview/ExceptionPopup.js b/devtools/client/debugger/src/components/Editor/Preview/ExceptionPopup.js index 8d6fdfdc5874..76d639c6220d 100644 --- a/devtools/client/debugger/src/components/Editor/Preview/ExceptionPopup.js +++ b/devtools/client/debugger/src/components/Editor/Preview/ExceptionPopup.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../../utils/connect"; import classnames from "classnames"; @@ -35,6 +36,16 @@ class ExceptionPopup extends Component { }; } + static get propTypes() { + return { + clearPreview: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + mouseout: PropTypes.func.isRequired, + selectSourceURL: PropTypes.func.isRequired, + exception: PropTypes.object.isRequired, + }; + } + updateTopWindow() { // The ChromeWindow is used when the stacktrace is expanded to capture all clicks // outside the popup so the popup can be closed only by clicking outside of it. diff --git a/devtools/client/debugger/src/components/Editor/Preview/Popup.js b/devtools/client/debugger/src/components/Editor/Preview/Popup.js index cf1c0c2369a2..904e8f954b13 100644 --- a/devtools/client/debugger/src/components/Editor/Preview/Popup.js +++ b/devtools/client/debugger/src/components/Editor/Preview/Popup.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../../utils/connect"; import Reps from "devtools/client/shared/components/reps/index"; @@ -32,6 +33,20 @@ export class Popup extends Component { super(props); } + static get propTypes() { + return { + clearPreview: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + editorRef: PropTypes.object.isRequired, + highlightDomElement: PropTypes.func.isRequired, + openElementInInspector: PropTypes.func.isRequired, + openLink: PropTypes.func.isRequired, + preview: PropTypes.object.isRequired, + selectSourceURL: PropTypes.func.isRequired, + unHighlightDomElement: PropTypes.func.isRequired, + }; + } + componentDidMount() { this.addHighlightToToken(); } diff --git a/devtools/client/debugger/src/components/Editor/Preview/index.js b/devtools/client/debugger/src/components/Editor/Preview/index.js index 488bd9106376..9a16b743fe3d 100644 --- a/devtools/client/debugger/src/components/Editor/Preview/index.js +++ b/devtools/client/debugger/src/components/Editor/Preview/index.js @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ +import PropTypes from "prop-types"; import React, { PureComponent } from "react"; import { connect } from "../../../utils/connect"; @@ -25,6 +26,20 @@ class Preview extends PureComponent { this.state = { selecting: false }; } + static get propTypes() { + return { + clearPreview: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + editor: PropTypes.object.isRequired, + editorRef: PropTypes.object.isRequired, + highlightedCalls: PropTypes.array, + isPaused: PropTypes.bool.isRequired, + preview: PropTypes.object, + setExceptionPreview: PropTypes.func.isRequired, + updatePreview: PropTypes.func.isRequired, + }; + } + componentDidMount() { this.updateListeners(); } diff --git a/devtools/client/debugger/src/components/Editor/SearchBar.js b/devtools/client/debugger/src/components/Editor/SearchBar.js index dfb7f2b69532..3f1edfd7746b 100644 --- a/devtools/client/debugger/src/components/Editor/SearchBar.js +++ b/devtools/client/debugger/src/components/Editor/SearchBar.js @@ -45,6 +45,26 @@ class SearchBar extends Component { }; } + static get propTypes() { + return { + closeFileSearch: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + doSearch: PropTypes.func.isRequired, + editor: PropTypes.object, + modifiers: PropTypes.object.isRequired, + query: PropTypes.string.isRequired, + searchOn: PropTypes.bool.isRequired, + searchResults: PropTypes.object.isRequired, + selectedContentLoaded: PropTypes.bool.isRequired, + selectedSource: PropTypes.object.isRequired, + setActiveSearch: PropTypes.func.isRequired, + showClose: PropTypes.bool, + size: PropTypes.string, + toggleFileSearchModifier: PropTypes.func.isRequired, + traverseResults: PropTypes.func.isRequired, + }; + } + componentWillUnmount() { const { shortcuts } = this.context; diff --git a/devtools/client/debugger/src/components/Editor/Tab.js b/devtools/client/debugger/src/components/Editor/Tab.js index 6b8dce34d3e5..b76a13176de8 100644 --- a/devtools/client/debugger/src/components/Editor/Tab.js +++ b/devtools/client/debugger/src/components/Editor/Tab.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { PureComponent } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../utils/connect"; import { showMenu, buildMenu } from "../../context-menu/menu"; @@ -35,6 +36,27 @@ import { import classnames from "classnames"; class Tab extends PureComponent { + static get propTypes() { + return { + activeSearch: PropTypes.string, + closeTab: PropTypes.func.isRequired, + closeTabs: PropTypes.func.isRequired, + copyToClipboard: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + hasSiblingOfSameName: PropTypes.bool.isRequired, + onDragEnd: PropTypes.func.isRequired, + onDragOver: PropTypes.func.isRequired, + onDragStart: PropTypes.func.isRequired, + selectSource: PropTypes.func.isRequired, + selectedSource: PropTypes.object, + showSource: PropTypes.func.isRequired, + source: PropTypes.object.isRequired, + tabSources: PropTypes.array.isRequired, + toggleBlackBox: PropTypes.func.isRequired, + togglePrettyPrint: PropTypes.func.isRequired, + }; + } + onTabContextMenu = (event, tab) => { event.preventDefault(); this.showContextMenu(event, tab); diff --git a/devtools/client/debugger/src/components/Editor/Tabs.js b/devtools/client/debugger/src/components/Editor/Tabs.js index eb96d356587e..2865b8877c2d 100644 --- a/devtools/client/debugger/src/components/Editor/Tabs.js +++ b/devtools/client/debugger/src/components/Editor/Tabs.js @@ -4,6 +4,7 @@ import React, { PureComponent } from "react"; import ReactDOM from "react-dom"; +import PropTypes from "prop-types"; import { connect } from "../../utils/connect"; import { @@ -56,6 +57,22 @@ class Tabs extends PureComponent { }); } + static get propTypes() { + return { + cx: PropTypes.object.isRequired, + endPanelCollapsed: PropTypes.bool.isRequired, + horizontal: PropTypes.bool.isRequired, + isPaused: PropTypes.bool.isRequired, + moveTab: PropTypes.func.isRequired, + moveTabBySourceId: PropTypes.func.isRequired, + selectSource: PropTypes.func.isRequired, + selectedSource: PropTypes.object, + startPanelCollapsed: PropTypes.bool.isRequired, + tabSources: PropTypes.array.isRequired, + togglePaneCollapse: PropTypes.func.isRequired, + }; + } + get draggedSource() { return this._draggedSource == null ? { url: null, id: null } diff --git a/devtools/client/debugger/src/components/Editor/index.js b/devtools/client/debugger/src/components/Editor/index.js index 6cc2089ddcc3..13123c657f5d 100644 --- a/devtools/client/debugger/src/components/Editor/index.js +++ b/devtools/client/debugger/src/components/Editor/index.js @@ -109,33 +109,34 @@ class Editor extends PureComponent { static get propTypes() { return { selectedSource: PropTypes.object, - cx: PropTypes.object, - closeTab: PropTypes.func, - toggleBreakpointAtLine: PropTypes.func, + selectedSourceTextContent: PropTypes.object, + cx: PropTypes.object.isRequired, + closeTab: PropTypes.func.isRequired, + toggleBreakpointAtLine: PropTypes.func.isRequired, conditionalPanelLocation: PropTypes.object, - closeConditionalPanel: PropTypes.func, - openConditionalPanel: PropTypes.func, - updateViewport: PropTypes.func, - isPaused: PropTypes.bool, - highlightCalls: PropTypes.func, - unhighlightCalls: PropTypes.func, - breakpointActions: PropTypes.object, - editorActions: PropTypes.object, - addBreakpointAtLine: PropTypes.func, - continueToHere: PropTypes.func, - toggleBlackBox: PropTypes.func, - updateCursorPosition: PropTypes.func, - jumpToMappedLocation: PropTypes.func, + closeConditionalPanel: PropTypes.func.isRequired, + openConditionalPanel: PropTypes.func.isRequired, + updateViewport: PropTypes.func.isRequired, + isPaused: PropTypes.bool.isRequired, + highlightCalls: PropTypes.func.isRequired, + unhighlightCalls: PropTypes.func.isRequired, + breakpointActions: PropTypes.object.isRequired, + editorActions: PropTypes.object.isRequired, + addBreakpointAtLine: PropTypes.func.isRequired, + continueToHere: PropTypes.func.isRequired, + toggleBlackBox: PropTypes.func.isRequired, + updateCursorPosition: PropTypes.func.isRequired, + jumpToMappedLocation: PropTypes.func.isRequired, selectedLocation: PropTypes.object, symbols: PropTypes.object, - startPanelSize: PropTypes.number, - endPanelSize: PropTypes.number, - searchOn: PropTypes.bool, - inlinePreviewEnabled: PropTypes.bool, - editorWrappingEnabled: PropTypes.bool, - skipPausing: PropTypes.bool, - blackboxedRanges: PropTypes.object, - breakableLines: PropTypes.object, + startPanelSize: PropTypes.number.isRequired, + endPanelSize: PropTypes.number.isRequired, + searchOn: PropTypes.bool.isRequired, + inlinePreviewEnabled: PropTypes.bool.isRequired, + editorWrappingEnabled: PropTypes.bool.isRequired, + skipPausing: PropTypes.bool.isRequired, + blackboxedRanges: PropTypes.object.isRequired, + breakableLines: PropTypes.object.isRequired, }; } diff --git a/devtools/client/debugger/src/components/PrimaryPanes/Outline.js b/devtools/client/debugger/src/components/PrimaryPanes/Outline.js index 259689dd8390..f4b880507328 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/Outline.js +++ b/devtools/client/debugger/src/components/PrimaryPanes/Outline.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import { showMenu } from "../../context-menu/menu"; import { connect } from "../../utils/connect"; import { score as fuzzaldrinScore } from "fuzzaldrin-plus"; @@ -63,6 +64,20 @@ export class Outline extends Component { this.state = { filter: "", focusedItem: null }; } + static get propTypes() { + return { + alphabetizeOutline: PropTypes.bool.isRequired, + cursorPosition: PropTypes.object, + cx: PropTypes.object.isRequired, + flashLineRange: PropTypes.func.isRequired, + getFunctionText: PropTypes.func.isRequired, + onAlphabetizeClick: PropTypes.func.isRequired, + selectLocation: PropTypes.func.isRequired, + selectedSource: PropTypes.object.isRequired, + symbols: PropTypes.object.isRequired, + }; + } + componentDidUpdate(prevProps) { const { cursorPosition, symbols } = this.props; if ( diff --git a/devtools/client/debugger/src/components/PrimaryPanes/OutlineFilter.js b/devtools/client/debugger/src/components/PrimaryPanes/OutlineFilter.js index efef23c46770..b8ddc4c1d8ac 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/OutlineFilter.js +++ b/devtools/client/debugger/src/components/PrimaryPanes/OutlineFilter.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import classnames from "classnames"; import "./OutlineFilter.css"; @@ -10,6 +11,13 @@ import "./OutlineFilter.css"; export default class OutlineFilter extends Component { state = { focused: false }; + static get propTypes() { + return { + filter: PropTypes.string.isRequired, + updateFilter: PropTypes.func.isRequired, + }; + } + setFocus = shouldFocus => { this.setState({ focused: shouldFocus }); }; diff --git a/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js index 84070f8f43e7..2215a127afd7 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js +++ b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTree.js @@ -4,6 +4,7 @@ // Dependencies import React, { Component } from "react"; +import PropTypes from "prop-types"; import classnames from "classnames"; import { connect } from "../../utils/connect"; @@ -63,6 +64,24 @@ class SourcesTree extends Component { }); } + static get propTypes() { + return { + cx: PropTypes.object.isRequired, + debuggeeUrl: PropTypes.string.isRequired, + expanded: PropTypes.object.isRequired, + focusItem: PropTypes.func.isRequired, + focused: PropTypes.object, + projectRoot: PropTypes.string.isRequired, + selectSource: PropTypes.func.isRequired, + selectedSource: PropTypes.object, + setExpandedState: PropTypes.func.isRequired, + shownSource: PropTypes.object, + sourceCount: PropTypes.number, + sources: PropTypes.object.isRequired, + threads: PropTypes.array.isRequired, + }; + } + componentWillReceiveProps(nextProps) { const { projectRoot, diff --git a/devtools/client/debugger/src/components/PrimaryPanes/SourcesTreeItem.js b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTreeItem.js index 5413ba651def..059d5a635989 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/SourcesTreeItem.js +++ b/devtools/client/debugger/src/components/PrimaryPanes/SourcesTreeItem.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../../utils/connect"; import classnames from "classnames"; import { showMenu } from "../../context-menu/menu"; @@ -37,6 +38,34 @@ import { downloadFile } from "../../utils/utils"; import { isFulfilled } from "../../utils/async-value"; class SourceTreeItem extends Component { + static get propTypes() { + return { + autoExpand: PropTypes.bool.isRequired, + blackBoxSources: PropTypes.func.isRequired, + clearProjectDirectoryRoot: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + debuggeeUrl: PropTypes.string.isRequired, + depth: PropTypes.number.isRequired, + expanded: PropTypes.bool.isRequired, + extensionName: PropTypes.string, + focusItem: PropTypes.func.isRequired, + focused: PropTypes.bool.isRequired, + getSourcesGroups: PropTypes.func.isRequired, + hasMatchingGeneratedSource: PropTypes.bool.isRequired, + hasPrettyTab: PropTypes.bool.isRequired, + item: PropTypes.object.isRequired, + loadSourceText: PropTypes.func.isRequired, + projectRoot: PropTypes.string.isRequired, + selectItem: PropTypes.func.isRequired, + setExpanded: PropTypes.func.isRequired, + setProjectDirectoryRoot: PropTypes.func.isRequired, + source: PropTypes.object, + sourceContent: PropTypes.object, + threads: PropTypes.array.isRequired, + toggleBlackBox: PropTypes.func.isRequired, + }; + } + componentDidMount() { const { autoExpand, item } = this.props; if (autoExpand) { diff --git a/devtools/client/debugger/src/components/PrimaryPanes/index.js b/devtools/client/debugger/src/components/PrimaryPanes/index.js index 894275731ff9..a43a2112e2c2 100644 --- a/devtools/client/debugger/src/components/PrimaryPanes/index.js +++ b/devtools/client/debugger/src/components/PrimaryPanes/index.js @@ -3,6 +3,7 @@ * file, You can obtain one at . */ import React, { Component } from "react"; +import PropTypes from "prop-types"; import classnames from "classnames"; import { Tab, Tabs, TabList, TabPanels } from "react-aria-components/src/tabs"; @@ -33,6 +34,17 @@ class PrimaryPanes extends Component { }; } + static get propTypes() { + return { + clearProjectDirectoryRoot: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + projectRootName: PropTypes.string.isRequired, + selectedTab: PropTypes.oneOf(["sources", "outline"]).isRequired, + setPrimaryPaneTab: PropTypes.func.isRequired, + threads: PropTypes.array.isRequired, + }; + } + showPane = selectedPane => { this.props.setPrimaryPaneTab(selectedPane); }; diff --git a/devtools/client/debugger/src/components/ProjectSearch.js b/devtools/client/debugger/src/components/ProjectSearch.js index 83d88fa46aa6..9ac51f28ae03 100644 --- a/devtools/client/debugger/src/components/ProjectSearch.js +++ b/devtools/client/debugger/src/components/ProjectSearch.js @@ -2,8 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at . */ -import PropTypes from "prop-types"; import React, { Component } from "react"; +import PropTypes from "prop-types"; import { connect } from "../utils/connect"; import classnames from "classnames"; import actions from "../actions"; @@ -50,6 +50,28 @@ export class ProjectSearch extends Component { }; } + static get propTypes() { + return { + activeSearch: PropTypes.string, + clearSearch: PropTypes.func.isRequired, + closeProjectSearch: PropTypes.func.isRequired, + cx: PropTypes.object.isRequired, + doSearchForHighlight: PropTypes.func.isRequired, + query: PropTypes.string.isRequired, + results: PropTypes.array.isRequired, + searchSources: PropTypes.func.isRequired, + selectSpecificLocation: PropTypes.func.isRequired, + setActiveSearch: PropTypes.func.isRequired, + status: PropTypes.oneOf([ + "INITIAL", + "FETCHING", + "CANCELED", + "DONE", + "ERROR", + ]).isRequired, + }; + } + componentDidMount() { const { shortcuts } = this.context; @@ -278,6 +300,7 @@ export class ProjectSearch extends Component { ); } } + ProjectSearch.contextTypes = { shortcuts: PropTypes.object, };