Bug 1035206 - Replace occurences of setTimeout in dbg-client.jsm with executeSoon;r=past

This commit is contained in:
Eddy Bruel 2014-07-28 14:22:13 +02:00
parent a409d15044
commit 4efe7bea89

View File

@ -29,7 +29,6 @@ this.EXPORTED_SYMBOLS = ["DebuggerTransport",
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js").Promise; let promise = Cu.import("resource://gre/modules/devtools/deprecated-sync-thenables.js").Promise;
const { defer, resolve, reject } = promise; const { defer, resolve, reject } = promise;
@ -455,7 +454,7 @@ DebuggerClient.prototype = {
javascriptEnabled: cachedTab.javascriptEnabled, javascriptEnabled: cachedTab.javascriptEnabled,
traits: cachedTab.traits, traits: cachedTab.traits,
}; };
setTimeout(() => aOnResponse(cachedResponse, cachedTab), 0); DevToolsUtils.executeSoon(() => aOnResponse(cachedResponse, cachedTab));
return; return;
} }
@ -545,7 +544,7 @@ DebuggerClient.prototype = {
*/ */
attachThread: function (aThreadActor, aOnResponse = noop, aOptions={}) { attachThread: function (aThreadActor, aOnResponse = noop, aOptions={}) {
if (this._clients.has(aThreadActor)) { if (this._clients.has(aThreadActor)) {
setTimeout(() => aOnResponse({}, this._clients.get(aThreadActor)), 0); DevToolsUtils.executeSoon(() => aOnResponse({}, this._clients.get(aThreadActor)));
return; return;
} }
@ -574,7 +573,7 @@ DebuggerClient.prototype = {
*/ */
attachTracer: function (aTraceActor, aOnResponse = noop) { attachTracer: function (aTraceActor, aOnResponse = noop) {
if (this._clients.has(aTraceActor)) { if (this._clients.has(aTraceActor)) {
setTimeout(() => aOnResponse({}, this._clients.get(aTraceActor)), 0); DevToolsUtils.executeSoon(() => aOnResponse({}, this._clients.get(aTraceActor)));
return; return;
} }
@ -1284,7 +1283,7 @@ TabClient.prototype = {
*/ */
attachThread: function(aOptions={}, aOnResponse = noop) { attachThread: function(aOptions={}, aOnResponse = noop) {
if (this.thread) { if (this.thread) {
setTimeout(() => aOnResponse({}, this.thread), 0); DevToolsUtils.executeSoon(() => aOnResponse({}, this.thread));
return; return;
} }
@ -1672,7 +1671,7 @@ ThreadClient.prototype = {
// the next resumption. Otherwise we have to force a pause in order to send // the next resumption. Otherwise we have to force a pause in order to send
// the array. // the array.
if (this.paused) { if (this.paused) {
setTimeout(() => onResponse({}), 0); DevToolsUtils.executeSoon(() => onResponse({}));
return; return;
} }
this.interrupt(response => { this.interrupt(response => {