Commit 54fa5ec0 authored by Razvan Maries's avatar Razvan Maries
Browse files

Merge mozilla-central to autoland. a=merge on a CLOSED TREE

parents ef8e3d8d 86980b4b
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -488,7 +488,7 @@ class Tree extends Component {
    super(props);

    this.state = {
      seen: new Set(),
      autoExpanded: new Set(),
    };

    this.treeRef = React.createRef();
@@ -536,29 +536,40 @@ class Tree extends Component {
  }

  _autoExpand() {
    const { autoExpandDepth, autoExpandNodeChildrenLimit } = this.props;
    if (!autoExpandDepth) {
    const {
      autoExpandDepth,
      autoExpandNodeChildrenLimit,
      initiallyExpanded,
    } = this.props;

    if (!autoExpandDepth && !initiallyExpanded) {
      return;
    }

    // Automatically expand the first autoExpandDepth levels for new items. Do
    // not use the usual DFS infrastructure because we don't want to ignore
    // collapsed nodes.
    // collapsed nodes. Any initially expanded items will be expanded regardless
    // of how deep they are.
    const autoExpand = (item, currentDepth) => {
      if (currentDepth >= autoExpandDepth || this.state.seen.has(item)) {
      const initial = initiallyExpanded && initiallyExpanded(item);

      if (!initial && currentDepth >= autoExpandDepth) {
        return;
      }

      const children = this.props.getChildren(item);
      if (
        !initial &&
        autoExpandNodeChildrenLimit &&
        children.length > autoExpandNodeChildrenLimit
      ) {
        return;
      }

      if (!this.state.autoExpanded.has(item)) {
        this.props.onExpand(item);
      this.state.seen.add(item);
        this.state.autoExpanded.add(item);
      }

      const length = children.length;
      for (let i = 0; i < length; i++) {
@@ -574,6 +585,14 @@ class Tree extends Component {
      }
    } else if (length != 0) {
      autoExpand(roots[0], 0);

      if (initiallyExpanded) {
        for (let i = 1; i < length; i++) {
          if (initiallyExpanded(roots[i])) {
            autoExpand(roots[i], 0);
          }
        }
      }
    }
  }

+7 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ class ObjectInspector extends Component<Props> {
      nodeExpand,
      nodeCollapse,
      recordTelemetryEvent,
      setExpanded,
      roots,
    } = this.props;

@@ -210,6 +211,10 @@ class ObjectInspector extends Component<Props> {
    } else {
      nodeCollapse(item);
    }

    if (setExpanded) {
      setExpanded(item, expand);
    }
  }

  focusItem(item: Node) {
@@ -249,6 +254,7 @@ class ObjectInspector extends Component<Props> {
    const {
      autoExpandAll = true,
      autoExpandDepth = 1,
      initiallyExpanded,
      focusable = true,
      disableWrap = false,
      expandedPaths,
@@ -264,6 +270,7 @@ class ObjectInspector extends Component<Props> {

      autoExpandAll,
      autoExpandDepth,
      initiallyExpanded,

      isExpanded: item => expandedPaths && expandedPaths.has(item.path),
      isExpandable: this.isNodeExpandable,
+25 −0
Original line number Diff line number Diff line
/* 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/>. */

// @flow

import { getScopeItemPath } from "../../utils/pause/scopes/utils";
import type { ThunkArgs } from "../types";
import type { ThreadContext } from "../../types";

export function setExpandedScope(
  cx: ThreadContext,
  item: Object,
  expanded: boolean
) {
  return function({ dispatch, getState }: ThunkArgs) {
    return dispatch({
      type: "SET_EXPANDED_SCOPE",
      cx,
      thread: cx.thread,
      path: getScopeItemPath(item),
      expanded,
    });
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -28,3 +28,4 @@ export { pauseOnExceptions } from "./pauseOnExceptions";
export { selectFrame } from "./selectFrame";
export { toggleSkipPausing } from "./skipPausing";
export { toggleMapScopes } from "./mapScopes";
export { setExpandedScope } from "./expandScopes";
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ CompiledModules(
    'breakOnNext.js',
    'commands.js',
    'continueToHere.js',
    'expandScopes.js',
    'fetchScopes.js',
    'index.js',
    'mapFrames.js',
Loading