Backed out 5 changesets (bug 1468754) for xpcshell and eslint failures. CLOSED TREE

Backed out changeset 67f969f5bdba (bug 1468754)
Backed out changeset 55ba74fa5c95 (bug 1468754)
Backed out changeset 0d44a0523525 (bug 1468754)
Backed out changeset da447a45603e (bug 1468754)
Backed out changeset 71f45c79522e (bug 1468754)
This commit is contained in:
Dorel Luca 2018-10-22 22:00:49 +03:00
parent 0716f068cd
commit d58b21f026
13 changed files with 4 additions and 232 deletions

View File

@ -13,24 +13,15 @@ const ChangesApp = createFactory(require("./components/ChangesApp"));
const {
resetChanges,
trackChange,
} = require("./actions/changes");
class ChangesView {
constructor(inspector) {
this.inspector = inspector;
this.store = this.inspector.store;
this.toolbox = this.inspector.toolbox;
this.onAddChange = this.onAddChange.bind(this);
this.onClearChanges = this.onClearChanges.bind(this);
this.destroy = this.destroy.bind(this);
// Get the Changes front, and listen to it.
this.changesFront = this.toolbox.target.getFront("changes");
this.changesFront.on("add-change", this.onAddChange);
this.changesFront.on("clear-changes", this.onClearChanges);
this.init();
}
@ -47,33 +38,6 @@ class ChangesView {
// TODO: save store and restore/replay on refresh.
// Bug 1478439 - https://bugzilla.mozilla.org/show_bug.cgi?id=1478439
this.inspector.target.once("will-navigate", this.destroy);
// Sync the store to the changes stored on the server. The
// syncChangesToServer() method is async, but we don't await it since
// this method itself is NOT async. The call will be made in its own
// time, which is fine since it definitionally brings us up-to-date
// with the server at that moment.
this.syncChangesToServer();
}
async syncChangesToServer() {
// Empty the store.
this.onClearChanges();
// Add back in all the changes from the changesFront.
const changes = await this.changesFront.allChanges();
changes.forEach((change) => {
this.onAddChange(change);
});
}
onAddChange(change) {
// Turn data into a suitable change to send to the store.
this.store.dispatch(trackChange(change));
}
onClearChanges() {
this.store.dispatch(resetChanges());
}
/**
@ -81,14 +45,8 @@ class ChangesView {
*/
destroy() {
this.store.dispatch(resetChanges());
this.changesFront.off("add-change", this.onAddChange);
this.changesFront.off("clear-changes", this.onClearChanges);
this.changesFront = null;
this.inspector = null;
this.store = null;
this.toolbox = null;
}
}

View File

@ -65,7 +65,7 @@ const THREE_PANE_ENABLED_PREF = "devtools.inspector.three-pane-enabled";
const THREE_PANE_ENABLED_SCALAR = "devtools.inspector.three_pane_enabled";
const THREE_PANE_CHROME_ENABLED_PREF = "devtools.inspector.chrome.three-pane-enabled";
const TELEMETRY_EYEDROPPER_OPENED = "devtools.toolbar.eyedropper.opened";
const TRACK_CHANGES_PREF = "devtools.inspector.changes.enabled";
const TRACK_CHANGES_ENABLED = "devtools.inspector.changes.enabled";
/**
* Represents an open instance of the Inspector for a tab.
@ -122,7 +122,7 @@ function Inspector(toolbox) {
this.reflowTracker = new ReflowTracker(this._target);
this.styleChangeTracker = new InspectorStyleChangeTracker(this);
if (Services.prefs.getBoolPref(TRACK_CHANGES_PREF)) {
if (Services.prefs.getBoolPref(TRACK_CHANGES_ENABLED)) {
this.changesManager = new ChangesManager(this);
}
@ -272,14 +272,6 @@ Inspector.prototype = {
this.selection.setNodeFront(this._defaultNode, { reason: "inspector-open" });
}
if (Services.prefs.getBoolPref(TRACK_CHANGES_PREF)) {
// Get the Changes front, then call a method on it, which will instantiate
// the ChangesActor. We want the ChangesActor to be guaranteed available before
// the user makes any changes.
this.changesFront = this.toolbox.target.getFront("changes");
await this.changesFront.allChanges();
}
// Setup the splitter before the sidebar is displayed so, we don't miss any events.
this.setupSplitter();
@ -964,7 +956,7 @@ Inspector.prototype = {
},
defaultTab == fontId);
if (Services.prefs.getBoolPref(TRACK_CHANGES_PREF)) {
if (Services.prefs.getBoolPref(TRACK_CHANGES_ENABLED)) {
// Inject a lazy loaded react tab by exposing a fake React object
// with a lazy defined Tab thanks to `panel` being a function
const changesId = "changesview";

View File

@ -1,74 +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 protocol = require("devtools/shared/protocol");
const { changesSpec } = require("devtools/shared/specs/changes");
const TrackChangeEmitter = require("devtools/server/actors/utils/track-change-emitter");
/**
* The ChangesActor stores a stack of changes made by devtools on
* the document in the associated tab.
*/
const ChangesActor = protocol.ActorClassWithSpec(changesSpec, {
/**
* Create a ChangesActor.
*
* @param {DebuggerServerConnection} conn
* The server connection.
* @param {TargetActor} targetActor
* The top-level Actor for this tab.
*/
initialize: function(conn, targetActor) {
protocol.Actor.prototype.initialize.call(this, conn);
this.targetActor = targetActor;
this.onTrackChange = this.pushChange.bind(this);
TrackChangeEmitter.on("track-change", this.onTrackChange);
this.changes = [];
},
destroy: function() {
this.clearChanges();
TrackChangeEmitter.off("track-change", this.onTrackChange);
protocol.Actor.prototype.destroy.call(this);
},
changeCount: function() {
return this.changes.length;
},
change: function(index) {
if (index >= 0 && index < this.changes.length) {
// Return a copy of the change at index.
return Object.assign({}, this.changes[index]);
}
// No change at that index -- return undefined.
return undefined;
},
allChanges: function() {
return this.changes.slice();
},
pushChange: function(change) {
this.changes.push(change);
this.emit("add-change", change);
},
popChange: function() {
const change = this.changes.pop();
this.emit("remove-change", change);
return change;
},
clearChanges: function() {
this.changes.length = 0;
this.emit("clear-changes");
},
});
exports.ChangesActor = ChangesActor;

View File

@ -28,7 +28,6 @@ DevToolsModules(
'array-buffer.js',
'breakpoint.js',
'canvas.js',
'changes.js',
'common.js',
'css-properties.js',
'csscoverage.js',

View File

@ -9,7 +9,6 @@ const protocol = require("devtools/shared/protocol");
const {getCSSLexer} = require("devtools/shared/css/lexer");
const {LongStringActor} = require("devtools/server/actors/string");
const InspectorUtils = require("InspectorUtils");
const TrackChangeEmitter = require("devtools/server/actors/utils/track-change-emitter");
// This will also add the "stylesheet" actor type for protocol.js to recognize
@ -1521,7 +1520,7 @@ var StyleRuleActor = protocol.ActorClassWithSpec(styleRuleSpec, {
return;
}
TrackChangeEmitter.trackChange(data);
this.emit("track-change", data);
},
/**

View File

@ -256,11 +256,6 @@ const ActorRegistry = {
constructor: "ScreenshotActor",
type: { target: true },
});
this.registerModule("devtools/server/actors/changes", {
prefix: "changes",
constructor: "ChangesActor",
type: { target: true },
});
},
/**

View File

@ -21,6 +21,5 @@ DevToolsModules(
'source-actor-store.js',
'stack.js',
'TabSources.js',
'track-change-emitter.js',
'walker-search.js',
)

View File

@ -1,26 +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 EventEmitter = require("devtools/shared/event-emitter");
/**
* A helper class that is listened to by the ChangesActor, and can be
* used to send changes to the ChangesActor.
*/
class TrackChangeEmitter {
/**
* Initialize this object.
*/
constructor() {
EventEmitter.decorate(this);
}
trackChange(change) {
this.emit("track-change", change);
}
}
module.exports = new TrackChangeEmitter();

View File

@ -1,24 +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 protocol = require("devtools/shared/protocol");
const {changesSpec} = require("devtools/shared/specs/changes");
/**
* ChangesFront, the front object for the ChangesActor
*/
const ChangesFront = protocol.FrontClassWithSpec(changesSpec, {
initialize: function (client, {changesActor}) {
protocol.Front.prototype.initialize.call(this, client, {actor: changesActor});
this.manage(this);
},
destroy: function() {
protocol.Front.prototype.destroy.call(this);
},
});
exports.ChangesFront = ChangesFront;

View File

@ -14,7 +14,6 @@ DevToolsModules(
'actor-registry.js',
'animation.js',
'canvas.js',
'changes.js',
'css-properties.js',
'csscoverage.js',
'device.js',

View File

@ -1,39 +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 {
Arg,
generateActorSpec,
RetVal,
} = require("devtools/shared/protocol");
const changesSpec = generateActorSpec({
typeName: "changes",
events: {
"add-change": {
type: "addChange",
change: Arg(0, "json"),
},
"remove-change": {
type: "removeChange",
change: Arg(0, "json"),
},
"clear-changes": {
type: "clearChanges",
},
},
methods: {
"allChanges": {
response: {
changes: RetVal("array:json"),
},
},
},
});
exports.changesSpec = changesSpec;

View File

@ -219,11 +219,6 @@ const Types = exports.__TypesForTests = [
spec: "devtools/shared/specs/styles",
front: "devtools/shared/fronts/styles",
},
{
types: ["changes"],
spec: "devtools/shared/specs/changes",
front: "devtools/shared/fronts/changes",
},
{
types: ["mediarule", "stylesheet", "stylesheets"],
spec: "devtools/shared/specs/stylesheets",

View File

@ -16,7 +16,6 @@ DevToolsModules(
'animation.js',
'breakpoint.js',
'canvas.js',
'changes.js',
'css-properties.js',
'csscoverage.js',
'device.js',