--- a/devtools/client/locales/en-US/webide.dtd
+++ b/devtools/client/locales/en-US/webide.dtd
@@ -31,18 +31,16 @@
<!ENTITY runtimeMenu_label "Runtime">
<!ENTITY runtimeMenu_accesskey "R">
<!ENTITY runtimeMenu_disconnect_label "Disconnect">
<!ENTITY runtimeMenu_disconnect_accesskey "D">
<!ENTITY runtimeMenu_takeScreenshot_label "Screenshot">
<!ENTITY runtimeMenu_takeScreenshot_accesskey "S">
<!ENTITY runtimeMenu_showDetails_label "Runtime Info">
<!ENTITY runtimeMenu_showDetails_accesskey "E">
-<!ENTITY runtimeMenu_showMonitor_label "Monitor">
-<!ENTITY runtimeMenu_showMonitor_accesskey "M">
<!ENTITY runtimeMenu_showDevicePrefs_label "Device Preferences">
<!ENTITY runtimeMenu_showDevicePrefs_accesskey "D">
<!ENTITY runtimeMenu_showSettings_label "Device Settings">
<!ENTITY runtimeMenu_showSettings_accesskey "s">
<!ENTITY viewMenu_label "View">
<!ENTITY viewMenu_accesskey "V">
<!ENTITY viewMenu_zoomin_label "Zoom In">
@@ -142,20 +140,16 @@
<!-- Device Settings -->
<!ENTITY devicesetting_title "Device Settings">
<!ENTITY devicesetting_search "Search settings">
<!ENTITY devicesetting_newname "New setting name">
<!ENTITY devicesetting_newtext "Setting value">
<!ENTITY devicesetting_addnew "Add new setting">
-<!-- Monitor -->
-<!ENTITY monitor_title "Monitor">
-<!ENTITY monitor_help "Help">
-
<!-- WiFi Authentication -->
<!-- LOCALIZATION NOTE (wifi_auth_header): The header displayed on the dialog
that instructs the user to transfer an authentication token to the
server. -->
<!ENTITY wifi_auth_header "Client Identification">
<!-- LOCALIZATION NOTE (wifi_auth_scan_request): Instructions requesting the
user to transfer authentication info by scanning a QR code. -->
<!ENTITY wifi_auth_scan_request "The endpoint you are connecting to needs more information to authenticate this connection. Please scan the QR code below via the prompt on your other device.">
--- a/devtools/client/webide/content/jar.mn
+++ b/devtools/client/webide/content/jar.mn
@@ -11,18 +11,16 @@ webide.jar:
content/details.xhtml (details.xhtml)
content/details.js (details.js)
content/addons.js (addons.js)
content/addons.xhtml (addons.xhtml)
content/runtimedetails.js (runtimedetails.js)
content/runtimedetails.xhtml (runtimedetails.xhtml)
content/prefs.js (prefs.js)
content/prefs.xhtml (prefs.xhtml)
- content/monitor.xhtml (monitor.xhtml)
- content/monitor.js (monitor.js)
content/devicepreferences.js (devicepreferences.js)
content/devicepreferences.xhtml (devicepreferences.xhtml)
content/wifi-auth.js (wifi-auth.js)
content/wifi-auth.xhtml (wifi-auth.xhtml)
content/project-listing.xhtml (project-listing.xhtml)
content/project-listing.js (project-listing.js)
content/project-panel.js (project-panel.js)
content/runtime-panel.js (runtime-panel.js)
deleted file mode 100644
--- a/devtools/client/webide/content/monitor.js
+++ /dev/null
@@ -1,739 +0,0 @@
-/* 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/. */
-
-const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
-const Services = require("Services");
-const {AppManager} = require("devtools/client/webide/modules/app-manager");
-const {AppActorFront} = require("devtools/shared/apps/app-actor-front");
-const {Connection} = require("devtools/shared/client/connection-manager");
-const EventEmitter = require("devtools/shared/old-event-emitter");
-
-window.addEventListener("load", function () {
- window.addEventListener("resize", Monitor.resize);
- window.addEventListener("unload", Monitor.unload);
-
- document.querySelector("#close").onclick = () => {
- window.parent.UI.openProject();
- };
-
- Monitor.load();
-}, {once: true});
-
-
-/**
- * The Monitor is a WebIDE tool used to display any kind of time-based data in
- * the form of graphs.
- *
- * The data can come from a Firefox OS device, or from a WebSockets
- * server running locally.
- *
- * The format of a data update is typically an object like:
- *
- * { graph: 'mygraph', curve: 'mycurve', value: 42, time: 1234 }
- *
- * or an array of such objects. For more details on the data format, see the
- * `Graph.update(data)` method.
- */
-var Monitor = {
-
- apps: new Map(),
- graphs: new Map(),
- front: null,
- socket: null,
- wstimeout: null,
- b2ginfo: false,
- b2gtimeout: null,
-
- /**
- * Add new data to the graphs, create a new graph if necessary.
- */
- update: function (data, fallback) {
- if (Array.isArray(data)) {
- data.forEach(d => Monitor.update(d, fallback));
- return;
- }
-
- if (Monitor.b2ginfo && data.graph === "USS") {
- // If we're polling b2g-info, ignore USS updates from the device's
- // USSAgents (see Monitor.pollB2GInfo()).
- return;
- }
-
- if (fallback) {
- for (let key in fallback) {
- if (!data[key]) {
- data[key] = fallback[key];
- }
- }
- }
-
- let graph = Monitor.graphs.get(data.graph);
- if (!graph) {
- let element = document.createElement("div");
- element.classList.add("graph");
- document.body.appendChild(element);
-
- graph = new Graph(data.graph, element);
- Monitor.resize(); // a scrollbar might have dis/reappeared
- Monitor.graphs.set(data.graph, graph);
- }
- graph.update(data);
- },
-
- /**
- * Initialize the Monitor.
- */
- load: function () {
- AppManager.on("app-manager-update", Monitor.onAppManagerUpdate);
- Monitor.connectToRuntime();
- Monitor.connectToWebSocket();
- },
-
- /**
- * Clean up the Monitor.
- */
- unload: function () {
- AppManager.off("app-manager-update", Monitor.onAppManagerUpdate);
- Monitor.disconnectFromRuntime();
- Monitor.disconnectFromWebSocket();
- },
-
- /**
- * Resize all the graphs.
- */
- resize: function () {
- for (let graph of Monitor.graphs.values()) {
- graph.resize();
- }
- },
-
- /**
- * When WebIDE connects to a new runtime, start its data forwarders.
- */
- onAppManagerUpdate: function (event, what, details) {
- switch (what) {
- case "runtime-global-actors":
- Monitor.connectToRuntime();
- break;
- case "connection":
- if (AppManager.connection.status == Connection.Status.DISCONNECTED) {
- Monitor.disconnectFromRuntime();
- }
- break;
- }
- },
-
- /**
- * Use an AppActorFront on a runtime to watch track its apps.
- */
- connectToRuntime: function () {
- Monitor.pollB2GInfo();
- let client = AppManager.connection && AppManager.connection.client;
- let resp = AppManager._listTabsResponse;
- if (client && resp && !Monitor.front) {
- Monitor.front = new AppActorFront(client, resp);
- Monitor.front.watchApps(Monitor.onRuntimeAppEvent);
- }
- },
-
- /**
- * Destroy our AppActorFront.
- */
- disconnectFromRuntime: function () {
- Monitor.unpollB2GInfo();
- if (Monitor.front) {
- Monitor.front.unwatchApps(Monitor.onRuntimeAppEvent);
- Monitor.front = null;
- }
- },
-
- /**
- * Try connecting to a local websockets server and accept updates from it.
- */
- connectToWebSocket: function () {
- let webSocketURL = Services.prefs.getCharPref("devtools.webide.monitorWebSocketURL");
- try {
- Monitor.socket = new WebSocket(webSocketURL);
- Monitor.socket.onmessage = function (event) {
- Monitor.update(JSON.parse(event.data));
- };
- Monitor.socket.onclose = function () {
- Monitor.wstimeout = setTimeout(Monitor.connectToWebsocket, 1000);
- };
- } catch (e) {
- Monitor.wstimeout = setTimeout(Monitor.connectToWebsocket, 1000);
- }
- },
-
- /**
- * Used when cleaning up.
- */
- disconnectFromWebSocket: function () {
- clearTimeout(Monitor.wstimeout);
- if (Monitor.socket) {
- Monitor.socket.onclose = () => {};
- Monitor.socket.close();
- }
- },
-
- /**
- * When an app starts on the runtime, start a monitor actor for its process.
- */
- onRuntimeAppEvent: function (type, app) {
- if (type !== "appOpen" && type !== "appClose") {
- return;
- }
-
- let client = AppManager.connection.client;
- app.getForm().then(form => {
- if (type === "appOpen") {
- app.monitorClient = new MonitorClient(client, form);
- app.monitorClient.start();
- app.monitorClient.on("update", Monitor.onRuntimeUpdate);
- Monitor.apps.set(form.monitorActor, app);
- } else {
- let app = Monitor.apps.get(form.monitorActor);
- if (app) {
- app.monitorClient.stop(() => app.monitorClient.destroy());
- Monitor.apps.delete(form.monitorActor);
- }
- }
- });
- },
-
- /**
- * Accept data updates from the monitor actors of a runtime.
- */
- onRuntimeUpdate: function (type, packet) {
- let fallback = {}, app = Monitor.apps.get(packet.from);
- if (app) {
- fallback.curve = app.manifest.name;
- }
- Monitor.update(packet.data, fallback);
- },
-
- /**
- * Bug 1047355: If possible, parsing the output of `b2g-info` has several
- * benefits over bug 1037465's multi-process USSAgent approach, notably:
- * - Works for older Firefox OS devices (pre-2.1),
- * - Doesn't need certified-apps debugging,
- * - Polling time is synchronized for all processes.
- * TODO: After bug 1043324 lands, consider removing this hack.
- */
- pollB2GInfo: function () {
- if (AppManager.selectedRuntime) {
- let device = AppManager.selectedRuntime.device;
- if (device && device.shell) {
- device.shell("b2g-info").then(s => {
- let lines = s.split("\n");
- let line = "";
-
- // Find the header row to locate NAME and USS, looks like:
- // ' NAME PID NICE USS PSS RSS VSIZE OOM_ADJ USER '.
- while (!line.includes("NAME")) {
- if (lines.length < 1) {
- // Something is wrong with this output, don't trust b2g-info.
- Monitor.unpollB2GInfo();
- return;
- }
- line = lines.shift();
- }
- let namelength = line.indexOf("NAME") + "NAME".length;
- let ussindex = line.slice(namelength).split(/\s+/).indexOf("USS");
-
- // Get the NAME and USS in each following line, looks like:
- // 'Homescreen 375 18 12.6 16.3 27.1 67.8 4 app_375'.
- while (lines.length > 0 && lines[0].length > namelength) {
- line = lines.shift();
- let name = line.slice(0, namelength);
- let uss = line.slice(namelength).split(/\s+/)[ussindex];
- Monitor.update({
- curve: name.trim(),
- value: 1024 * 1024 * parseFloat(uss) // Convert MB to bytes.
- }, {
- // Note: We use the fallback object to set the graph name to 'USS'
- // so that Monitor.update() can ignore USSAgent updates.
- graph: "USS"
- });
- }
- });
- }
- }
- Monitor.b2ginfo = true;
- Monitor.b2gtimeout = setTimeout(Monitor.pollB2GInfo, 350);
- },
-
- /**
- * Polling b2g-info doesn't work or is no longer needed.
- */
- unpollB2GInfo: function () {
- clearTimeout(Monitor.b2gtimeout);
- Monitor.b2ginfo = false;
- }
-
-};
-
-
-/**
- * A MonitorClient is used as an actor client of a runtime's monitor actors,
- * receiving its updates.
- */
-function MonitorClient(client, form) {
- this.client = client;
- this.actor = form.monitorActor;
- this.events = ["update"];
-
- EventEmitter.decorate(this);
- this.client.registerClient(this);
-}
-MonitorClient.prototype.destroy = function () {
- this.client.unregisterClient(this);
-};
-MonitorClient.prototype.start = function () {
- this.client.request({
- to: this.actor,
- type: "start"
- });
-};
-MonitorClient.prototype.stop = function (callback) {
- this.client.request({
- to: this.actor,
- type: "stop"
- }, callback);
-};
-
-
-/**
- * A Graph populates a container DOM element with an SVG graph and a legend.
- */
-function Graph(name, element) {
- this.name = name;
- this.element = element;
- this.curves = new Map();
- this.events = new Map();
- this.ignored = new Set();
- this.enabled = true;
- this.request = null;
-
- this.x = d3.time.scale();
- this.y = d3.scale.linear();
-
- this.xaxis = d3.svg.axis().scale(this.x).orient("bottom");
- this.yaxis = d3.svg.axis().scale(this.y).orient("left");
-
- this.xformat = d3.time.format("%I:%M:%S");
- this.yformat = this.formatter(1);
- this.yaxis.tickFormat(this.formatter(0));
-
- this.line = d3.svg.line().interpolate("linear")
- .x(function (d) { return this.x(d.time); })
- .y(function (d) { return this.y(d.value); });
-
- this.color = d3.scale.category10();
-
- this.svg = d3.select(element).append("svg").append("g")
- .attr("transform", "translate(" + this.margin.left + "," + this.margin.top + ")");
-
- this.xelement = this.svg.append("g").attr("class", "x axis").call(this.xaxis);
- this.yelement = this.svg.append("g").attr("class", "y axis").call(this.yaxis);
-
- // RULERS on axes
- let xruler = this.xruler = this.svg.select(".x.axis").append("g").attr("class", "x ruler");
- xruler.append("line").attr("y2", 6);
- xruler.append("line").attr("stroke-dasharray", "1,1");
- xruler.append("text").attr("y", 9).attr("dy", ".71em");
-
- let yruler = this.yruler = this.svg.select(".y.axis").append("g").attr("class", "y ruler");
- yruler.append("line").attr("x2", -6);
- yruler.append("line").attr("stroke-dasharray", "1,1");
- yruler.append("text").attr("x", -9).attr("dy", ".32em");
-
- let self = this;
-
- d3.select(element).select("svg")
- .on("mousemove", function () {
- let mouse = d3.mouse(this);
- self.mousex = mouse[0] - self.margin.left,
- self.mousey = mouse[1] - self.margin.top;
-
- xruler.attr("transform", "translate(" + self.mousex + ",0)");
- yruler.attr("transform", "translate(0," + self.mousey + ")");
- });
- /* .on('mouseout', function() {
- self.xruler.attr('transform', 'translate(-500,0)');
- self.yruler.attr('transform', 'translate(0,-500)');
- });*/
- this.mousex = this.mousey = -500;
-
- let sidebar = d3.select(this.element).append("div").attr("class", "sidebar");
- let title = sidebar.append("label").attr("class", "graph-title");
-
- title.append("input")
- .attr("type", "checkbox")
- .attr("checked", "true")
- .on("click", function () { self.toggle(); });
- title.append("span").text(this.name);
-
- this.legend = sidebar.append("div").attr("class", "legend");
-
- this.resize = this.resize.bind(this);
- this.render = this.render.bind(this);
- this.averages = this.averages.bind(this);
-
- setInterval(this.averages, 1000);
-
- this.resize();
-}
-
-Graph.prototype = {
-
- /**
- * These margin are used to properly position the SVG graph items inside the
- * container element.
- */
- margin: {
- top: 10,
- right: 150,
- bottom: 20,
- left: 50
- },
-
- /**
- * A Graph can be collapsed by the user.
- */
- toggle: function () {
- if (this.enabled) {
- this.element.classList.add("disabled");
- this.enabled = false;
- } else {
- this.element.classList.remove("disabled");
- this.enabled = true;
- }
- Monitor.resize();
- },
-
- /**
- * If the container element is resized (e.g. because the window was resized or
- * a scrollbar dis/appeared), the graph needs to be resized as well.
- */
- resize: function () {
- let style = getComputedStyle(this.element),
- height = parseFloat(style.height) - this.margin.top - this.margin.bottom,
- width = parseFloat(style.width) - this.margin.left - this.margin.right;
-
- d3.select(this.element).select("svg")
- .attr("width", width + this.margin.left)
- .attr("height", height + this.margin.top + this.margin.bottom);
-
- this.x.range([0, width]);
- this.y.range([height, 0]);
-
- this.xelement.attr("transform", "translate(0," + height + ")");
- this.xruler.select("line[stroke-dasharray]").attr("y2", -height);
- this.yruler.select("line[stroke-dasharray]").attr("x2", width);
- },
-
- /**
- * If the domain of the Graph's data changes (on the time axis and/or on the
- * value axis), the axes' domains need to be updated and the graph items need
- * to be rescaled in order to represent all the data.
- */
- rescale: function () {
- let gettime = v => { return v.time; },
- getvalue = v => { return v.value; },
- ignored = c => { return this.ignored.has(c.id); };
-
- let xmin = null, xmax = null, ymin = null, ymax = null;
- for (let curve of this.curves.values()) {
- if (ignored(curve)) {
- continue;
- }
- if (xmax == null || curve.xmax > xmax) {
- xmax = curve.xmax;
- }
- if (xmin == null || curve.xmin < xmin) {
- xmin = curve.xmin;
- }
- if (ymax == null || curve.ymax > ymax) {
- ymax = curve.ymax;
- }
- if (ymin == null || curve.ymin < ymin) {
- ymin = curve.ymin;
- }
- }
- for (let event of this.events.values()) {
- if (ignored(event)) {
- continue;
- }
- if (xmax == null || event.xmax > xmax) {
- xmax = event.xmax;
- }
- if (xmin == null || event.xmin < xmin) {
- xmin = event.xmin;
- }
- }
-
- let oldxdomain = this.x.domain();
- if (xmin != null && xmax != null) {
- this.x.domain([xmin, xmax]);
- let newxdomain = this.x.domain();
- if (newxdomain[0] !== oldxdomain[0] || newxdomain[1] !== oldxdomain[1]) {
- this.xelement.call(this.xaxis);
- }
- }
-
- let oldydomain = this.y.domain();
- if (ymin != null && ymax != null) {
- this.y.domain([ymin, ymax]).nice();
- let newydomain = this.y.domain();
- if (newydomain[0] !== oldydomain[0] || newydomain[1] !== oldydomain[1]) {
- this.yelement.call(this.yaxis);
- }
- }
- },
-
- /**
- * Add new values to the graph.
- */
- update: function (data) {
- delete data.graph;
-
- let time = data.time || Date.now();
- delete data.time;
-
- let curve = data.curve;
- delete data.curve;
-
- // Single curve value, e.g. { curve: 'memory', value: 42, time: 1234 }.
- if ("value" in data) {
- this.push(this.curves, curve, [{time: time, value: data.value}]);
- delete data.value;
- }
-
- // Several curve values, e.g. { curve: 'memory', values: [{value: 42, time: 1234}] }.
- if ("values" in data) {
- this.push(this.curves, curve, data.values);
- delete data.values;
- }
-
- // Punctual event, e.g. { event: 'gc', time: 1234 },
- // event with duration, e.g. { event: 'jank', duration: 425, time: 1234 }.
- if ("event" in data) {
- this.push(this.events, data.event, [{time: time, value: data.duration}]);
- delete data.event;
- delete data.duration;
- }
-
- // Remaining keys are curves, e.g. { time: 1234, memory: 42, battery: 13, temperature: 45 }.
- for (let key in data) {
- this.push(this.curves, key, [{time: time, value: data[key]}]);
- }
-
- // If no render is currently pending, request one.
- if (this.enabled && !this.request) {
- this.request = requestAnimationFrame(this.render);
- }
- },
-
- /**
- * Insert new data into the graph's data structures.
- */
- push: function (collection, id, values) {
-
- // Note: collection is either `this.curves` or `this.events`.
- let item = collection.get(id);
- if (!item) {
- item = { id: id, values: [], xmin: null, xmax: null, ymin: 0, ymax: null, average: 0 };
- collection.set(id, item);
- }
-
- for (let v of values) {
- let time = new Date(v.time), value = +v.value;
- // Update the curve/event's domain values.
- if (item.xmax == null || time > item.xmax) {
- item.xmax = time;
- }
- if (item.xmin == null || time < item.xmin) {
- item.xmin = time;
- }
- if (item.ymax == null || value > item.ymax) {
- item.ymax = value;
- }
- if (item.ymin == null || value < item.ymin) {
- item.ymin = value;
- }
- // Note: A curve's average is not computed here. Call `graph.averages()`.
- item.values.push({ time: time, value: value });
- }
- },
-
- /**
- * Render the SVG graph with curves, events, crosshair and legend.
- */
- render: function () {
- this.request = null;
- this.rescale();
-
-
- // DATA
-
- let self = this,
- getid = d => { return d.id; },
- gettime = d => { return d.time.getTime(); },
- getline = d => { return self.line(d.values); },
- getcolor = d => { return self.color(d.id); },
- getvalues = d => { return d.values; },
- ignored = d => { return self.ignored.has(d.id); };
-
- // Convert our maps to arrays for d3.
- let curvedata = [...this.curves.values()],
- eventdata = [...this.events.values()],
- data = curvedata.concat(eventdata);
-
-
- // CURVES
-
- // Map curve data to curve elements.
- let curves = this.svg.selectAll(".curve").data(curvedata, getid);
-
- // Create new curves (no element corresponding to the data).
- curves.enter().append("g").attr("class", "curve").append("path")
- .style("stroke", getcolor);
-
- // Delete old curves (elements corresponding to data not present anymore).
- curves.exit().remove();
-
- // Update all curves from data.
- this.svg.selectAll(".curve").select("path")
- .attr("d", d => { return ignored(d) ? "" : getline(d); });
-
- let height = parseFloat(getComputedStyle(this.element).height) - this.margin.top - this.margin.bottom;
-
-
- // EVENTS
-
- // Map event data to event elements.
- let events = this.svg.selectAll(".event-slot").data(eventdata, getid);
-
- // Create new events.
- events.enter().append("g").attr("class", "event-slot");
-
- // Remove old events.
- events.exit().remove();
-
- // Get all occurences of an event, and map its data to them.
- let lines = this.svg.selectAll(".event-slot")
- .style("stroke", d => { return ignored(d) ? "none" : getcolor(d); })
- .selectAll(".event")
- .data(getvalues, gettime);
-
- // Create new event occurrence.
- lines.enter().append("line").attr("class", "event").attr("y2", height);
-
- // Delete old event occurrence.
- lines.exit().remove();
-
- // Update all event occurrences from data.
- this.svg.selectAll(".event")
- .attr("transform", d => { return "translate(" + self.x(d.time) + ",0)"; });
-
-
- // CROSSHAIR
-
- // TODO select curves and events, intersect with curves and show values/hovers
- // e.g. look like http://code.shutterstock.com/rickshaw/examples/lines.html
-
- // Update crosshair labels on each axis.
- this.xruler.select("text").text(self.xformat(self.x.invert(self.mousex)));
- this.yruler.select("text").text(self.yformat(self.y.invert(self.mousey)));
-
-
- // LEGEND
-
- // Map data to legend elements.
- let legends = this.legend.selectAll("label").data(data, getid);
-
- // Update averages.
- legends.attr("title", c => { return "Average: " + self.yformat(c.average); });
-
- // Create new legends.
- let newlegend = legends.enter().append("label");
- newlegend.append("input").attr("type", "checkbox").attr("checked", "true").on("click", function (c) {
- if (ignored(c)) {
- this.parentElement.classList.remove("disabled");
- self.ignored.delete(c.id);
- } else {
- this.parentElement.classList.add("disabled");
- self.ignored.add(c.id);
- }
- self.update({}); // if no re-render is pending, request one.
- });
- newlegend.append("span").attr("class", "legend-color").style("background-color", getcolor);
- newlegend.append("span").attr("class", "legend-id").text(getid);
-
- // Delete old legends.
- legends.exit().remove();
- },
-
- /**
- * Returns a SI value formatter with a given precision.
- */
- formatter: function (decimals) {
- return value => {
- // Don't use sub-unit SI prefixes (milli, micro, etc.).
- if (Math.abs(value) < 1) return value.toFixed(decimals);
- // SI prefix, e.g. 1234567 will give '1.2M' at precision 1.
- let prefix = d3.formatPrefix(value);
- return prefix.scale(value).toFixed(decimals) + prefix.symbol;
- };
- },
-
- /**
- * Compute the average of each time series.
- */
- averages: function () {
- for (let c of this.curves.values()) {
- let length = c.values.length;
- if (length > 0) {
- let total = 0;
- c.values.forEach(v => total += v.value);
- c.average = (total / length);
- }
- }
- },
-
- /**
- * Bisect a time serie to find the data point immediately left of `time`.
- */
- bisectTime: d3.bisector(d => d.time).left,
-
- /**
- * Get all curve values at a given time.
- */
- valuesAt: function (time) {
- let values = { time: time };
-
- for (let id of this.curves.keys()) {
- let curve = this.curves.get(id);
-
- // Find the closest value just before `time`.
- let i = this.bisectTime(curve.values, time);
- if (i < 0) {
- // Curve starts after `time`, use first value.
- values[id] = curve.values[0].value;
- } else if (i > curve.values.length - 2) {
- // Curve ends before `time`, use last value.
- values[id] = curve.values[curve.values.length - 1].value;
- } else {
- // Curve has two values around `time`, interpolate.
- let v1 = curve.values[i],
- v2 = curve.values[i + 1],
- delta = (time - v1.time) / (v2.time - v1.time);
- values[id] = v1.value + (v2.value - v1.time) * delta;
- }
- }
- return values;
- }
-
-};
deleted file mode 100644
--- a/devtools/client/webide/content/monitor.xhtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- 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/. -->
-
-<!DOCTYPE html [
- <!ENTITY % webideDTD SYSTEM "chrome://devtools/locale/webide.dtd" >
- %webideDTD;
-]>
-
-
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="utf8"/>
- <link rel="stylesheet" href="chrome://webide/skin/deck.css" type="text/css"/>
- <link rel="stylesheet" href="chrome://webide/skin/monitor.css" type="text/css"/>
- <script src="chrome://devtools/content/shared/vendor/d3.js"></script>
- <script type="application/javascript" src="monitor.js"></script>
- </head>
- <body>
-
- <div id="controls">
- <a href="https://developer.mozilla.org/docs/Tools/WebIDE/Monitor" target="_blank">&monitor_help;</a>
- <a id="close">&deck_close;</a>
- </div>
-
- <h1>&monitor_title;</h1>
-
- </body>
-</html>
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -384,35 +384,32 @@ var UI = {
playCmd.removeAttribute("disabled");
} else {
playCmd.setAttribute("disabled", "true");
}
}
}
// Runtime commands
- let monitorCmd = document.querySelector("#cmd_showMonitor");
let screenshotCmd = document.querySelector("#cmd_takeScreenshot");
let detailsCmd = document.querySelector("#cmd_showRuntimeDetails");
let disconnectCmd = document.querySelector("#cmd_disconnectRuntime");
let devicePrefsCmd = document.querySelector("#cmd_showDevicePrefs");
let settingsCmd = document.querySelector("#cmd_showSettings");
if (AppManager.connected) {
if (AppManager.deviceFront) {
- monitorCmd.removeAttribute("disabled");
detailsCmd.removeAttribute("disabled");
screenshotCmd.removeAttribute("disabled");
}
if (AppManager.preferenceFront) {
devicePrefsCmd.removeAttribute("disabled");
}
disconnectCmd.removeAttribute("disabled");
} else {
- monitorCmd.setAttribute("disabled", "true");
detailsCmd.setAttribute("disabled", "true");
screenshotCmd.setAttribute("disabled", "true");
disconnectCmd.setAttribute("disabled", "true");
devicePrefsCmd.setAttribute("disabled", "true");
settingsCmd.setAttribute("disabled", "true");
}
let runtimePanelButton = document.querySelector("#runtime-panel-button");
@@ -886,20 +883,16 @@ var Cmds = {
showRuntimeDetails: function () {
UI.selectDeckPanel("runtimedetails");
},
showDevicePrefs: function () {
UI.selectDeckPanel("devicepreferences");
},
- showMonitor: function () {
- UI.selectDeckPanel("monitor");
- },
-
play: Task.async(function* () {
let busy;
switch (AppManager.selectedProject.type) {
case "packaged":
busy = UI.busyWithProgressUntil(AppManager.installAndRunProject(),
"installing and running app");
break;
case "hosted":
--- a/devtools/client/webide/content/webide.xul
+++ b/devtools/client/webide/content/webide.xul
@@ -39,17 +39,16 @@
<command id="cmd_importPackagedApp" oncommand="Cmds.importPackagedApp()" label="&projectMenu_importPackagedApp_label;"/>
<command id="cmd_importHostedApp" oncommand="Cmds.importHostedApp()" label="&projectMenu_importHostedApp_label;"/>
<command id="cmd_showDevicePrefs" label="&runtimeMenu_showDevicePrefs_label;" oncommand="Cmds.showDevicePrefs()"/>
<command id="cmd_showSettings" label="&runtimeMenu_showSettings_label;" oncommand="Cmds.showSettings()"/>
<command id="cmd_removeProject" oncommand="Cmds.removeProject()" label="&projectMenu_remove_label;"/>
<command id="cmd_showProjectPanel" oncommand="Cmds.showProjectPanel()"/>
<command id="cmd_showRuntimePanel" oncommand="Cmds.showRuntimePanel()"/>
<command id="cmd_disconnectRuntime" oncommand="Cmds.disconnectRuntime()" label="&runtimeMenu_disconnect_label;"/>
- <command id="cmd_showMonitor" oncommand="Cmds.showMonitor()" label="&runtimeMenu_showMonitor_label;"/>
<command id="cmd_showRuntimeDetails" oncommand="Cmds.showRuntimeDetails()" label="&runtimeMenu_showDetails_label;"/>
<command id="cmd_takeScreenshot" oncommand="Cmds.takeScreenshot()" label="&runtimeMenu_takeScreenshot_label;"/>
<command id="cmd_showAddons" oncommand="Cmds.showAddons()"/>
<command id="cmd_showPrefs" oncommand="Cmds.showPrefs()"/>
<command id="cmd_showTroubleShooting" oncommand="Cmds.showTroubleShooting()"/>
<command id="cmd_play" oncommand="Cmds.play()"/>
<command id="cmd_stop" oncommand="Cmds.stop()" label="&projectMenu_stop_label;"/>
<command id="cmd_toggleToolbox" oncommand="Cmds.toggleToolbox()"/>
@@ -75,17 +74,16 @@
<menuseparator/>
<menuitem command="cmd_showPrefs" label="&projectMenu_showPrefs_label;" accesskey="&projectMenu_showPrefs_accesskey;"/>
<menuitem command="cmd_showAddons" label="&projectMenu_manageComponents_label;" accesskey="&projectMenu_manageComponents_accesskey;"/>
</menupopup>
</menu>
<menu id="menu-runtime" label="&runtimeMenu_label;" accesskey="&runtimeMenu_accesskey;">
<menupopup id="menu-runtime-popup">
- <menuitem command="cmd_showMonitor" accesskey="&runtimeMenu_showMonitor_accesskey;"/>
<menuitem command="cmd_takeScreenshot" accesskey="&runtimeMenu_takeScreenshot_accesskey;"/>
<menuitem command="cmd_showRuntimeDetails" accesskey="&runtimeMenu_showDetails_accesskey;"/>
<menuitem command="cmd_showDevicePrefs" accesskey="&runtimeMenu_showDevicePrefs_accesskey;"/>
<menuitem command="cmd_showSettings" accesskey="&runtimeMenu_showSettings_accesskey;"/>
<menuseparator/>
<menuitem command="cmd_disconnectRuntime" accesskey="&runtimeMenu_disconnect_accesskey;"/>
</menupopup>
</menu>
@@ -146,17 +144,16 @@
</div>
</vbox>
<splitter class="devtools-side-splitter" id="project-listing-splitter"/>
<deck flex="1" id="deck" selectedIndex="-1">
<iframe id="deck-panel-details" flex="1" src="details.xhtml"/>
<iframe id="deck-panel-addons" flex="1" src="addons.xhtml"/>
<iframe id="deck-panel-prefs" flex="1" src="prefs.xhtml"/>
<iframe id="deck-panel-runtimedetails" flex="1" lazysrc="runtimedetails.xhtml"/>
- <iframe id="deck-panel-monitor" flex="1" lazysrc="monitor.xhtml"/>
<iframe id="deck-panel-devicepreferences" flex="1" lazysrc="devicepreferences.xhtml"/>
</deck>
<splitter class="devtools-side-splitter" id="runtime-listing-splitter"/>
<vbox id="runtime-listing-panel" class="runtime-listing panel-list" flex="1">
<div id="runtime-listing-wrapper" class="panel-list-wrapper">
<iframe id="runtime-listing-panel-details" flex="1" src="runtime-listing.xhtml" tooltip="aHTMLTooltip"/>
</div>
</vbox>
--- a/devtools/client/webide/themes/jar.mn
+++ b/devtools/client/webide/themes/jar.mn
@@ -7,15 +7,14 @@ webide.jar:
* skin/webide.css (webide.css)
skin/icons.png (icons.png)
skin/details.css (details.css)
skin/newapp.css (newapp.css)
skin/throbber.svg (throbber.svg)
skin/deck.css (deck.css)
skin/addons.css (addons.css)
skin/runtimedetails.css (runtimedetails.css)
- skin/monitor.css (monitor.css)
skin/config-view.css (config-view.css)
skin/wifi-auth.css (wifi-auth.css)
skin/panel-listing.css (panel-listing.css)
skin/rocket.svg (rocket.svg)
skin/noise.png (noise.png)
skin/default-app-icon.png (default-app-icon.png)
deleted file mode 100644
--- a/devtools/client/webide/themes/monitor.css
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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/. */
-
-/* Graph */
-.graph {
- height: 500px;
- width: 100%;
- padding-top: 20px;
- padding-bottom: 20px;
- margin-bottom: 30px;
- background-color: white;
-}
-.graph > svg, .sidebar {
- display: inline-block;
- vertical-align: top;
-}
-.disabled {
- opacity: 0.5;
-}
-.graph.disabled {
- height: 30px;
-}
-.graph.disabled > svg {
- visibility: hidden;
-}
-.curve path, .event-slot line {
- fill: none;
- stroke-width: 1.5px;
-}
-.axis line {
- fill: none;
- stroke: #000;
- shape-rendering: crispEdges;
-}
-.axis path {
- fill: none;
- stroke: black;
- stroke-width: 1px;
- shape-rendering: crispEdges;
-}
-.tick text, .x.ruler text, .y.ruler text {
- font-size: 0.9em;
-}
-.x.ruler text {
- text-anchor: middle;
-}
-.y.ruler text {
- text-anchor: end;
-}
-
-/* Sidebar */
-.sidebar {
- width: 150px;
- overflow-x: hidden;
-}
-.sidebar label {
- cursor: pointer;
- display: block;
-}
-.sidebar span:not(.color) {
- vertical-align: 13%;
-}
-.sidebar input {
- visibility: hidden;
-}
-.sidebar input:hover {
- visibility: visible;
-}
-.graph-title {
- margin-top: 5px;
- font-size: 1.2em;
-}
-.legend-color {
- display: inline-block;
- height: 10px;
- width: 10px;
- margin-left: 1px;
- margin-right: 3px;
-}
-.legend-id {
- font-size: .9em;
-}
-.graph.disabled > .sidebar > .legend {
- display: none;
-}
--- a/devtools/client/webide/webide-prefs.js
+++ b/devtools/client/webide/webide-prefs.js
@@ -4,13 +4,12 @@
pref("devtools.webide.templatesURL", "https://code.cdn.mozilla.net/templates/list.json");
pref("devtools.webide.autoinstallADBHelper", true);
pref("devtools.webide.autoConnectRuntime", true);
pref("devtools.webide.restoreLastProject", true);
pref("devtools.webide.enableLocalRuntime", false);
pref("devtools.webide.adbAddonURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/adb-helper/#OS#/adbhelper-#OS#-latest.xpi");
pref("devtools.webide.adbAddonID", "adbhelper@mozilla.org");
-pref("devtools.webide.monitorWebSocketURL", "ws://localhost:9000");
pref("devtools.webide.lastConnectedRuntime", "");
pref("devtools.webide.lastSelectedProject", "");
pref("devtools.webide.zoom", "1");
pref("devtools.webide.busyTimeout", 10000);
deleted file mode 100644
--- a/devtools/server/actors/monitor.js
+++ /dev/null
@@ -1,147 +0,0 @@
-/* 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";
-
-const {Ci, Cc} = require("chrome");
-const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
-const Services = require("Services");
-
-function MonitorActor(connection) {
- this.conn = connection;
- this._updates = [];
- this._started = false;
-}
-
-MonitorActor.prototype = {
- actorPrefix: "monitor",
-
- // Updates.
-
- _sendUpdate: function () {
- if (this._started) {
- this.conn.sendActorEvent(this.actorID, "update", { data: this._updates });
- this._updates = [];
- }
- },
-
- // Methods available from the front.
-
- start: function () {
- if (!this._started) {
- this._started = true;
- Services.obs.addObserver(this, "devtools-monitor-update");
- Services.obs.notifyObservers(null, "devtools-monitor-start");
- this._agents.forEach(agent => this._startAgent(agent));
- }
- return {};
- },
-
- stop: function () {
- if (this._started) {
- this._agents.forEach(agent => agent.stop());
- Services.obs.notifyObservers(null, "devtools-monitor-stop");
- Services.obs.removeObserver(this, "devtools-monitor-update");
- this._started = false;
- }
- return {};
- },
-
- destroy: function () {
- this.stop();
- },
-
- // nsIObserver.
-
- observe: function (subject, topic, data) {
- if (topic == "devtools-monitor-update") {
- try {
- data = JSON.parse(data);
- } catch (e) {
- console.error("Observer notification data is not a valid JSON-string:",
- data, e.message);
- return;
- }
- if (!Array.isArray(data)) {
- this._updates.push(data);
- } else {
- this._updates = this._updates.concat(data);
- }
- this._sendUpdate();
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
-
- // Update agents (see USSAgent for an example).
-
- _agents: [],
-
- _startAgent: function (agent) {
- try {
- agent.start();
- } catch (e) {
- this._removeAgent(agent);
- }
- },
-
- _addAgent: function (agent) {
- this._agents.push(agent);
- if (this._started) {
- this._startAgent(agent);
- }
- },
-
- _removeAgent: function (agent) {
- let index = this._agents.indexOf(agent);
- if (index > -1) {
- this._agents.splice(index, 1);
- }
- },
-};
-
-MonitorActor.prototype.requestTypes = {
- "start": MonitorActor.prototype.start,
- "stop": MonitorActor.prototype.stop,
-};
-
-exports.MonitorActor = MonitorActor;
-
-var USSAgent = {
- _mgr: null,
- _timeout: null,
- _packet: {
- graph: "USS",
- time: null,
- value: null
- },
-
- start: function () {
- USSAgent._mgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(
- Ci.nsIMemoryReporterManager);
- if (!USSAgent._mgr.residentUnique) {
- throw new Error("Couldn't get USS.");
- }
- USSAgent.update();
- },
-
- update: function () {
- if (!USSAgent._mgr) {
- USSAgent.stop();
- return;
- }
- USSAgent._packet.time = Date.now();
- USSAgent._packet.value = USSAgent._mgr.residentUnique;
- Services.obs.notifyObservers(null, "devtools-monitor-update",
- JSON.stringify(USSAgent._packet));
- USSAgent._timeout = setTimeout(USSAgent.update, 300);
- },
-
- stop: function () {
- clearTimeout(USSAgent._timeout);
- USSAgent._mgr = null;
- }
-};
-
-MonitorActor.prototype._addAgent(USSAgent);
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -35,17 +35,16 @@ DevToolsModules(
'frame.js',
'framerate.js',
'gcli.js',
'heap-snapshot-file.js',
'highlighters.css',
'highlighters.js',
'layout.js',
'memory.js',
- 'monitor.js',
'object.js',
'pause-scoped.js',
'perf.js',
'performance-recording.js',
'performance.js',
'preference.js',
'pretty-print-worker.js',
'process.js',
@@ -82,19 +81,16 @@ with Files('css-properties.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: CSS Rules Inspector')
with Files('csscoverage.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Graphics Commandline and Toolbar')
with Files('memory.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Memory')
-with Files('monitor.js'):
- BUG_COMPONENT = ('Firefox', 'Developer Tools')
-
with Files('performance*'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Performance Tools (Profiler/Timeline)')
with Files('source.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Debugger')
with Files('storage.js'):
BUG_COMPONENT = ('Firefox', 'Developer Tools: Storage Inspector')
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -514,21 +514,16 @@ var DebuggerServer = {
constructor: "CssPropertiesActor",
type: { tab: true }
});
this.registerModule("devtools/server/actors/csscoverage", {
prefix: "cssUsage",
constructor: "CSSUsageActor",
type: { tab: true }
});
- this.registerModule("devtools/server/actors/monitor", {
- prefix: "monitor",
- constructor: "MonitorActor",
- type: { tab: true }
- });
this.registerModule("devtools/server/actors/timeline", {
prefix: "timeline",
constructor: "TimelineActor",
type: { tab: true }
});
if ("nsIProfiler" in Ci &&
!Services.prefs.getBoolPref("devtools.performance.new-panel-enabled", false)) {
this.registerModule("devtools/server/actors/performance", {
deleted file mode 100644
--- a/devtools/server/tests/unit/test_monitor_actor.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/**
- * Test the monitor actor.
- */
-
-"use strict";
-
-function run_test() {
- let EventEmitter = require("devtools/shared/old-event-emitter");
-
- function MonitorClient(client, form) {
- this.client = client;
- this.actor = form.monitorActor;
- this.events = ["update"];
-
- EventEmitter.decorate(this);
- client.registerClient(this);
- }
- MonitorClient.prototype.destroy = function () {
- this.client.unregisterClient(this);
- };
- MonitorClient.prototype.start = function (callback) {
- this.client.request({
- to: this.actor,
- type: "start"
- }, callback);
- };
- MonitorClient.prototype.stop = function (callback) {
- this.client.request({
- to: this.actor,
- type: "stop"
- }, callback);
- };
-
- let monitor, client;
-
- // Start the monitor actor.
- get_chrome_actors((c, form) => {
- client = c;
- monitor = new MonitorClient(client, form);
- monitor.on("update", gotUpdate);
- monitor.start(update);
- });
-
- let time = Date.now();
-
- function update() {
- let event = {
- graph: "Test",
- curve: "test",
- value: 42,
- time: time,
- };
- Services.obs.notifyObservers(null, "devtools-monitor-update", JSON.stringify(event));
- }
-
- function gotUpdate(type, packet) {
- packet.data.forEach(function (event) {
- // Ignore updates that were not sent by this test.
- if (event.graph === "Test") {
- Assert.equal(event.curve, "test");
- Assert.equal(event.value, 42);
- Assert.equal(event.time, time);
- monitor.stop(function (response) {
- monitor.destroy();
- finishClient(client);
- });
- }
- });
- }
-
- do_test_pending();
-}
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -211,17 +211,16 @@ reason = only ran on B2G
[test_ignore_caught_exceptions.js]
[test_ignore_no_interface_exceptions.js]
[test_requestTypes.js]
reason = bug 937197
[test_layout-reflows-observer.js]
[test_protocolSpec.js]
[test_registerClient.js]
[test_client_request.js]
-[test_monitor_actor.js]
[test_symbols-01.js]
[test_symbols-02.js]
[test_get-executable-lines.js]
[test_get-executable-lines-source-map.js]
[test_xpcshell_debugging.js]
support-files = xpcshell_debugging_script.js
[test_setBreakpoint-on-column.js]
[test_setBreakpoint-on-column-in-gcd-script.js]