Bug 1387123 - Replace all usages of require(promise).defer by require(devtools/shared/defer).defer. r=tromey

In prevision of Promise.jsm removal, use defer helper module instead of Promise.jsm
as that's the only one feature that DOM Promise don't support.

PART3: Manual fixes
- Go manually fix: http://searchfox.org/mozilla-central/source/devtools/client/dom/dom-panel.js
  which has duplicated import of defer symbol (it already used to import it)
- execute eslint, see all the places where we import of 'promise' is no longer use it
  (there may be leftovers not covered by eslint that will be covered in bug 1387128)
  devtools/server/tests/mochitest/inspector-helpers.js needs to keep importing promise as it is a shared test script.
- fix devtools/client/performance/panel.js and devtools/client/webconsole/console-output.js
  which use loader.lazyRequireGetter(this, "promise") and miss the defer import
- fix devtools/server/worker.js to use 'worker.require(devtools/shared/defer")'

MozReview-Commit-ID: HIOB5Et87Wc

--HG--
extra : rebase_source : fe3bff8599807224fd51898e753589d4c7c1777f
This commit is contained in:
Alexandre Poirot 2017-08-08 15:19:56 +02:00
Родитель a8c68f2955
Коммит 4d50ab07c7
12 изменённых файлов: 7 добавлений и 15 удалений

Просмотреть файл

@ -6,10 +6,8 @@
"use strict";
const { Cu } = require("chrome");
const defer = require("devtools/shared/defer");
const { ObjectClient } = require("devtools/shared/client/main");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const EventEmitter = require("devtools/shared/event-emitter");
const { Task } = require("devtools/shared/task");

Просмотреть файл

@ -13,7 +13,6 @@ 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 promise = require("promise");
const defer = require("devtools/shared/defer");
const EventEmitter = require("devtools/shared/event-emitter");

Просмотреть файл

@ -6,8 +6,8 @@
"use strict";
const { Task } = require("devtools/shared/task");
const defer = require("devtools/shared/defer");
loader.lazyRequireGetter(this, "promise");
loader.lazyRequireGetter(this, "EventEmitter",
"devtools/shared/event-emitter");

Просмотреть файл

@ -11,7 +11,6 @@ const {Ci} = require("chrome");
loader.lazyImporter(this, "VariablesView", "resource://devtools/client/shared/widgets/VariablesView.jsm");
loader.lazyImporter(this, "escapeHTML", "resource://devtools/client/shared/widgets/VariablesView.jsm");
loader.lazyRequireGetter(this, "promise");
loader.lazyRequireGetter(this, "gDevTools", "devtools/client/framework/devtools", true);
loader.lazyRequireGetter(this, "TableWidget", "devtools/client/shared/widgets/TableWidget", true);
loader.lazyRequireGetter(this, "ObjectClient", "devtools/shared/client/main", true);
@ -25,6 +24,7 @@ const l10n = require("devtools/client/webconsole/webconsole-l10n");
const nodeConstants = require("devtools/shared/dom-node-constants");
const {PluralForm} = require("devtools/shared/plural-form");
const {extend} = require("devtools/shared/extend");
const defer = require("devtools/shared/defer");
const MAX_STRING_GRIP_LENGTH = 36;
const {ELLIPSIS} = require("devtools/shared/l10n");

Просмотреть файл

@ -8,7 +8,6 @@
const {Utils: WebConsoleUtils} =
require("devtools/client/webconsole/utils");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const Debugger = require("Debugger");
const Services = require("Services");

Просмотреть файл

@ -5,7 +5,6 @@
/* global XPCNativeWrapper */
const promise = require("promise");
const defer = require("devtools/shared/defer");
const protocol = require("devtools/shared/protocol");
const {CallWatcherActor} = require("devtools/server/actors/call-watcher");

Просмотреть файл

@ -6,7 +6,6 @@
const Services = require("Services");
const protocol = require("devtools/shared/protocol");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const {LongStringActor} = require("devtools/server/actors/string");
const {DebuggerServer} = require("devtools/server/main");

Просмотреть файл

@ -7,7 +7,6 @@
const {Cu} = require("chrome");
const events = require("sdk/event/core");
const promise = require("promise");
const defer = require("devtools/shared/defer");
const protocol = require("devtools/shared/protocol");
const { ContentObserver } = require("devtools/shared/content-observer");

Просмотреть файл

@ -732,7 +732,7 @@ var DebuggerServer = {
},
connectToContent(connection, mm, onDestroy) {
let deferred = Syncdefer();
let deferred = SyncPromise.defer();
let prefix = connection.allocID("content-process");
let actor, childTransport;
@ -1022,7 +1022,7 @@ var DebuggerServer = {
* established.
*/
connectToChild(connection, frame, onDestroy, {addonId} = {}) {
let deferred = Syncdefer();
let deferred = SyncPromise.defer();
// Get messageManager from XUL browser (which might be a specialized tunnel for RDM)
// or else fallback to asking the frameLoader itself.

Просмотреть файл

@ -12,7 +12,8 @@ const {DebuggerServer} = require("devtools/server/main");
const { Task } = require("devtools/shared/task");
const Services = require("Services");
const promise = require("promise");
// promise is still used in tests using this helper
const promise = require("promise"); // eslint-disable-line no-unused-vars
const defer = require("devtools/shared/defer");
const {_documentWalker} = require("devtools/server/actors/inspector");

Просмотреть файл

@ -28,8 +28,7 @@ this.rpc = function (method, ...params) {
loadSubScript("resource://devtools/shared/worker/loader.js");
var Promise = worker.require("promise");
const defer = require("devtools/shared/defer");
var defer = worker.require("devtools/shared/defer");
var { ActorPool } = worker.require("devtools/server/actors/common");
var { ThreadActor } = worker.require("devtools/server/actors/script");
var { WebConsoleActor } = worker.require("devtools/server/actors/webconsole");

Просмотреть файл

@ -7,7 +7,6 @@ const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const promise = require("promise");
const defer = require("devtools/shared/defer");
const { NetworkThrottleManager } =
require("devtools/shared/webconsole/throttle");