Bug 1498235 - lazy load modules in accessibility actors. r=gl
☠☠ backed out by 4ef080fed9d2 ☠ ☠
authorYura Zenevich <yura.zenevich@gmail.com>
Wed, 24 Oct 2018 03:57:59 +0000
changeset 491263 134717494734f146e380f26128f4a892b16a30ff
parent 491262 50d5e01b6dda142fc4f1123634d48b337a0cc9f5
child 491264 8399e5224d6935e06c37eb600b34967ba06b4487
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersgl
bugs1498235
milestone65.0a1
Bug 1498235 - lazy load modules in accessibility actors. r=gl MozReview-Commit-ID: 2qPBmhnd7tb Depends on D9579 Differential Revision: https://phabricator.services.mozilla.com/D9580
devtools/server/actors/accessibility/accessibility.js
devtools/server/actors/accessibility/accessible.js
devtools/server/actors/accessibility/walker.js
--- a/devtools/server/actors/accessibility/accessibility.js
+++ b/devtools/server/actors/accessibility/accessibility.js
@@ -3,19 +3,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { DebuggerServer } = require("devtools/server/main");
 const Services = require("Services");
 const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
 const defer = require("devtools/shared/defer");
-const events = require("devtools/shared/event-emitter");
 const { accessibilitySpec } = require("devtools/shared/specs/accessibility");
-const { AccessibleWalkerActor } = require("devtools/server/actors/accessibility/walker");
+
+loader.lazyRequireGetter(this, "AccessibleWalkerActor", "devtools/server/actors/accessibility/walker", true);
+loader.lazyRequireGetter(this, "events", "devtools/shared/event-emitter");
 
 const PREF_ACCESSIBILITY_FORCE_DISABLED = "accessibility.force_disabled";
 
 /**
  * The AccessibilityActor is a top level container actor that initializes
  * accessible walker and is the top-most point of interaction for accessibility
  * tools UI.
  */
--- a/devtools/server/actors/accessibility/accessible.js
+++ b/devtools/server/actors/accessibility/accessible.js
@@ -3,23 +3,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Ci } = require("chrome");
 const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
 const { accessibleSpec } = require("devtools/shared/specs/accessibility");
 
-const {
-  getContrastRatioFor,
-  isDefunct,
-} = require("devtools/server/actors/utils/accessibility");
+loader.lazyRequireGetter(this, "getContrastRatioFor", "devtools/server/actors/utils/accessibility", true);
+loader.lazyRequireGetter(this, "isDefunct", "devtools/server/actors/utils/accessibility", true);
 
 const nsIAccessibleRelation = Ci.nsIAccessibleRelation;
-
 const RELATIONS_TO_IGNORE = new Set([
   nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION,
   nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE,
   nsIAccessibleRelation.RELATION_CONTAINING_WINDOW,
   nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF,
   nsIAccessibleRelation.RELATION_SUBWINDOW_OF,
 ]);
 
--- a/devtools/server/actors/accessibility/walker.js
+++ b/devtools/server/actors/accessibility/walker.js
@@ -1,27 +1,27 @@
 /* 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 { Cc, Ci } = require("chrome");
-const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const Services = require("Services");
 const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
-const events = require("devtools/shared/event-emitter");
 const { accessibleWalkerSpec } = require("devtools/shared/specs/accessibility");
-const { AccessibleActor } = require("devtools/server/actors/accessibility/accessible");
 const { isXUL } = require("devtools/server/actors/highlighters/utils/markup");
-const { isWindowIncluded } = require("devtools/shared/layout/utils");
 const { CustomHighlighterActor, register } =
   require("devtools/server/actors/highlighters");
 
-const { isDefunct } = require("devtools/server/actors/utils/accessibility");
+loader.lazyRequireGetter(this, "AccessibleActor", "devtools/server/actors/accessibility/accessible", true);
+loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
+loader.lazyRequireGetter(this, "events", "devtools/shared/event-emitter");
+loader.lazyRequireGetter(this, "isDefunct", "devtools/server/actors/utils/accessibility", true);
+loader.lazyRequireGetter(this, "isWindowIncluded", "devtools/shared/layout/utils", true);
 
 const nsIAccessibleEvent = Ci.nsIAccessibleEvent;
 const nsIAccessibleStateChangeEvent = Ci.nsIAccessibleStateChangeEvent;
 const nsIAccessibleRole = Ci.nsIAccessibleRole;
 
 const {
   EVENT_TEXT_CHANGED,
   EVENT_TEXT_INSERTED,