--- a/devtools/client/canvasdebugger/callslist.js
+++ b/devtools/client/canvasdebugger/callslist.js
@@ -4,17 +4,17 @@
/* import-globals-from canvasdebugger.js */
/* globals window, document */
"use strict";
/**
* Functions handling details about a single recorded animation frame snapshot
* (the calls list, rendering preview, thumbnails filmstrip etc.).
*/
-var CallsListView = Heritage.extend(WidgetMethods, {
+var CallsListView = extend(WidgetMethods, {
/**
* Initialization function, called when the tool is started.
*/
initialize: function () {
this.widget = new SideMenuWidget($("#calls-list"));
this._slider = $("#calls-slider");
this._searchbox = $("#calls-searchbox");
this._filmstrip = $("#snapshot-filmstrip");
--- a/devtools/client/canvasdebugger/canvasdebugger.js
+++ b/devtools/client/canvasdebugger/canvasdebugger.js
@@ -9,20 +9,21 @@ const { require } = Cu.import("resource:
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
const { SideMenuWidget } = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
const promise = require("promise");
const Services = require("Services");
const EventEmitter = require("devtools/shared/old-event-emitter");
const { CallWatcherFront } = require("devtools/shared/fronts/call-watcher");
const { CanvasFront } = require("devtools/shared/fronts/canvas");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
+const { extend } = require("devtools/shared/extend");
const flags = require("devtools/shared/flags");
const { LocalizationHelper } = require("devtools/shared/l10n");
const { PluralForm } = require("devtools/shared/plural-form");
-const { Heritage, WidgetMethods, setNamedTimeout, clearNamedTimeout,
+const { WidgetMethods, setNamedTimeout, clearNamedTimeout,
setConditionalTimeout } = require("devtools/client/shared/widgets/view-helpers");
// Use privileged promise in panel documents to prevent having them to freeze
// during toolbox destruction. See bug 1402779.
const Promise = require("Promise");
const CANVAS_ACTOR_RECORDING_ATTEMPT = flags.testing ? 500 : 5000;
--- a/devtools/client/canvasdebugger/snapshotslist.js
+++ b/devtools/client/canvasdebugger/snapshotslist.js
@@ -3,17 +3,17 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from canvasdebugger.js */
/* globals window, document */
"use strict";
/**
* Functions handling the recorded animation frame snapshots UI.
*/
-var SnapshotsListView = Heritage.extend(WidgetMethods, {
+var SnapshotsListView = extend(WidgetMethods, {
/**
* Initialization function, called when the tool is started.
*/
initialize: function () {
this.widget = new SideMenuWidget($("#snapshots-list"), {
showArrows: true
});
--- a/devtools/client/debugger/content/views/event-listeners-view.js
+++ b/devtools/client/debugger/content/views/event-listeners-view.js
@@ -3,17 +3,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../../debugger-controller.js */
const actions = require("../actions/event-listeners");
const { bindActionCreators } = require("devtools/client/shared/vendor/redux");
-const { Heritage, WidgetMethods } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
+const { WidgetMethods } = require("devtools/client/shared/widgets/view-helpers");
const { SideMenuWidget } = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
/**
* Functions handling the event listeners UI.
*/
function EventListenersView(controller) {
dumpn("EventListenersView was instantiated");
@@ -21,17 +22,17 @@ function EventListenersView(controller)
this.getState = () => controller.getState().eventListeners;
this._onCheck = this._onCheck.bind(this);
this._onClick = this._onClick.bind(this);
controller.onChange("event-listeners", this.renderListeners.bind(this));
}
-EventListenersView.prototype = Heritage.extend(WidgetMethods, {
+EventListenersView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the EventListenersView");
this.widget = new SideMenuWidget(document.getElementById("event-listeners"), {
showItemCheckboxes: true,
--- a/devtools/client/debugger/content/views/sources-view.js
+++ b/devtools/client/debugger/content/views/sources-view.js
@@ -15,18 +15,18 @@ const {
makeLocationId
} = require("../queries");
const actions = Object.assign(
{},
require("../actions/sources"),
require("../actions/breakpoints")
);
const { bindActionCreators } = require("devtools/client/shared/vendor/redux");
+const { extend } = require("devtools/shared/extend");
const {
- Heritage,
WidgetMethods,
setNamedTimeout
} = require("devtools/client/shared/widgets/view-helpers");
const { Task } = require("devtools/shared/task");
const { SideMenuWidget } = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
const { gDevTools } = require("devtools/client/framework/devtools");
const {KeyCodes} = require("devtools/client/shared/keycodes");
@@ -75,17 +75,17 @@ function SourcesView(controller, Debugge
this._onConditionalPopupHiding = this._onConditionalPopupHiding.bind(this);
this._onConditionalTextboxKeyPress = this._onConditionalTextboxKeyPress.bind(this);
this._onEditorContextMenuOpen = this._onEditorContextMenuOpen.bind(this);
this._onCopyUrlCommand = this._onCopyUrlCommand.bind(this);
this._onNewTabCommand = this._onNewTabCommand.bind(this);
this._onConditionalPopupHidden = this._onConditionalPopupHidden.bind(this);
}
-SourcesView.prototype = Heritage.extend(WidgetMethods, {
+SourcesView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function (isWorker) {
dumpn("Initializing the SourcesView");
this.widget = new SideMenuWidget(document.getElementById("sources"), {
contextMenu: document.getElementById("debuggerSourcesContextMenu"),
@@ -345,23 +345,23 @@ SourcesView.prototype = Heritage.extend(
// Get the source item to which the breakpoint should be attached.
let sourceItem = this.getItemByValue(location.actor);
if (!sourceItem) {
return;
}
// Create the element node and menu popup for the breakpoint item.
- let breakpointArgs = Heritage.extend(breakpoint.asMutable(), options);
+ let breakpointArgs = extend(breakpoint.asMutable(), options);
let breakpointView = this._createBreakpointView.call(this, breakpointArgs);
let contextMenu = this._createContextMenu.call(this, breakpointArgs);
// Append a breakpoint child item to the corresponding source item.
sourceItem.append(breakpointView.container, {
- attachment: Heritage.extend(breakpointArgs, {
+ attachment: extend(breakpointArgs, {
actor: location.actor,
line: location.line,
view: breakpointView,
popup: contextMenu
}),
attributes: [
["contextmenu", contextMenu.menupopupId]
],
--- a/devtools/client/debugger/debugger-controller.js
+++ b/devtools/client/debugger/debugger-controller.js
@@ -104,18 +104,19 @@ const { require } = BrowserLoader({
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineConstant(this, "require", require);
const { SimpleListWidget } = require("resource://devtools/client/shared/widgets/SimpleListWidget.jsm");
const { BreadcrumbsWidget } = require("resource://devtools/client/shared/widgets/BreadcrumbsWidget.jsm");
const { SideMenuWidget } = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
const { VariablesView } = require("resource://devtools/client/shared/widgets/VariablesView.jsm");
const { VariablesViewController, StackFrameUtils } = require("resource://devtools/client/shared/widgets/VariablesViewController.jsm");
const EventEmitter = require("devtools/shared/old-event-emitter");
+const { extend } = require("devtools/shared/extend");
const { gDevTools } = require("devtools/client/framework/devtools");
-const { ViewHelpers, Heritage, WidgetMethods, setNamedTimeout,
+const { ViewHelpers, WidgetMethods, setNamedTimeout,
clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
// Use privileged promise in panel documents to prevent having them to freeze
// during toolbox destruction. See bug 1402779.
const Promise = require("Promise");
// React
const React = require("devtools/client/shared/vendor/react");
--- a/devtools/client/debugger/debugger-view.js
+++ b/devtools/client/debugger/debugger-view.js
@@ -841,17 +841,17 @@ var DebuggerView = {
/**
* A custom items container, used for displaying views like the
* FilteredSources, FilteredFunctions etc., inheriting the generic WidgetMethods.
*/
function ResultsPanelContainer() {
}
-ResultsPanelContainer.prototype = Heritage.extend(WidgetMethods, {
+ResultsPanelContainer.prototype = extend(WidgetMethods, {
/**
* Sets the anchor node for this container panel.
* @param nsIDOMNode aNode
*/
set anchor(aNode) {
this._anchor = aNode;
// If the anchor node is not null, create a panel to attach to the anchor
--- a/devtools/client/debugger/views/filter-view.js
+++ b/devtools/client/debugger/views/filter-view.js
@@ -546,17 +546,17 @@ function FilteredSourcesView(DebuggerVie
dumpn("FilteredSourcesView was instantiated");
this.DebuggerView = DebuggerView;
this._onClick = this._onClick.bind(this);
this._onSelect = this._onSelect.bind(this);
}
-FilteredSourcesView.prototype = Heritage.extend(ResultsPanelContainer.prototype, {
+FilteredSourcesView.prototype = extend(ResultsPanelContainer.prototype, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the FilteredSourcesView");
this.anchor = document.getElementById("searchbox");
this.widget.addEventListener("select", this._onSelect);
@@ -709,17 +709,17 @@ function FilteredFunctionsView(SourceScr
this.SourceScripts = SourceScripts;
this.Parser = Parser;
this.DebuggerView = DebuggerView;
this._onClick = this._onClick.bind(this);
this._onSelect = this._onSelect.bind(this);
}
-FilteredFunctionsView.prototype = Heritage.extend(ResultsPanelContainer.prototype, {
+FilteredFunctionsView.prototype = extend(ResultsPanelContainer.prototype, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the FilteredFunctionsView");
this.anchor = document.getElementById("searchbox");
this.widget.addEventListener("select", this._onSelect);
--- a/devtools/client/debugger/views/global-search-view.js
+++ b/devtools/client/debugger/views/global-search-view.js
@@ -18,17 +18,17 @@ function GlobalSearchView(DebuggerContro
this.SourceScripts = DebuggerController.SourceScripts;
this.DebuggerView = DebuggerView;
this._onHeaderClick = this._onHeaderClick.bind(this);
this._onLineClick = this._onLineClick.bind(this);
this._onMatchClick = this._onMatchClick.bind(this);
}
-GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
+GlobalSearchView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the GlobalSearchView");
this.widget = new SimpleListWidget(document.getElementById("globalsearch"));
this._splitter = document.querySelector("#globalsearch + .devtools-horizontal-splitter");
--- a/devtools/client/debugger/views/stack-frames-classic-view.js
+++ b/devtools/client/debugger/views/stack-frames-classic-view.js
@@ -15,17 +15,17 @@
*/
function StackFramesClassicListView(DebuggerController, DebuggerView) {
dumpn("StackFramesClassicListView was instantiated");
this.DebuggerView = DebuggerView;
this._onSelect = this._onSelect.bind(this);
}
-StackFramesClassicListView.prototype = Heritage.extend(WidgetMethods, {
+StackFramesClassicListView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the StackFramesClassicListView");
this.widget = new SideMenuWidget(document.getElementById("callstack-list"));
this.widget.addEventListener("select", this._onSelect);
--- a/devtools/client/debugger/views/stack-frames-view.js
+++ b/devtools/client/debugger/views/stack-frames-view.js
@@ -20,17 +20,17 @@ function StackFramesView(DebuggerControl
this._onStackframeRemoved = this._onStackframeRemoved.bind(this);
this._onSelect = this._onSelect.bind(this);
this._onScroll = this._onScroll.bind(this);
this._afterScroll = this._afterScroll.bind(this);
this._getStackAsString = this._getStackAsString.bind(this);
}
-StackFramesView.prototype = Heritage.extend(WidgetMethods, {
+StackFramesView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the StackFramesView");
this._popupset = document.getElementById("debuggerPopupset");
--- a/devtools/client/debugger/views/watch-expressions-view.js
+++ b/devtools/client/debugger/views/watch-expressions-view.js
@@ -24,17 +24,17 @@ function WatchExpressionsView(DebuggerCo
this.deleteExpression = this.deleteExpression.bind(this);
this._createItemView = this._createItemView.bind(this);
this._onClick = this._onClick.bind(this);
this._onClose = this._onClose.bind(this);
this._onBlur = this._onBlur.bind(this);
this._onKeyPress = this._onKeyPress.bind(this);
}
-WatchExpressionsView.prototype = Heritage.extend(WidgetMethods, {
+WatchExpressionsView.prototype = extend(WidgetMethods, {
/**
* Initialization function, called when the debugger is started.
*/
initialize: function () {
dumpn("Initializing the WatchExpressionsView");
this.widget = new SimpleListWidget(document.getElementById("expressions"));
this.widget.setAttribute("context", "debuggerWatchExpressionsContextMenu");
--- a/devtools/client/debugger/views/workers-view.js
+++ b/devtools/client/debugger/views/workers-view.js
@@ -8,17 +8,17 @@
/* import-globals-from ../utils.js */
/* globals document */
"use strict";
function WorkersView() {
this._onWorkerSelect = this._onWorkerSelect.bind(this);
}
-WorkersView.prototype = Heritage.extend(WidgetMethods, {
+WorkersView.prototype = extend(WidgetMethods, {
initialize: function () {
if (!Prefs.workersEnabled) {
return;
}
document.getElementById("workers-pane").removeAttribute("hidden");
document.getElementById("workers-splitter").removeAttribute("hidden");
--- a/devtools/client/performance/modules/widgets/graphs.js
+++ b/devtools/client/performance/modules/widgets/graphs.js
@@ -3,17 +3,17 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* This file contains the base line graph that all Performance line graphs use.
*/
const { Task } = require("devtools/shared/task");
-const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const LineGraphWidget = require("devtools/client/shared/widgets/LineGraphWidget");
const MountainGraphWidget = require("devtools/client/shared/widgets/MountainGraphWidget");
const { CanvasGraphUtils } = require("devtools/client/shared/widgets/Graphs");
const defer = require("devtools/shared/defer");
const EventEmitter = require("devtools/shared/old-event-emitter");
const { colorUtils } = require("devtools/shared/css/color");
@@ -54,17 +54,17 @@ const OPTIMIZATIONS_GRAPH_RESOLUTION = 1
* @param string metric
* The unit of measurement for this graph.
*/
function PerformanceGraph(parent, metric) {
LineGraphWidget.call(this, parent, { metric });
this.setTheme();
}
-PerformanceGraph.prototype = Heritage.extend(LineGraphWidget.prototype, {
+PerformanceGraph.prototype = extend(LineGraphWidget.prototype, {
strokeWidth: STROKE_WIDTH,
dampenValuesFactor: DAMPEN_VALUES,
fixedHeight: HEIGHT,
clipheadLineColor: CLIPHEAD_LINE_COLOR,
selectionLineColor: SELECTION_LINE_COLOR,
withTooltipArrows: false,
withFixedTooltipPositions: true,
@@ -103,17 +103,17 @@ PerformanceGraph.prototype = Heritage.ex
*
* @param nsIDOMNode parent
* The parent node holding the overview.
*/
function FramerateGraph(parent) {
PerformanceGraph.call(this, parent, ProfilerGlobal.L10N.getStr("graphs.fps"));
}
-FramerateGraph.prototype = Heritage.extend(PerformanceGraph.prototype, {
+FramerateGraph.prototype = extend(PerformanceGraph.prototype, {
mainColor: FRAMERATE_GRAPH_COLOR_NAME,
setPerformanceData: function ({ duration, ticks }, resolution) {
this.dataDuration = duration;
return this.setDataFromTimestamps(ticks, resolution, duration);
}
});
/**
@@ -121,29 +121,29 @@ FramerateGraph.prototype = Heritage.exte
*
* @param nsIDOMNode parent
* The parent node holding the overview.
*/
function MemoryGraph(parent) {
PerformanceGraph.call(this, parent, ProfilerGlobal.L10N.getStr("graphs.memory"));
}
-MemoryGraph.prototype = Heritage.extend(PerformanceGraph.prototype, {
+MemoryGraph.prototype = extend(PerformanceGraph.prototype, {
mainColor: MEMORY_GRAPH_COLOR_NAME,
setPerformanceData: function ({ duration, memory }) {
this.dataDuration = duration;
return this.setData(memory);
}
});
function TimelineGraph(parent, filter) {
MarkersOverview.call(this, parent, filter);
}
-TimelineGraph.prototype = Heritage.extend(MarkersOverview.prototype, {
+TimelineGraph.prototype = extend(MarkersOverview.prototype, {
headerHeight: MARKERS_GRAPH_HEADER_HEIGHT,
rowHeight: MARKERS_GRAPH_ROW_HEIGHT,
groupPadding: MARKERS_GROUP_VERTICAL_PADDING,
setPerformanceData: MarkersOverview.prototype.setData
});
/**
* Definitions file for GraphsController, indicating the constructor,
@@ -434,17 +434,17 @@ GraphsController.prototype = {
* @param string metric
* The unit of measurement for this graph.
*/
function OptimizationsGraph(parent) {
MountainGraphWidget.call(this, parent);
this.setTheme();
}
-OptimizationsGraph.prototype = Heritage.extend(MountainGraphWidget.prototype, {
+OptimizationsGraph.prototype = extend(MountainGraphWidget.prototype, {
render: Task.async(function* (threadNode, frameNode) {
// Regardless if we draw or clear the graph, wait
// until it's ready.
yield this.ready();
if (!threadNode || !frameNode) {
this.setData([]);
--- a/devtools/client/performance/modules/widgets/markers-overview.js
+++ b/devtools/client/performance/modules/widgets/markers-overview.js
@@ -4,17 +4,17 @@
"use strict";
/**
* This file contains the "markers overview" graph, which is a minimap of all
* the timeline data. Regions inside it may be selected, determining which
* markers are visible in the "waterfall".
*/
-const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const { AbstractCanvasGraph } = require("devtools/client/shared/widgets/Graphs");
const { colorUtils } = require("devtools/shared/css/color");
const { getColor } = require("devtools/client/shared/theme");
const ProfilerGlobal = require("devtools/client/performance/modules/global");
const { MarkerBlueprintUtils } = require("devtools/client/performance/modules/marker-blueprint-utils");
const { TickUtils } = require("devtools/client/performance/modules/waterfall-ticks");
const { TIMELINE_BLUEPRINT } = require("devtools/client/performance/modules/markers");
@@ -43,17 +43,17 @@ const OVERVIEW_GROUP_VERTICAL_PADDING =
* List of names of marker types that should not be shown.
*/
function MarkersOverview(parent, filter = [], ...args) {
AbstractCanvasGraph.apply(this, [parent, "markers-overview", ...args]);
this.setTheme();
this.setFilter(filter);
}
-MarkersOverview.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
+MarkersOverview.prototype = extend(AbstractCanvasGraph.prototype, {
clipheadLineColor: OVERVIEW_CLIPHEAD_LINE_COLOR,
selectionLineColor: OVERVIEW_SELECTION_LINE_COLOR,
headerHeight: OVERVIEW_HEADER_HEIGHT,
rowHeight: OVERVIEW_ROW_HEIGHT,
groupPadding: OVERVIEW_GROUP_VERTICAL_PADDING,
/**
* Compute the height of the overview.
--- a/devtools/client/performance/modules/widgets/tree-view.js
+++ b/devtools/client/performance/modules/widgets/tree-view.js
@@ -4,17 +4,17 @@
"use strict";
/**
* This file contains the tree view, displaying all the samples and frames
* received from the proviler in a tree-like structure.
*/
const { L10N } = require("devtools/client/performance/modules/global");
-const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const { AbstractTreeItem } = require("resource://devtools/client/shared/widgets/AbstractTreeItem.jsm");
const URL_LABEL_TOOLTIP = L10N.getStr("table.url.tooltiptext");
const VIEW_OPTIMIZATIONS_TOOLTIP = L10N.getStr("table.view-optimizations.tooltiptext2");
const CALL_TREE_INDENTATION = 16; // px
// Used for rendering values in cells
@@ -169,17 +169,17 @@ function CallView({
this.frame = frame;
this.hidden = hidden;
this.inverted = inverted;
this.showOptimizationHint = showOptimizationHint;
this._onUrlClick = this._onUrlClick.bind(this);
}
-CallView.prototype = Heritage.extend(AbstractTreeItem.prototype, {
+CallView.prototype = extend(AbstractTreeItem.prototype, {
/**
* Creates the view for this tree node.
* @param nsIDOMNode document
* @param nsIDOMNode arrowNode
* @return nsIDOMNode
*/
_displaySelf: function (document, arrowNode) {
let frameInfo = this.getDisplayedData();
--- a/devtools/client/performance/performance-controller.js
+++ b/devtools/client/performance/performance-controller.js
@@ -9,20 +9,21 @@
var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
var BrowserLoaderModule = {};
Cu.import("resource://devtools/client/shared/browser-loader.js", BrowserLoaderModule);
var { loader, require } = BrowserLoaderModule.BrowserLoader({
baseURI: "resource://devtools/client/performance/",
window
});
var { Task } = require("devtools/shared/task");
-/* exported Heritage, ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout */
-var { Heritage, ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
+/* exported ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout */
+var { ViewHelpers, WidgetMethods, setNamedTimeout, clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
var { PrefObserver } = require("devtools/client/shared/prefs");
-
+/* exported extend */
+const { extend } = require("devtools/shared/extend");
// Use privileged promise in panel documents to prevent having them to freeze
// during toolbox destruction. See bug 1402779.
var Promise = require("Promise");
// Events emitted by various objects in the panel.
var EVENTS = require("devtools/client/performance/events");
Object.defineProperty(this, "EVENTS", {
value: EVENTS,
--- a/devtools/client/performance/test/helpers/synth-utils.js
+++ b/devtools/client/performance/test/helpers/synth-utils.js
@@ -50,24 +50,24 @@ exports.synthesizeProfile = () => {
};
/**
* Generates a simple implementation for a tree class.
*/
exports.synthesizeCustomTreeClass = () => {
const { Cu } = require("chrome");
const { AbstractTreeItem } = Cu.import("resource://devtools/client/shared/widgets/AbstractTreeItem.jsm", {});
- const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+ const { extend } = require("devtools/shared/extend");
function MyCustomTreeItem(dataSrc, properties) {
AbstractTreeItem.call(this, properties);
this.itemDataSrc = dataSrc;
}
- MyCustomTreeItem.prototype = Heritage.extend(AbstractTreeItem.prototype, {
+ MyCustomTreeItem.prototype = extend(AbstractTreeItem.prototype, {
_displaySelf: function (document, arrowNode) {
let node = document.createElement("hbox");
node.style.marginInlineStart = (this.level * 10) + "px";
node.appendChild(arrowNode);
node.appendChild(document.createTextNode(this.itemDataSrc.label));
return node;
},
--- a/devtools/client/performance/views/details-js-call-tree.js
+++ b/devtools/client/performance/views/details-js-call-tree.js
@@ -4,17 +4,17 @@
/* import-globals-from ../performance-controller.js */
/* import-globals-from ../performance-view.js */
/* globals DetailsSubview */
"use strict";
/**
* CallTree view containing profiler call tree, controlled by DetailsView.
*/
-var JsCallTreeView = Heritage.extend(DetailsSubview, {
+var JsCallTreeView = extend(DetailsSubview, {
rerenderPrefs: [
"invert-call-tree",
"show-platform-data",
"flatten-tree-recursion",
"show-jit-optimizations",
],
--- a/devtools/client/performance/views/details-js-flamegraph.js
+++ b/devtools/client/performance/views/details-js-flamegraph.js
@@ -5,17 +5,17 @@
/* import-globals-from ../performance-view.js */
/* globals DetailsSubview */
"use strict";
/**
* FlameGraph view containing a pyramid-like visualization of a profile,
* controlled by DetailsView.
*/
-var JsFlameGraphView = Heritage.extend(DetailsSubview, {
+var JsFlameGraphView = extend(DetailsSubview, {
shouldUpdateWhileMouseIsActive: true,
rerenderPrefs: [
"invert-flame-graph",
"flatten-tree-recursion",
"show-platform-data",
"show-idle-blocks"
--- a/devtools/client/performance/views/details-memory-call-tree.js
+++ b/devtools/client/performance/views/details-memory-call-tree.js
@@ -4,17 +4,17 @@
/* import-globals-from ../performance-controller.js */
/* import-globals-from ../performance-view.js */
/* globals DetailsSubview */
"use strict";
/**
* CallTree view containing memory allocation sites, controlled by DetailsView.
*/
-var MemoryCallTreeView = Heritage.extend(DetailsSubview, {
+var MemoryCallTreeView = extend(DetailsSubview, {
rerenderPrefs: [
"invert-call-tree"
],
// Units are in milliseconds.
rangeChangeDebounceTime: 100,
--- a/devtools/client/performance/views/details-memory-flamegraph.js
+++ b/devtools/client/performance/views/details-memory-flamegraph.js
@@ -5,17 +5,17 @@
/* import-globals-from ../performance-view.js */
/* globals DetailsSubview */
"use strict";
/**
* FlameGraph view containing a pyramid-like visualization of memory allocation
* sites, controlled by DetailsView.
*/
-var MemoryFlameGraphView = Heritage.extend(DetailsSubview, {
+var MemoryFlameGraphView = extend(DetailsSubview, {
shouldUpdateWhileMouseIsActive: true,
rerenderPrefs: [
"invert-flame-graph",
"flatten-tree-recursion",
"show-idle-blocks"
],
--- a/devtools/client/performance/views/details-waterfall.js
+++ b/devtools/client/performance/views/details-waterfall.js
@@ -10,17 +10,17 @@ const MARKER_DETAILS_WIDTH = 200;
// Units are in milliseconds.
const WATERFALL_RESIZE_EVENTS_DRAIN = 100;
const { TickUtils } = require("devtools/client/performance/modules/waterfall-ticks");
/**
* Waterfall view containing the timeline markers, controlled by DetailsView.
*/
-var WaterfallView = Heritage.extend(DetailsSubview, {
+var WaterfallView = extend(DetailsSubview, {
// Smallest unit of time between two markers. Larger by 10x^3 than Number.EPSILON.
MARKER_EPSILON: 0.000000000001,
// px
WATERFALL_MARKER_SIDEBAR_WIDTH: 175,
// px
WATERFALL_MARKER_SIDEBAR_SAFE_BOUNDS: 20,
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -50,17 +50,17 @@ const TargetFactory = require("devtools/
const EventEmitter = require("devtools/shared/old-event-emitter");
const {DevToolsWorker} = require("devtools/shared/worker/worker");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const Services = require("Services");
const {gDevTools} = require("devtools/client/framework/devtools");
-const {Heritage} = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const {NetUtil} = require("resource://gre/modules/NetUtil.jsm");
const {ScratchpadManager} = require("resource://devtools/client/scratchpad/scratchpad-manager.jsm");
const {addDebuggerToGlobal} = require("resource://gre/modules/jsdebugger.jsm");
const {OS} = require("resource://gre/modules/osfile.jsm");
const {Reflect} = require("resource://gre/modules/reflect.jsm");
@@ -2172,17 +2172,17 @@ ScratchpadTab.prototype = {
/**
* Represents the DebuggerClient connection to a specific window as used by the
* Scratchpad.
*/
function ScratchpadWindow() {}
ScratchpadWindow.consoleFor = ScratchpadTab.consoleFor;
-ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, {
+ScratchpadWindow.prototype = extend(ScratchpadTab.prototype, {
/**
* Attach to this window.
*
* @return Promise
* The promise for the target for this window.
*/
_attach: function SW__attach()
{
@@ -2202,17 +2202,17 @@ ScratchpadWindow.prototype = Heritage.ex
function ScratchpadTarget(aTarget)
{
this._target = aTarget;
}
ScratchpadTarget.consoleFor = ScratchpadTab.consoleFor;
-ScratchpadTarget.prototype = Heritage.extend(ScratchpadTab.prototype, {
+ScratchpadTarget.prototype = extend(ScratchpadTab.prototype, {
_attach: function ST__attach()
{
if (this._target.isRemote) {
return promise.resolve(this._target);
}
return this._target.makeRemote().then(() => this._target);
}
});
--- a/devtools/client/shadereditor/shadereditor.js
+++ b/devtools/client/shadereditor/shadereditor.js
@@ -10,17 +10,18 @@ const {XPCOMUtils} = require("resource:/
const {SideMenuWidget} = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const Services = require("Services");
const EventEmitter = require("devtools/shared/old-event-emitter");
const Tooltip = require("devtools/client/shared/widgets/tooltip/Tooltip");
const Editor = require("devtools/client/sourceeditor/editor");
const {LocalizationHelper} = require("devtools/shared/l10n");
-const {Heritage, WidgetMethods, setNamedTimeout} =
+const {extend} = require("devtools/shared/extend");
+const {WidgetMethods, setNamedTimeout} =
require("devtools/client/shared/widgets/view-helpers");
const {Task} = require("devtools/shared/task");
// Use privileged promise in panel documents to prevent having them to freeze
// during toolbox destruction. See bug 1402779.
const Promise = require("Promise");
// The panel's window global is an EventEmitter firing the following events:
@@ -193,17 +194,17 @@ var EventsHandler = {
$("#content").hidden = false;
ShadersListView.addProgram(programActor);
}
};
/**
* Functions handling the sources UI.
*/
-var ShadersListView = Heritage.extend(WidgetMethods, {
+var ShadersListView = extend(WidgetMethods, {
/**
* Initialization function, called when the tool is started.
*/
initialize: function () {
this.widget = new SideMenuWidget(this._pane = $("#shaders-pane"), {
showArrows: true,
showItemCheckboxes: true
});
--- a/devtools/client/shared/widgets/AbstractTreeItem.jsm
+++ b/devtools/client/shared/widgets/AbstractTreeItem.jsm
@@ -36,17 +36,17 @@ this.EXPORTED_SYMBOLS = ["AbstractTreeIt
*
* For example, you can extend this abstract class like this:
*
* function MyCustomTreeItem(dataSrc, properties) {
* AbstractTreeItem.call(this, properties);
* this.itemDataSrc = dataSrc;
* }
*
- * MyCustomTreeItem.prototype = Heritage.extend(AbstractTreeItem.prototype, {
+ * MyCustomTreeItem.prototype = extend(AbstractTreeItem.prototype, {
* _displaySelf: function(document, arrowNode) {
* let node = document.createElement("hbox");
* ...
* // Append the provided arrow node wherever you want.
* node.appendChild(arrowNode);
* ...
* // Use `this.itemDataSrc` to customize the tree item and
* // `this.level` to calculate the indentation.
--- a/devtools/client/shared/widgets/BarGraphWidget.js
+++ b/devtools/client/shared/widgets/BarGraphWidget.js
@@ -1,11 +1,12 @@
"use strict";
-const { Heritage, setNamedTimeout, clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
+const { setNamedTimeout, clearNamedTimeout } = require("devtools/client/shared/widgets/view-helpers");
const { AbstractCanvasGraph, CanvasGraphUtils } = require("devtools/client/shared/widgets/Graphs");
const HTML_NS = "http://www.w3.org/1999/xhtml";
// Bar graph constants.
const GRAPH_DAMPEN_VALUES_FACTOR = 0.75;
@@ -72,17 +73,17 @@ this.BarGraphWidget = function (parent,
this._onLegendMouseOver = this._onLegendMouseOver.bind(this);
this._onLegendMouseOut = this._onLegendMouseOut.bind(this);
this._onLegendMouseDown = this._onLegendMouseDown.bind(this);
this._onLegendMouseUp = this._onLegendMouseUp.bind(this);
this._createLegend();
});
};
-BarGraphWidget.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
+BarGraphWidget.prototype = extend(AbstractCanvasGraph.prototype, {
clipheadLineColor: GRAPH_CLIPHEAD_LINE_COLOR,
selectionLineColor: GRAPH_SELECTION_LINE_COLOR,
selectionBackgroundColor: GRAPH_SELECTION_BACKGROUND_COLOR,
selectionStripesColor: GRAPH_SELECTION_STRIPES_COLOR,
regionBackgroundColor: GRAPH_REGION_BACKGROUND_COLOR,
regionStripesColor: GRAPH_REGION_STRIPES_COLOR,
/**
--- a/devtools/client/shared/widgets/LineGraphWidget.js
+++ b/devtools/client/shared/widgets/LineGraphWidget.js
@@ -1,12 +1,12 @@
"use strict";
const { Task } = require("devtools/shared/task");
-const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const { AbstractCanvasGraph, CanvasGraphUtils } = require("devtools/client/shared/widgets/Graphs");
const { LocalizationHelper } = require("devtools/shared/l10n");
const HTML_NS = "http://www.w3.org/1999/xhtml";
const L10N = new LocalizationHelper("devtools/client/locales/graphs.properties");
// Line graph constants.
@@ -84,17 +84,17 @@ this.LineGraphWidget = function (parent,
);
this._avgGutterLine = this._createGutterLine("average");
this._avgTooltip = this._createTooltip(
"average", "end", L10N.getStr("graphs.label.average"), metric
);
});
};
-LineGraphWidget.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
+LineGraphWidget.prototype = extend(AbstractCanvasGraph.prototype, {
backgroundColor: GRAPH_BACKGROUND_COLOR,
backgroundGradientStart: GRAPH_BACKGROUND_GRADIENT_START,
backgroundGradientEnd: GRAPH_BACKGROUND_GRADIENT_END,
strokeColor: GRAPH_STROKE_COLOR,
strokeWidth: GRAPH_STROKE_WIDTH,
maximumLineColor: GRAPH_MAXIMUM_LINE_COLOR,
averageLineColor: GRAPH_AVERAGE_LINE_COLOR,
minimumLineColor: GRAPH_MINIMUM_LINE_COLOR,
--- a/devtools/client/shared/widgets/MountainGraphWidget.js
+++ b/devtools/client/shared/widgets/MountainGraphWidget.js
@@ -1,11 +1,11 @@
"use strict";
-const { Heritage } = require("devtools/client/shared/widgets/view-helpers");
+const { extend } = require("devtools/shared/extend");
const { AbstractCanvasGraph } = require("devtools/client/shared/widgets/Graphs");
// Bar graph constants.
const GRAPH_DAMPEN_VALUES_FACTOR = 0.9;
const GRAPH_BACKGROUND_COLOR = "#ddd";
const GRAPH_STROKE_WIDTH = 1; // px
@@ -52,17 +52,17 @@ const GRAPH_REGION_STRIPES_COLOR = "rgba
*
* @param nsIDOMNode parent
* The parent node holding the graph.
*/
this.MountainGraphWidget = function (parent, ...args) {
AbstractCanvasGraph.apply(this, [parent, "mountain-graph", ...args]);
};
-MountainGraphWidget.prototype = Heritage.extend(AbstractCanvasGraph.prototype, {
+MountainGraphWidget.prototype = extend(AbstractCanvasGraph.prototype, {
backgroundColor: GRAPH_BACKGROUND_COLOR,
strokeColor: GRAPH_STROKE_COLOR,
strokeWidth: GRAPH_STROKE_WIDTH,
clipheadLineColor: GRAPH_CLIPHEAD_LINE_COLOR,
selectionLineColor: GRAPH_SELECTION_LINE_COLOR,
selectionBackgroundColor: GRAPH_SELECTION_BACKGROUND_COLOR,
selectionStripesColor: GRAPH_SELECTION_STRIPES_COLOR,
regionBackgroundColor: GRAPH_REGION_BACKGROUND_COLOR,
--- a/devtools/client/shared/widgets/VariablesView.jsm
+++ b/devtools/client/shared/widgets/VariablesView.jsm
@@ -19,17 +19,18 @@ const ITEM_FLASH_DURATION = 300; // ms
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
const EventEmitter = require("devtools/shared/old-event-emitter");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const Services = require("Services");
const { getSourceNames } = require("devtools/client/shared/source-utils");
const promise = require("promise");
const defer = require("devtools/shared/defer");
-const { Heritage, ViewHelpers, setNamedTimeout } =
+const { extend } = require("devtools/shared/extend");
+const { ViewHelpers, setNamedTimeout } =
require("devtools/client/shared/widgets/view-helpers");
const { Task } = require("devtools/shared/task");
const nodeConstants = require("devtools/shared/dom-node-constants");
const {KeyCodes} = require("devtools/client/shared/keycodes");
const {PluralForm} = require("devtools/shared/plural-form");
const {LocalizationHelper, ELLIPSIS} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper(DBG_STRINGS_URI);
@@ -2174,17 +2175,17 @@ function Variable(aScope, aName, aDescri
delete aDescriptor.get;
delete aDescriptor.set;
}
Scope.call(this, aScope, aName, this._initialDescriptor = aDescriptor);
this.setGrip(aDescriptor.value);
}
-Variable.prototype = Heritage.extend(Scope.prototype, {
+Variable.prototype = extend(Scope.prototype, {
/**
* Whether this Variable should be prefetched when it is remoted.
*/
get shouldPrefetch() {
return this.name == "window" || this.name == "this";
},
/**
@@ -3067,17 +3068,17 @@ Variable.prototype = Heritage.extend(Sco
* The property's descriptor.
* @param object aOptions
* Options of the form accepted by Scope.addItem
*/
function Property(aVar, aName, aDescriptor, aOptions) {
Variable.call(this, aVar, aName, aDescriptor, aOptions);
}
-Property.prototype = Heritage.extend(Variable.prototype, {
+Property.prototype = extend(Variable.prototype, {
/**
* The class name applied to this property's target element.
*/
targetClassName: "variables-view-property variable-or-property",
/**
* @see Variable.symbolicName
* @return string
@@ -3155,17 +3156,17 @@ VariablesView.prototype.commitHierarchy
}
if (this.oncommit) {
this.oncommit(this);
}
};
// Some variables are likely to contain a very large number of properties.
// It would be a bad idea to re-expand them or perform expensive operations.
-VariablesView.prototype.commitHierarchyIgnoredItems = Heritage.extend(null, {
+VariablesView.prototype.commitHierarchyIgnoredItems = extend(null, {
"window": true,
"this": true
});
/**
* Checks if the an item was previously expanded, if it existed in a
* previous hierarchy.
*
@@ -4111,17 +4112,17 @@ Editable.prototype = {
* An Editable specific to editing the name of a Variable or Property.
*/
function EditableName(aVariable, aOptions) {
Editable.call(this, aVariable, aOptions);
}
EditableName.create = Editable.create;
-EditableName.prototype = Heritage.extend(Editable.prototype, {
+EditableName.prototype = extend(Editable.prototype, {
className: "element-name-input",
get label() {
return this._variable._name;
},
get shouldActivate() {
return !!this._variable.ownerView.switch;
@@ -4133,17 +4134,17 @@ EditableName.prototype = Heritage.extend
* An Editable specific to editing the value of a Variable or Property.
*/
function EditableValue(aVariable, aOptions) {
Editable.call(this, aVariable, aOptions);
}
EditableValue.create = Editable.create;
-EditableValue.prototype = Heritage.extend(Editable.prototype, {
+EditableValue.prototype = extend(Editable.prototype, {
className: "element-value-input",
get label() {
return this._variable._valueLabel;
},
get shouldActivate() {
return !!this._variable.ownerView.eval;
@@ -4155,17 +4156,17 @@ EditableValue.prototype = Heritage.exten
* An Editable specific to editing the key and value of a new property.
*/
function EditableNameAndValue(aVariable, aOptions) {
EditableName.call(this, aVariable, aOptions);
}
EditableNameAndValue.create = Editable.create;
-EditableNameAndValue.prototype = Heritage.extend(EditableName.prototype, {
+EditableNameAndValue.prototype = extend(EditableName.prototype, {
_reset: function (e) {
// Hide the Variable or Property if the user presses escape.
this._variable.remove();
this.deactivate();
},
_next: function (e) {
// Override _next so as to set both key and value at the same time.
--- a/devtools/client/shared/widgets/view-helpers.js
+++ b/devtools/client/shared/widgets/view-helpers.js
@@ -9,39 +9,16 @@ const {KeyCodes} = require("devtools/cli
const PANE_APPEARANCE_DELAY = 50;
const PAGE_SIZE_ITEM_COUNT_RATIO = 5;
const WIDGET_FOCUSABLE_NODES = new Set(["vbox", "hbox"]);
var namedTimeoutsStore = new Map();
/**
- * Inheritance helpers from the addon SDK's core/heritage.
- * Remove these when all devtools are loadered.
- */
-exports.Heritage = {
- /**
- * @see extend in sdk/core/heritage.
- */
- extend: function (prototype, properties = {}) {
- return Object.create(prototype, this.getOwnPropertyDescriptors(properties));
- },
-
- /**
- * @see getOwnPropertyDescriptors in sdk/core/heritage.
- */
- getOwnPropertyDescriptors: function (object) {
- return Object.getOwnPropertyNames(object).reduce((descriptor, name) => {
- descriptor[name] = Object.getOwnPropertyDescriptor(object, name);
- return descriptor;
- }, {});
- }
-};
-
-/**
* Helper for draining a rapid succession of events and invoking a callback
* once everything settles down.
*
* @param string id
* A string identifier for the named timeout.
* @param number wait
* The amount of milliseconds to wait after no more events are fired.
* @param function callback
@@ -485,17 +462,17 @@ Item.prototype = {
* Some generic Widget methods handling Item instances.
* Iterable via "for (let childItem of wrappedView) { }".
*
* Usage:
* function MyView() {
* this.widget = new MyWidget(document.querySelector(".my-node"));
* }
*
- * MyView.prototype = Heritage.extend(WidgetMethods, {
+ * MyView.prototype = extend(WidgetMethods, {
* myMethod: function() {},
* ...
* });
*
* See https://gist.github.com/victorporof/5749386 for more details.
* The devtools/shared/widgets/SimpleListWidget.jsm is an implementation
* example.
*