Backed out 5 changesets (bug 1468754) for linting failure at checkouts/gecko/devtools/server/actors/utils/actor-registry.js on a CLOSED TREE
authorGurzau Raul <rgurzau@mozilla.com>
Mon, 22 Oct 2018 20:02:13 +0300
changeset 490782 7f6a5b37d2ca21ea84379c6edf675f15b99d4e5e
parent 490781 2d0174d68cec998537cb529f688c96cfa729a892
child 490783 4a1ac74c37a8c1bbb99c000c43638279cbb08ec6
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1468754
milestone64.0a1
backs outc36e8383aa3ac580f99c69011eebca5fce6b0830
c98ac75031113691ef2e0dcec903db85b41bcd63
ddd043a258e0852b4d64f1614f09dc4204231e8c
e6ff3400a4f622c25293e37416ff6741e109beb5
817018fb5aa4c131ab64da44f41731d93c880fa3
Backed out 5 changesets (bug 1468754) for linting failure at checkouts/gecko/devtools/server/actors/utils/actor-registry.js on a CLOSED TREE Backed out changeset c36e8383aa3a (bug 1468754) Backed out changeset c98ac7503111 (bug 1468754) Backed out changeset ddd043a258e0 (bug 1468754) Backed out changeset e6ff3400a4f6 (bug 1468754) Backed out changeset 817018fb5aa4 (bug 1468754)
devtools/client/inspector/changes/ChangesView.js
devtools/client/inspector/inspector.js
devtools/server/actors/changes.js
devtools/server/actors/moz.build
devtools/server/actors/styles.js
devtools/server/actors/utils/actor-registry.js
devtools/server/actors/utils/moz.build
devtools/server/actors/utils/track-change-emitter.js
devtools/shared/fronts/changes.js
devtools/shared/fronts/moz.build
devtools/shared/specs/changes.js
devtools/shared/specs/index.js
devtools/shared/specs/moz.build
--- a/devtools/client/inspector/changes/ChangesView.js
+++ b/devtools/client/inspector/changes/ChangesView.js
@@ -8,88 +8,46 @@
 
 const { createFactory, createElement } = require("devtools/client/shared/vendor/react");
 const { Provider } = require("devtools/client/shared/vendor/react-redux");
 
 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();
   }
 
   init() {
     const changesApp = ChangesApp({});
 
     // Expose the provider to let inspector.js use it in setupSidebar.
     this.provider = createElement(Provider, {
       id: "changesview",
       key: "changesview",
       store: this.store,
     }, changesApp);
 
     // 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());
   }
 
   /**
    * Destruction function called when the inspector is destroyed.
    */
   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;
   }
 }
 
 module.exports = ChangesView;
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -60,17 +60,17 @@ const PORTRAIT_MODE_WIDTH_THRESHOLD = 70
 // the sidebar automatically switches from 'landscape/horizontal' to 'portrait/vertical'
 // mode.
 const SIDE_PORTAIT_MODE_WIDTH_THRESHOLD = 1000;
 
 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.
  * The inspector controls the breadcrumbs, the markup view, and the sidebar
  * (computed view, rule view, font view and animation inspector).
  *
  * Events:
  * - ready
@@ -117,17 +117,17 @@ function Inspector(toolbox) {
   this._markupBox = this.panelDoc.getElementById("markup-box");
 
   // Map [panel id => panel instance]
   // Stores all the instances of sidebar panels like rule view, computed view, ...
   this._panels = new Map();
 
   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);
   }
 
   // Store the URL of the target page prior to navigation in order to ensure
   // telemetry counts in the Grid Inspector are not double counted on reload.
   this.previousURL = this.target.url;
 
   this.nodeMenuTriggerInfo = null;
@@ -267,24 +267,16 @@ Inspector.prototype = {
     this.isReady = false;
 
     // Set the node front so that the markup and sidebar panels will have the selected
     // nodeFront ready when they're initialized.
     if (this._defaultNode) {
       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();
 
     // We can display right panel with: tab bar, markup view and breadbrumb. Right after
     // the splitter set the right and left panel sizes, in order to avoid resizing it
     // during load of the inspector.
     this.panelDoc.getElementById("inspector-main-content").style.visibility = "visible";
 
@@ -959,17 +951,17 @@ Inspector.prototype = {
             this.fontinspector = new FontInspector(this, this.panelWin);
           }
 
           return this.fontinspector.provider;
         }
       },
       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";
       const changesTitle = INSPECTOR_L10N.getStr("inspector.sidebar.changesViewTitle");
       this.sidebar.queueTab(
         changesId,
         changesTitle,
         {
deleted file mode 100644
--- a/devtools/server/actors/changes.js
+++ /dev/null
@@ -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;
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -23,17 +23,16 @@ DevToolsModules(
     'accessibility-parent.js',
     'accessibility.js',
     'actor-registry.js',
     'animation-type-longhand.js',
     'animation.js',
     'array-buffer.js',
     'breakpoint.js',
     'canvas.js',
-    'changes.js',
     'common.js',
     'css-properties.js',
     'csscoverage.js',
     'device.js',
     'emulation.js',
     'environment.js',
     'errordocs.js',
     'frame.js',
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -4,17 +4,16 @@
 
 "use strict";
 
 const Services = require("Services");
 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
 
 const {pageStyleSpec, styleRuleSpec, ELEMENT_STYLE} = require("devtools/shared/specs/styles");
 
 loader.lazyRequireGetter(this, "CssLogic", "devtools/server/actors/inspector/css-logic", true);
 loader.lazyRequireGetter(this, "SharedCssLogic", "devtools/shared/inspector/css-logic");
 loader.lazyRequireGetter(this, "getDefinedGeometryProperties",
@@ -1516,17 +1515,17 @@ var StyleRuleActor = protocol.ActorClass
     // Do not track non-changes. This can occur when typing a value in the Rule view
     // inline editor, then committing it by pressing the Enter key.
     if (data.add && data.remove &&
         data.add.property === data.remove.property &&
         data.add.value === data.remove.value) {
       return;
     }
 
-    TrackChangeEmitter.trackChange(data);
+    this.emit("track-change", data);
   },
 
   /**
    * Calls modifySelector2() which needs to be kept around for backwards compatibility.
    * TODO: Once Firefox 64 is no longer supported, inline that mehtod's content,
    * then remove its definition from this file and from specs/styles.js
    */
   modifySelector: function(node, value, editAuthored = false) {
--- a/devtools/server/actors/utils/actor-registry.js
+++ b/devtools/server/actors/utils/actor-registry.js
@@ -251,21 +251,16 @@ const ActorRegistry = {
       constructor: "AccessibilityActor",
       type: { target: true },
     });
     this.registerModule("devtools/server/actors/screenshot", {
       prefix: "screenshot",
       constructor: "ScreenshotActor",
       type: { target: true },
     });
-    this.registerModule("devtools/server/actors/changes", {
-      prefix: "changes",
-      constructor: "ChangesActor",
-      type: { target: true }
-    });
   },
 
   /**
    * Registers handlers for new target-scoped request types defined dynamically.
    *
    * Note that the name or actorPrefix of the request type is not allowed to clash with
    * existing protocol packet properties, like 'title', 'url' or 'actor', since that would
    * break the protocol.
--- a/devtools/server/actors/utils/moz.build
+++ b/devtools/server/actors/utils/moz.build
@@ -16,11 +16,10 @@ DevToolsModules(
     'event-loop.js',
     'function-call.js',
     'make-debugger.js',
     'map-uri-to-addon-id.js',
     'shapes-utils.js',
     'source-actor-store.js',
     'stack.js',
     'TabSources.js',
-    'track-change-emitter.js',
     'walker-search.js',
 )
deleted file mode 100644
--- a/devtools/server/actors/utils/track-change-emitter.js
+++ /dev/null
@@ -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();
deleted file mode 100644
--- a/devtools/shared/fronts/changes.js
+++ /dev/null
@@ -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;
--- a/devtools/shared/fronts/moz.build
+++ b/devtools/shared/fronts/moz.build
@@ -9,17 +9,16 @@ DIRS += [
     'targets',
 ]
 
 DevToolsModules(
     'accessibility.js',
     'actor-registry.js',
     'animation.js',
     'canvas.js',
-    'changes.js',
     'css-properties.js',
     'csscoverage.js',
     'device.js',
     'emulation.js',
     'framerate.js',
     'function-call.js',
     'highlighters.js',
     'inspector.js',
deleted file mode 100644
--- a/devtools/shared/specs/changes.js
+++ /dev/null
@@ -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;
--- a/devtools/shared/specs/index.js
+++ b/devtools/shared/specs/index.js
@@ -215,21 +215,16 @@ const Types = exports.__TypesForTests = 
     front: "devtools/shared/fronts/string",
   },
   {
     types: ["pagestyle", "domstylerule"],
     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",
     front: "devtools/shared/fronts/stylesheets",
   },
   {
     types: ["symbol"],
     spec: "devtools/shared/specs/symbol",
     front: null,
--- a/devtools/shared/specs/moz.build
+++ b/devtools/shared/specs/moz.build
@@ -11,17 +11,16 @@ DIRS += [
 ]
 
 DevToolsModules(
     'accessibility.js',
     'actor-registry.js',
     'animation.js',
     'breakpoint.js',
     'canvas.js',
-    'changes.js',
     'css-properties.js',
     'csscoverage.js',
     'device.js',
     'emulation.js',
     'environment.js',
     'frame.js',
     'framerate.js',
     'function-call.js',