Bug 1355161 - script-generated patch to replace .{currentThread,mainThread}.dispatch(..., Ci.nsIThread.DISPATCH_NORMAL) with .dispatchToMainThread(...), r=froydnj.
This commit is contained in:
@@ -80,8 +80,7 @@ function setImmediate(callback, ...params) {
|
|||||||
// if dispatch loop is not scheduled schedule one. Own scheduler
|
// if dispatch loop is not scheduled schedule one. Own scheduler
|
||||||
if (!dispatcher.scheduled) {
|
if (!dispatcher.scheduled) {
|
||||||
dispatcher.scheduled = true;
|
dispatcher.scheduled = true;
|
||||||
threadManager.currentThread.dispatch(dispatcher,
|
threadManager.dispatchToMainThread(dispatcher);
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ else {
|
|||||||
let listener = function (subject, topic) {
|
let listener = function (subject, topic) {
|
||||||
Services.obs.removeObserver(this, topic);
|
Services.obs.removeObserver(this, topic);
|
||||||
Startup.initialized = true;
|
Startup.initialized = true;
|
||||||
Services.tm.currentThread.dispatch(() => gOnceInitializedDeferred.resolve(),
|
Services.tm.dispatchToMainThread(() => gOnceInitializedDeferred.resolve());
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.obs.addObserver(listener, appStartup);
|
Services.obs.addObserver(listener, appStartup);
|
||||||
|
|||||||
@@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
let writeMore = function writeMore()
|
let writeMore = function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3767,13 +3765,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
let writeMore = function writeMore()
|
let writeMore = function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3767,13 +3765,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -457,8 +457,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2696,8 +2695,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
let writeMore = function writeMore()
|
let writeMore = function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3768,13 +3766,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4523,7 +4521,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -456,8 +456,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2695,8 +2694,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
let writeMore = function writeMore()
|
let writeMore = function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3767,13 +3765,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4522,7 +4520,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -457,8 +457,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2696,8 +2695,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
let writeMore = function writeMore()
|
let writeMore = function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3768,13 +3766,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4523,7 +4521,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ SSLExceptions.prototype = {
|
|||||||
aSslStatus,
|
aSslStatus,
|
||||||
aTargetHost) {
|
aTargetHost) {
|
||||||
this._sslStatus = aSslStatus.QueryInterface(Ci.nsISSLStatus);
|
this._sslStatus = aSslStatus.QueryInterface(Ci.nsISSLStatus);
|
||||||
Services.tm.currentThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: this._addOverride.bind(this)
|
run: this._addOverride.bind(this)
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
return true; // suppress error UI
|
return true; // suppress error UI
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -521,6 +521,6 @@ var FullZoom = {
|
|||||||
_executeSoon: function FullZoom__executeSoon(callback) {
|
_executeSoon: function FullZoom__executeSoon(callback) {
|
||||||
if (!callback)
|
if (!callback)
|
||||||
return;
|
return;
|
||||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ add_task(function*() {
|
|||||||
// The click is handled async; wait for an event loop turn for that to
|
// The click is handled async; wait for an event loop turn for that to
|
||||||
// happen.
|
// happen.
|
||||||
yield new Promise(function(resolve) {
|
yield new Promise(function(resolve) {
|
||||||
Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ add_task(function*() {
|
|||||||
ourPrompt.onButtonClick(0);
|
ourPrompt.onButtonClick(0);
|
||||||
// Wait for that click to actually be handled completely.
|
// Wait for that click to actually be handled completely.
|
||||||
yield new Promise(function(resolve) {
|
yield new Promise(function(resolve) {
|
||||||
Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
});
|
});
|
||||||
// check permission is set
|
// check permission is set
|
||||||
let ps = Services.perms;
|
let ps = Services.perms;
|
||||||
|
|||||||
@@ -2294,5 +2294,5 @@ function __dumpDragData(aEvent, caller) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dispatchFunction(aFunc) {
|
function dispatchFunction(aFunc) {
|
||||||
Services.tm.currentThread.dispatch(aFunc, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(aFunc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1092,11 +1092,11 @@ DownloadsPlacesView.prototype = {
|
|||||||
// first item is activated, and pass the item to the richlistbox
|
// first item is activated, and pass the item to the richlistbox
|
||||||
// setters only at a point we know for sure the binding is attached.
|
// setters only at a point we know for sure the binding is attached.
|
||||||
firstDownloadElement._shell.ensureActive();
|
firstDownloadElement._shell.ensureActive();
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this._richlistbox.selectedItem = firstDownloadElement;
|
this._richlistbox.selectedItem = firstDownloadElement;
|
||||||
this._richlistbox.currentItem = firstDownloadElement;
|
this._richlistbox.currentItem = firstDownloadElement;
|
||||||
this._initiallySelectedElement = firstDownloadElement;
|
this._initiallySelectedElement = firstDownloadElement;
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -393,9 +393,9 @@ class TabTracker extends TabTrackerBase {
|
|||||||
// `tabs.onRemoved.addListener`, then the tab would be closed before the
|
// `tabs.onRemoved.addListener`, then the tab would be closed before the
|
||||||
// event listener is registered. To make sure that the event listener is
|
// event listener is registered. To make sure that the event listener is
|
||||||
// notified, we dispatch `tabs.onRemoved` asynchronously.
|
// notified, we dispatch `tabs.onRemoved` asynchronously.
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.emit("tab-removed", {nativeTab, tabId, windowId, isWindowClosing});
|
this.emit("tab-removed", {nativeTab, tabId, windowId, isWindowClosing});
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBrowserData(browser) {
|
getBrowserData(browser) {
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ this.MigratorPrototype = {
|
|||||||
// Used to periodically give back control to the main-thread loop.
|
// Used to periodically give back control to the main-thread loop.
|
||||||
let unblockMainThread = function() {
|
let unblockMainThread = function() {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1033,9 +1033,9 @@ BrowserGlue.prototype = {
|
|||||||
} catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
} catch (ex) { /* Don't break the default prompt if telemetry is broken. */ }
|
||||||
|
|
||||||
if (willPrompt) {
|
if (willPrompt) {
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1423,10 +1423,10 @@
|
|||||||
this._rebuild();
|
this._rebuild();
|
||||||
break;
|
break;
|
||||||
case "popuphidden":
|
case "popuphidden":
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.selectedButton = null;
|
this.selectedButton = null;
|
||||||
this._contextEngine = null;
|
this._contextEngine = null;
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
]]></body>
|
]]></body>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ Cu.import("resource:///modules/sessionstore/FrameTree.jsm", this);
|
|||||||
var gFrameTree = new FrameTree(this);
|
var gFrameTree = new FrameTree(this);
|
||||||
|
|
||||||
function executeSoon(callback) {
|
function executeSoon(callback) {
|
||||||
Services.tm.mainThread.dispatch(callback, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
gFrameTree.addObserver({
|
gFrameTree.addObserver({
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ function startup(data, reasonCode) {
|
|||||||
gStarted = true;
|
gStarted = true;
|
||||||
|
|
||||||
// delay realstartup to trigger the race condition
|
// delay realstartup to trigger the race condition
|
||||||
Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager)
|
Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager).dispatchToMainThread(realstartup);
|
||||||
.mainThread.dispatch(realstartup, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function realstartup() {
|
function realstartup() {
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ function initService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function schedule(callback) {
|
function schedule(callback) {
|
||||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public API
|
// Public API
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ this.webrtcUI = {
|
|||||||
let identityBox = browserWindow.document.getElementById("identity-box");
|
let identityBox = browserWindow.document.getElementById("identity-box");
|
||||||
if (AppConstants.platform == "macosx" && !Services.focus.activeWindow) {
|
if (AppConstants.platform == "macosx" && !Services.focus.activeWindow) {
|
||||||
browserWindow.addEventListener("activate", function() {
|
browserWindow.addEventListener("activate", function() {
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
identityBox.click();
|
identityBox.click();
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport)
|
Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport)
|
||||||
.activateApplication(true);
|
.activateApplication(true);
|
||||||
|
|||||||
@@ -9210,13 +9210,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
copy: function() {
|
copy: function() {
|
||||||
// Dispatch to the next tick so that it's possible to attach a progress
|
// Dispatch to the next tick so that it's possible to attach a progress
|
||||||
// event listener, even for extremely fast copies (like when testing).
|
// event listener, even for extremely fast copies (like when testing).
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
try {
|
try {
|
||||||
this._copy();
|
this._copy();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._deferred.reject(e);
|
this._deferred.reject(e);
|
||||||
}
|
}
|
||||||
}, 0);
|
});
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -8048,13 +8048,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||||||
copy: function() {
|
copy: function() {
|
||||||
// Dispatch to the next tick so that it's possible to attach a progress
|
// Dispatch to the next tick so that it's possible to attach a progress
|
||||||
// event listener, even for extremely fast copies (like when testing).
|
// event listener, even for extremely fast copies (like when testing).
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
try {
|
try {
|
||||||
this._copy();
|
this._copy();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._deferred.reject(e);
|
this._deferred.reject(e);
|
||||||
}
|
}
|
||||||
}, 0);
|
});
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -235,9 +235,9 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
|||||||
// Dispatch subsequent document manipulation operations, to avoid
|
// Dispatch subsequent document manipulation operations, to avoid
|
||||||
// blocking the main thread when a large number of search results
|
// blocking the main thread when a large number of search results
|
||||||
// is found, thus giving the impression of faster searching.
|
// is found, thus giving the impression of faster searching.
|
||||||
Services.tm.currentThread.dispatch({ run:
|
Services.tm.dispatchToMainThread({ run:
|
||||||
this._createSourceResultsUI.bind(this, sourceResults)
|
this._createSourceResultsUI.bind(this, sourceResults)
|
||||||
}, 0);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -332,12 +332,12 @@ GlobalSearchView.prototype = Heritage.extend(WidgetMethods, {
|
|||||||
* The match to start a bounce animation for.
|
* The match to start a bounce animation for.
|
||||||
*/
|
*/
|
||||||
_bounceMatch: function (aMatch) {
|
_bounceMatch: function (aMatch) {
|
||||||
Services.tm.currentThread.dispatch({ run: () => {
|
Services.tm.dispatchToMainThread({ run: () => {
|
||||||
aMatch.addEventListener("transitionend", function () {
|
aMatch.addEventListener("transitionend", function () {
|
||||||
aMatch.removeAttribute("focused");
|
aMatch.removeAttribute("focused");
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
aMatch.setAttribute("focused", "");
|
aMatch.setAttribute("focused", "");
|
||||||
}}, 0);
|
}});
|
||||||
aMatch.setAttribute("focusing", "");
|
aMatch.setAttribute("focusing", "");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -152,13 +152,13 @@ DOMHelpers.prototype = {
|
|||||||
// If in `callback` the URL of the window is changed and a listener to DOMContentLoaded
|
// If in `callback` the URL of the window is changed and a listener to DOMContentLoaded
|
||||||
// is attached, the event we just received will be also be caught by the new listener.
|
// is attached, the event we just received will be also be caught by the new listener.
|
||||||
// We want to avoid that so we execute the callback in the next queue.
|
// We want to avoid that so we execute the callback in the next queue.
|
||||||
Services.tm.mainThread.dispatch(callback, 0);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if ((window.document.readyState == "complete" ||
|
if ((window.document.readyState == "complete" ||
|
||||||
window.document.readyState == "interactive") &&
|
window.document.readyState == "interactive") &&
|
||||||
window.location.href == targetURL) {
|
window.location.href == targetURL) {
|
||||||
Services.tm.mainThread.dispatch(callback, 0);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
} else {
|
} else {
|
||||||
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", onReady);
|
docShell.chromeEventHandler.addEventListener("DOMContentLoaded", onReady);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1497,7 +1497,7 @@ Scope.prototype = {
|
|||||||
this._openEnum();
|
this._openEnum();
|
||||||
}
|
}
|
||||||
if (this._variablesView._nonEnumVisible) {
|
if (this._variablesView._nonEnumVisible) {
|
||||||
Services.tm.currentThread.dispatch({ run: this._openNonEnum }, 0);
|
Services.tm.dispatchToMainThread({ run: this._openNonEnum });
|
||||||
}
|
}
|
||||||
this._isExpanded = true;
|
this._isExpanded = true;
|
||||||
|
|
||||||
|
|||||||
@@ -957,7 +957,7 @@ TabActor.prototype = {
|
|||||||
let force = request && request.options && request.options.force;
|
let force = request && request.options && request.options.force;
|
||||||
// Wait a tick so that the response packet can be dispatched before the
|
// Wait a tick so that the response packet can be dispatched before the
|
||||||
// subsequent navigation event packet.
|
// subsequent navigation event packet.
|
||||||
Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
|
Services.tm.dispatchToMainThread(DevToolsUtils.makeInfallible(() => {
|
||||||
// This won't work while the browser is shutting down and we don't really
|
// This won't work while the browser is shutting down and we don't really
|
||||||
// care.
|
// care.
|
||||||
if (Services.startup.shuttingDown) {
|
if (Services.startup.shuttingDown) {
|
||||||
@@ -966,7 +966,7 @@ TabActor.prototype = {
|
|||||||
this.webNavigation.reload(force ?
|
this.webNavigation.reload(force ?
|
||||||
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE :
|
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE :
|
||||||
Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
|
Ci.nsIWebNavigation.LOAD_FLAGS_NONE);
|
||||||
}, "TabActor.prototype.onReload's delayed body"), 0);
|
}, "TabActor.prototype.onReload's delayed body"));
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -976,9 +976,9 @@ TabActor.prototype = {
|
|||||||
onNavigateTo(request) {
|
onNavigateTo(request) {
|
||||||
// Wait a tick so that the response packet can be dispatched before the
|
// Wait a tick so that the response packet can be dispatched before the
|
||||||
// subsequent navigation event packet.
|
// subsequent navigation event packet.
|
||||||
Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
|
Services.tm.dispatchToMainThread(DevToolsUtils.makeInfallible(() => {
|
||||||
this.window.location = request.url;
|
this.window.location = request.url;
|
||||||
}, "TabActor.prototype.onNavigateTo's delayed body"), 0);
|
}, "TabActor.prototype.onNavigateTo's delayed body"));
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ DevToolsUtils.makeInfallible(function (window) {
|
|||||||
* a nsIWindowMediatorListener's onCloseWindow hook (bug 873589), so
|
* a nsIWindowMediatorListener's onCloseWindow hook (bug 873589), so
|
||||||
* handle the close in a different tick.
|
* handle the close in a different tick.
|
||||||
*/
|
*/
|
||||||
Services.tm.currentThread.dispatch(DevToolsUtils.makeInfallible(() => {
|
Services.tm.dispatchToMainThread(DevToolsUtils.makeInfallible(() => {
|
||||||
/*
|
/*
|
||||||
* Scan the entire map for actors representing tabs that were in this
|
* Scan the entire map for actors representing tabs that were in this
|
||||||
* top-level window, and exit them.
|
* top-level window, and exit them.
|
||||||
@@ -682,7 +682,7 @@ DevToolsUtils.makeInfallible(function (window) {
|
|||||||
this._handleActorClose(actor, browser);
|
this._handleActorClose(actor, browser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "BrowserTabList.prototype.onCloseWindow's delayed body"), 0);
|
}, "BrowserTabList.prototype.onCloseWindow's delayed body"));
|
||||||
}, "BrowserTabList.prototype.onCloseWindow");
|
}, "BrowserTabList.prototype.onCloseWindow");
|
||||||
|
|
||||||
exports.BrowserTabList = BrowserTabList;
|
exports.BrowserTabList = BrowserTabList;
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ var WebExtensionInspectedWindowActor = protocol.ActorClassWithSpec(
|
|||||||
// Execute the reload in a dispatched runnable, so that we can
|
// Execute the reload in a dispatched runnable, so that we can
|
||||||
// return the reply to the caller before the reload is actually
|
// return the reply to the caller before the reload is actually
|
||||||
// started.
|
// started.
|
||||||
Services.tm.currentThread.dispatch(delayedReload, 0);
|
Services.tm.dispatchToMainThread(delayedReload);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -585,9 +585,9 @@ StubTransport.prototype.send = function () {};
|
|||||||
StubTransport.prototype.close = function () {};
|
StubTransport.prototype.close = function () {};
|
||||||
|
|
||||||
function executeSoon(func) {
|
function executeSoon(func) {
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: DevToolsUtils.makeInfallible(func)
|
run: DevToolsUtils.makeInfallible(func)
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// The do_check_* family of functions expect their last argument to be an
|
// The do_check_* family of functions expect their last argument to be an
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ function run_test() {
|
|||||||
// XXX: We have to do an executeSoon so that the error isn't caught and
|
// XXX: We have to do an executeSoon so that the error isn't caught and
|
||||||
// reported by DebuggerClient.requester (because we are using the local
|
// reported by DebuggerClient.requester (because we are using the local
|
||||||
// transport and share a stack) which causes the test to fail.
|
// transport and share a stack) which causes the test to fail.
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: test_black_box
|
run: test_black_box
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function run_test() {
|
|||||||
function test_nesting() {
|
function test_nesting() {
|
||||||
do_check_eq(inspector.eventLoopNestLevel, 0);
|
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||||
|
|
||||||
tm.currentThread.dispatch({ run: enterEventLoop}, 0);
|
tm.dispatchToMainThread({ run: enterEventLoop});
|
||||||
|
|
||||||
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), 0);
|
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), 0);
|
||||||
do_check_eq(inspector.eventLoopNestLevel, 0);
|
do_check_eq(inspector.eventLoopNestLevel, 0);
|
||||||
@@ -31,7 +31,7 @@ function test_nesting() {
|
|||||||
|
|
||||||
function enterEventLoop() {
|
function enterEventLoop() {
|
||||||
if (gCount++ < MAX) {
|
if (gCount++ < MAX) {
|
||||||
tm.currentThread.dispatch({ run: enterEventLoop}, 0);
|
tm.dispatchToMainThread({ run: enterEventLoop});
|
||||||
|
|
||||||
Object.create(requestor(gCount));
|
Object.create(requestor(gCount));
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ function enterEventLoop() {
|
|||||||
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
|
do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), gCount);
|
||||||
} else {
|
} else {
|
||||||
do_check_eq(gCount, MAX + 1);
|
do_check_eq(gCount, MAX + 1);
|
||||||
tm.currentThread.dispatch({ run: exitEventLoop}, 0);
|
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ function exitEventLoop() {
|
|||||||
do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url);
|
||||||
do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection);
|
||||||
if (gCount-- > 1) {
|
if (gCount-- > 1) {
|
||||||
tm.currentThread.dispatch({ run: exitEventLoop}, 0);
|
tm.dispatchToMainThread({ run: exitEventLoop});
|
||||||
}
|
}
|
||||||
|
|
||||||
do_check_eq(inspector.exitNestedEventLoop(), gCount);
|
do_check_eq(inspector.exitNestedEventLoop(), gCount);
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ function run_test_with_server(server, callback) {
|
|||||||
// XXX: We have to do an executeSoon so that the error isn't caught and
|
// XXX: We have to do an executeSoon so that the error isn't caught and
|
||||||
// reported by DebuggerClient.requester (because we are using the local
|
// reported by DebuggerClient.requester (because we are using the local
|
||||||
// transport and share a stack) which causes the test to fail.
|
// transport and share a stack) which causes the test to fail.
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: test_simple_stepping
|
run: test_simple_stepping
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ exports.executeSoon = function (fn) {
|
|||||||
} else {
|
} else {
|
||||||
executor = fn;
|
executor = fn;
|
||||||
}
|
}
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: exports.makeInfallible(executor)
|
run: exports.makeInfallible(executor)
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -99,13 +99,13 @@ StreamCopier.prototype = {
|
|||||||
copy: function () {
|
copy: function () {
|
||||||
// Dispatch to the next tick so that it's possible to attach a progress
|
// Dispatch to the next tick so that it's possible to attach a progress
|
||||||
// event listener, even for extremely fast copies (like when testing).
|
// event listener, even for extremely fast copies (like when testing).
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
try {
|
try {
|
||||||
this._copy();
|
this._copy();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this._deferred.reject(e);
|
this._deferred.reject(e);
|
||||||
}
|
}
|
||||||
}, 0);
|
});
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,7 @@ IndexedDBHelper.prototype = {
|
|||||||
req = indexedDB.open(this.dbName, this.dbVersion);
|
req = indexedDB.open(this.dbName, this.dbVersion);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DEBUG) debug("Error opening database: " + self.dbName);
|
if (DEBUG) debug("Error opening database: " + self.dbName);
|
||||||
Services.tm.currentThread.dispatch(() => invokeCallbacks(getErrorName(e)),
|
Services.tm.dispatchToMainThread(() => invokeCallbacks(getErrorName(e)));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
req.onsuccess = function (event) {
|
req.onsuccess = function (event) {
|
||||||
@@ -114,8 +113,7 @@ IndexedDBHelper.prototype = {
|
|||||||
if (this._db) {
|
if (this._db) {
|
||||||
if (DEBUG) debug("ensureDB: already have a database, returning early.");
|
if (DEBUG) debug("ensureDB: already have a database, returning early.");
|
||||||
if (aSuccessCb) {
|
if (aSuccessCb) {
|
||||||
Services.tm.currentThread.dispatch(aSuccessCb,
|
Services.tm.dispatchToMainThread(aSuccessCb);
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||||||
|
|
||||||
function executeSoon(f)
|
function executeSoon(f)
|
||||||
{
|
{
|
||||||
Services.tm.mainThread.dispatch(f, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
var urlSuffix = "/this/is/the/test/url";
|
var urlSuffix = "/this/is/the/test/url";
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ BrowserElementAuthPrompt.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.tm.currentThread.dispatch(runnable, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getFrameFromChannel: function(channel) {
|
_getFrameFromChannel: function(channel) {
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ NotificationStorage.prototype = {
|
|||||||
// fetching from the database.
|
// fetching from the database.
|
||||||
notifications.forEach(function(notification) {
|
notifications.forEach(function(notification) {
|
||||||
try {
|
try {
|
||||||
Services.tm.currentThread.dispatch(
|
Services.tm.dispatchToMainThread(
|
||||||
callback.handle.bind(callback,
|
callback.handle.bind(callback,
|
||||||
notification.id,
|
notification.id,
|
||||||
notification.title,
|
notification.title,
|
||||||
@@ -235,15 +235,13 @@ NotificationStorage.prototype = {
|
|||||||
notification.icon,
|
notification.icon,
|
||||||
notification.data,
|
notification.data,
|
||||||
notification.mozbehavior,
|
notification.mozbehavior,
|
||||||
notification.serviceWorkerRegistrationScope),
|
notification.serviceWorkerRegistrationScope));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DEBUG) { debug("Error calling callback handle: " + e); }
|
if (DEBUG) { debug("Error calling callback handle: " + e); }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
Services.tm.currentThread.dispatch(callback.done,
|
Services.tm.dispatchToMainThread(callback.done);
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (DEBUG) { debug("Error calling callback done: " + e); }
|
if (DEBUG) { debug("Error calling callback done: " + e); }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,19 +124,19 @@ PresentationControlService.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_notifyServerReady: function() {
|
_notifyServerReady: function() {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
if (this._listener) {
|
if (this._listener) {
|
||||||
this._listener.onServerReady(this._port, this.certFingerprint);
|
this._listener.onServerReady(this._port, this.certFingerprint);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_notifyServerStopped: function(aRv) {
|
_notifyServerStopped: function(aRv) {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
if (this._listener) {
|
if (this._listener) {
|
||||||
this._listener.onServerStopped(aRv);
|
this._listener.onServerStopped(aRv);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
isCompatibleServer: function(aVersion) {
|
isCompatibleServer: function(aVersion) {
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ const mockControlChannelOfSender = {
|
|||||||
.notifyReconnected();
|
.notifyReconnected();
|
||||||
},
|
},
|
||||||
sendOffer: function(offer) {
|
sendOffer: function(offer) {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
mockControlChannelOfReceiver.onOffer(offer);
|
mockControlChannelOfReceiver.onOffer(offer);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
onAnswer: function(answer) {
|
onAnswer: function(answer) {
|
||||||
this._listener
|
this._listener
|
||||||
@@ -127,9 +127,9 @@ const mockControlChannelOfReceiver = {
|
|||||||
.onOffer(offer);
|
.onOffer(offer);
|
||||||
},
|
},
|
||||||
sendAnswer: function(answer) {
|
sendAnswer: function(answer) {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
mockControlChannelOfSender.onAnswer(answer);
|
mockControlChannelOfSender.onAnswer(answer);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
disconnect: function(reason) {
|
disconnect: function(reason) {
|
||||||
if (!this._listener) {
|
if (!this._listener) {
|
||||||
|
|||||||
@@ -804,9 +804,9 @@ function ignoreIncompatibleDevice() {
|
|||||||
let mockServerObj = {
|
let mockServerObj = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]),
|
||||||
startServer: function() {
|
startServer: function() {
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.listener.onServerReady(this.port, this.certFingerprint);
|
this.listener.onServerReady(this.port, this.certFingerprint);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
sessionRequest: function() {},
|
sessionRequest: function() {},
|
||||||
close: function() {},
|
close: function() {},
|
||||||
@@ -889,9 +889,9 @@ function ignoreSelfDevice() {
|
|||||||
let mockServerObj = {
|
let mockServerObj = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPresentationControlService]),
|
||||||
startServer: function() {
|
startServer: function() {
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.listener.onServerReady(this.port, this.certFingerprint);
|
this.listener.onServerReady(this.port, this.certFingerprint);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
sessionRequest: function() {},
|
sessionRequest: function() {},
|
||||||
close: function() {},
|
close: function() {},
|
||||||
@@ -1253,14 +1253,14 @@ function serverRetry() {
|
|||||||
startServer: function(encrypted, port) {
|
startServer: function(encrypted, port) {
|
||||||
if (!isRetrying) {
|
if (!isRetrying) {
|
||||||
isRetrying = true;
|
isRetrying = true;
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.listener.onServerStopped(Cr.NS_ERROR_FAILURE);
|
this.listener.onServerStopped(Cr.NS_ERROR_FAILURE);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
} else {
|
} else {
|
||||||
this.port = 54321;
|
this.port = 54321;
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.listener.onServerReady(this.port, this.certFingerprint);
|
this.listener.onServerReady(this.port, this.certFingerprint);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sessionRequest: function() {},
|
sessionRequest: function() {},
|
||||||
|
|||||||
@@ -1300,13 +1300,13 @@ DataCall.prototype = {
|
|||||||
if (this.state == NETWORK_STATE_CONNECTED) {
|
if (this.state == NETWORK_STATE_CONNECTED) {
|
||||||
// This needs to run asynchronously, to behave the same way as the case of
|
// This needs to run asynchronously, to behave the same way as the case of
|
||||||
// non-shared apn, see bug 1059110.
|
// non-shared apn, see bug 1059110.
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
// Do not notify if state changed while this event was being dispatched,
|
// Do not notify if state changed while this event was being dispatched,
|
||||||
// the state probably was notified already or need not to be notified.
|
// the state probably was notified already or need not to be notified.
|
||||||
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_CONNECTED) {
|
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_CONNECTED) {
|
||||||
aNetworkInterface.notifyRILNetworkInterface();
|
aNetworkInterface.notifyRILNetworkInterface();
|
||||||
}
|
}
|
||||||
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1431,7 +1431,7 @@ DataCall.prototype = {
|
|||||||
// Notify the DISCONNECTED event immediately after network interface is
|
// Notify the DISCONNECTED event immediately after network interface is
|
||||||
// removed from requestedNetworkIfaces, to make the DataCall, shared or
|
// removed from requestedNetworkIfaces, to make the DataCall, shared or
|
||||||
// not, to have the same behavior.
|
// not, to have the same behavior.
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
// Do not notify if state changed while this event was being dispatched,
|
// Do not notify if state changed while this event was being dispatched,
|
||||||
// the state probably was notified already or need not to be notified.
|
// the state probably was notified already or need not to be notified.
|
||||||
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_DISCONNECTED) {
|
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_DISCONNECTED) {
|
||||||
@@ -1442,7 +1442,7 @@ DataCall.prototype = {
|
|||||||
this.resetLinkInfo();
|
this.resetLinkInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only deactivate data call if no more network interface needs this
|
// Only deactivate data call if no more network interface needs this
|
||||||
|
|||||||
@@ -115,9 +115,9 @@ NetworkWorkerRequestQueue.prototype = {
|
|||||||
this.tasks.shift();
|
this.tasks.shift();
|
||||||
if (this.tasks.length > 0) {
|
if (this.tasks.length > 0) {
|
||||||
// Run queue on the next tick.
|
// Run queue on the next tick.
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.runQueue();
|
this.runQueue();
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -593,9 +593,9 @@ TetheringService.prototype = {
|
|||||||
|
|
||||||
if (aCallback) {
|
if (aCallback) {
|
||||||
// Callback asynchronously to avoid netsted toggling.
|
// Callback asynchronously to avoid netsted toggling.
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
aCallback.wifiTetheringEnabledChange(aMsg);
|
aCallback.wifiTetheringEnabledChange(aMsg);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ function newGlobal() {
|
|||||||
addTestingFunctionsToGlobal(this);
|
addTestingFunctionsToGlobal(this);
|
||||||
|
|
||||||
function executeSoon(f) {
|
function executeSoon(f) {
|
||||||
Services.tm.mainThread.dispatch({ run: f },
|
Services.tm.dispatchToMainThread({ run: f });
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The onGarbageCollection tests don't play well gczeal settings and lead to
|
// The onGarbageCollection tests don't play well gczeal settings and lead to
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ function do_log_info(aMessage)
|
|||||||
// from the operation callback.
|
// from the operation callback.
|
||||||
function executeSoon(fn) {
|
function executeSoon(fn) {
|
||||||
var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||||
tm.mainThread.dispatch({run: fn}, Ci.nsIThread.DISPATCH_NORMAL);
|
tm.dispatchToMainThread({run: fn});
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ InternalPrompt.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(runnable, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
},
|
},
|
||||||
|
|
||||||
asyncPromptAuth: function asyncPromptAuth(aChannel, aCallback, aContext, aLevel, aAuthInfo) {
|
asyncPromptAuth: function asyncPromptAuth(aChannel, aCallback, aContext, aLevel, aAuthInfo) {
|
||||||
|
|||||||
@@ -327,9 +327,9 @@ class TabTracker extends TabTrackerBase {
|
|||||||
let windowId = windowTracker.getId(nativeTab.browser.ownerGlobal);
|
let windowId = windowTracker.getId(nativeTab.browser.ownerGlobal);
|
||||||
let tabId = this.getId(nativeTab);
|
let tabId = this.getId(nativeTab);
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.emit("tab-removed", {nativeTab, tabId, windowId, isWindowClosing});
|
this.emit("tab-removed", {nativeTab, tabId, windowId, isWindowClosing});
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBrowserData(browser) {
|
getBrowserData(browser) {
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ function RemoteMedia(id, listener) {
|
|||||||
this._listener = listener;
|
this._listener = listener;
|
||||||
|
|
||||||
if ("onRemoteMediaStart" in this._listener) {
|
if ("onRemoteMediaStart" in this._listener) {
|
||||||
Services.tm.mainThread.dispatch((function() {
|
Services.tm.dispatchToMainThread((function() {
|
||||||
this._listener.onRemoteMediaStart(this);
|
this._listener.onRemoteMediaStart(this);
|
||||||
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}).bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
var domWindowUtils = gWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
var domWindowUtils = gWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||||
|
|
||||||
function runSoon(f) {
|
function runSoon(f) {
|
||||||
threadMan.mainThread.dispatch({ run: f }, Ci.nsIThread.DISPATCH_NORMAL);
|
threadMan.dispatchToMainThread({ run: f });
|
||||||
}
|
}
|
||||||
|
|
||||||
function cc() {
|
function cc() {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
|||||||
let url = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.html";
|
let url = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.html";
|
||||||
browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
||||||
browser.addEventListener("load", function(event) {
|
browser.addEventListener("load", function(event) {
|
||||||
Services.tm.mainThread.dispatch(test_video, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(test_video);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ function do_execute_soon(callback) {
|
|||||||
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
||||||
.getService(Components.interfaces.nsIThreadManager);
|
.getService(Components.interfaces.nsIThreadManager);
|
||||||
|
|
||||||
tm.mainThread.dispatch({
|
tm.dispatchToMainThread({
|
||||||
run: function() {
|
run: function() {
|
||||||
try {
|
try {
|
||||||
callback();
|
callback();
|
||||||
@@ -225,7 +225,7 @@ function do_execute_soon(callback) {
|
|||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_throw(text, stack) {
|
function do_throw(text, stack) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var browser;
|
|||||||
|
|
||||||
function setHandlerFunc(handler, test) {
|
function setHandlerFunc(handler, test) {
|
||||||
browser.addEventListener("DOMLinkAdded", function(event) {
|
browser.addEventListener("DOMLinkAdded", function(event) {
|
||||||
Services.tm.mainThread.dispatch(handler.bind(this, test), Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(handler.bind(this, test));
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ add_test(function setup_browser() {
|
|||||||
let url = "http://mochi.test:8888/tests/robocop/link_discovery.html";
|
let url = "http://mochi.test:8888/tests/robocop/link_discovery.html";
|
||||||
browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
||||||
browser.addEventListener("load", function(event) {
|
browser.addEventListener("load", function(event) {
|
||||||
Services.tm.mainThread.dispatch(run_next_test, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(run_next_test);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ add_test(function setup_browser() {
|
|||||||
let url = "about:blank";
|
let url = "about:blank";
|
||||||
gBrowser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
gBrowser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
|
||||||
gBrowser.addEventListener("load", function(event) {
|
gBrowser.addEventListener("load", function(event) {
|
||||||
Services.tm.mainThread.dispatch(run_next_test, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(run_next_test);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ add_task(function* test_tracking_pb() {
|
|||||||
let browser = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id, isPrivate: true }).browser;
|
let browser = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id, isPrivate: true }).browser;
|
||||||
yield new Promise((resolve, reject) => {
|
yield new Promise((resolve, reject) => {
|
||||||
browser.addEventListener("load", function(event) {
|
browser.addEventListener("load", function(event) {
|
||||||
Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ add_task(function* test_tracking_not_pb() {
|
|||||||
let browser = BrowserApp.addTab("about:blank", { selected: true }).browser;
|
let browser = BrowserApp.addTab("about:blank", { selected: true }).browser;
|
||||||
yield new Promise((resolve, reject) => {
|
yield new Promise((resolve, reject) => {
|
||||||
browser.addEventListener("load", function(event) {
|
browser.addEventListener("load", function(event) {
|
||||||
Services.tm.mainThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ add_test(function setup_browser() {
|
|||||||
video = contentDocument.getElementById("video");
|
video = contentDocument.getElementById("video");
|
||||||
ok(video, "Found the video element");
|
ok(video, "Found the video element");
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(run_next_test, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(run_next_test);
|
||||||
}, {capture: true, once: true});
|
}, {capture: true, once: true});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -47,14 +47,14 @@ add_test(function test_webm() {
|
|||||||
// Load the test video
|
// Load the test video
|
||||||
video.src = "http://mochi.test:8888/tests/robocop/video-pattern.webm";
|
video.src = "http://mochi.test:8888/tests/robocop/video-pattern.webm";
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(testLoad, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(testLoad);
|
||||||
});
|
});
|
||||||
|
|
||||||
add_test(function test_ogg() {
|
add_test(function test_ogg() {
|
||||||
// Load the test video
|
// Load the test video
|
||||||
video.src = "http://mochi.test:8888/tests/robocop/video-pattern.ogg";
|
video.src = "http://mochi.test:8888/tests/robocop/video-pattern.ogg";
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(testLoad, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(testLoad);
|
||||||
});
|
});
|
||||||
|
|
||||||
function getButtonByAttribute(aName, aValue) {
|
function getButtonByAttribute(aName, aValue) {
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ document.getElementById('form').submit();
|
|||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
},
|
},
|
||||||
asyncOpen2: function(aListener) {
|
asyncOpen2: function(aListener) {
|
||||||
this.asyncOpen(aListener, null);
|
this.asyncOpen(aListener, null);
|
||||||
|
|||||||
@@ -1616,7 +1616,7 @@ CopyTest.prototype =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -285,8 +285,7 @@ function handleAsyncOrdering(request, response)
|
|||||||
// Use gThreadManager here because it's expedient, *not* because it's
|
// Use gThreadManager here because it's expedient, *not* because it's
|
||||||
// intended for public use! If you do this in client code, expect me to
|
// intended for public use! If you do this in client code, expect me to
|
||||||
// knowingly break your code by changing the variable name. :-P
|
// knowingly break your code by changing the variable name. :-P
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
step();
|
step();
|
||||||
response.processAsync();
|
response.processAsync();
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ function checkException(fun, err, msg)
|
|||||||
|
|
||||||
function callASAPLater(fun)
|
function callASAPLater(fun)
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
fun();
|
fun();
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ this.CommonUtils = {
|
|||||||
if (thisObj) {
|
if (thisObj) {
|
||||||
callback = callback.bind(thisObj);
|
callback = callback.bind(thisObj);
|
||||||
}
|
}
|
||||||
Services.tm.currentThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ this.Credentials = Object.freeze({
|
|||||||
deferred.resolve(result);
|
deferred.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.tm.currentThread.dispatch(runnable,
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
log.debug("Dispatched thread for credentials setup crypto work");
|
log.debug("Dispatched thread for credentials setup crypto work");
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ let SyncedTabsInternal = {
|
|||||||
// Sync is currently synchronous, so do it after an event-loop spin to help
|
// Sync is currently synchronous, so do it after an event-loop spin to help
|
||||||
// keep the UI responsive.
|
// keep the UI responsive.
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
try {
|
try {
|
||||||
log.info("Doing a tab sync.");
|
log.info("Doing a tab sync.");
|
||||||
Weave.Service.sync(["tabs"]);
|
Weave.Service.sync(["tabs"]);
|
||||||
@@ -181,7 +181,7 @@ let SyncedTabsInternal = {
|
|||||||
log.error("Sync failed", ex);
|
log.error("Sync failed", ex);
|
||||||
reject(ex);
|
reject(ex);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -495,8 +495,7 @@ nsHttpServer.prototype =
|
|||||||
self._notifyStopped();
|
self._notifyStopped();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(stopEvent);
|
||||||
.dispatch(stopEvent, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -2856,8 +2855,7 @@ ServerHandler.prototype =
|
|||||||
|
|
||||||
function writeMore()
|
function writeMore()
|
||||||
{
|
{
|
||||||
gThreadManager.currentThread
|
gThreadManager.dispatchToMainThread(writeData);
|
||||||
.dispatch(writeData, Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var input = new BinaryInputStream(fis);
|
var input = new BinaryInputStream(fis);
|
||||||
@@ -3929,13 +3927,13 @@ Response.prototype =
|
|||||||
// way to handle both cases without removing bodyOutputStream access and
|
// way to handle both cases without removing bodyOutputStream access and
|
||||||
// moving its effective write(data, length) method onto Response, which
|
// moving its effective write(data, length) method onto Response, which
|
||||||
// would be slower and require more code than this anyway.
|
// would be slower and require more code than this anyway.
|
||||||
gThreadManager.currentThread.dispatch({
|
gThreadManager.dispatchToMainThread({
|
||||||
run: function()
|
run: function()
|
||||||
{
|
{
|
||||||
dumpn("*** canceling copy asynchronously...");
|
dumpn("*** canceling copy asynchronously...");
|
||||||
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
copier.cancel(Cr.NS_ERROR_UNEXPECTED);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -4684,7 +4682,7 @@ WriteThroughCopier.prototype =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gThreadManager.currentThread.dispatch(event, Ci.nsIThread.DISPATCH_NORMAL);
|
gThreadManager.dispatchToMainThread(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
|
|
||||||
function executeSoon(callback) {
|
function executeSoon(callback) {
|
||||||
let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||||
tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
tm.dispatchToMainThread(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function waitForFocus(callback, win) {
|
function waitForFocus(callback, win) {
|
||||||
|
|||||||
@@ -949,11 +949,11 @@ function testScope(aTester, aTest, expected) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.executeSoon = function test_executeSoon(func) {
|
this.executeSoon = function test_executeSoon(func) {
|
||||||
Services.tm.mainThread.dispatch({
|
Services.tm.dispatchToMainThread({
|
||||||
run: function() {
|
run: function() {
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.waitForExplicitFinish = function test_waitForExplicitFinish() {
|
this.waitForExplicitFinish = function test_waitForExplicitFinish() {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||||||
|
|
||||||
this.TestUtils = {
|
this.TestUtils = {
|
||||||
executeSoon(callbackFn) {
|
executeSoon(callbackFn) {
|
||||||
Services.tm.mainThread.dispatch(callbackFn, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callbackFn);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -343,9 +343,9 @@ SPConsoleListener.prototype = {
|
|||||||
|
|
||||||
// Run in a separate runnable since console listeners aren't
|
// Run in a separate runnable since console listeners aren't
|
||||||
// supposed to touch content and this one might.
|
// supposed to touch content and this one might.
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.callback.call(undefined, m);
|
this.callback.call(undefined, m);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
|
|
||||||
if (!m.isScriptError && m.message === "SENTINEL")
|
if (!m.isScriptError && m.message === "SENTINEL")
|
||||||
Services.console.unregisterListener(this);
|
Services.console.unregisterListener(this);
|
||||||
@@ -1237,13 +1237,13 @@ SpecialPowersAPI.prototype = {
|
|||||||
obs.observe = wrapCallback(obs.observe);
|
obs.observe = wrapCallback(obs.observe);
|
||||||
}
|
}
|
||||||
let asyncObs = (...args) => {
|
let asyncObs = (...args) => {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
if (typeof obs == 'function') {
|
if (typeof obs == 'function') {
|
||||||
obs.call(undefined, ...args);
|
obs.call(undefined, ...args);
|
||||||
} else {
|
} else {
|
||||||
obs.observe.call(undefined, ...args);
|
obs.observe.call(undefined, ...args);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
};
|
};
|
||||||
this._asyncObservers.set(obs, asyncObs);
|
this._asyncObservers.set(obs, asyncObs);
|
||||||
Services.obs.addObserver(asyncObs, notification, weak);
|
Services.obs.addObserver(asyncObs, notification, weak);
|
||||||
@@ -2139,13 +2139,13 @@ SpecialPowersAPI.prototype = {
|
|||||||
Cc["@mozilla.org/url-classifier/dbservice;1"].getService(Ci.nsIURIClassifier);
|
Cc["@mozilla.org/url-classifier/dbservice;1"].getService(Ci.nsIURIClassifier);
|
||||||
|
|
||||||
let wrapCallback = (...args) => {
|
let wrapCallback = (...args) => {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
if (typeof callback == 'function') {
|
if (typeof callback == 'function') {
|
||||||
callback.call(undefined, ...args);
|
callback.call(undefined, ...args);
|
||||||
} else {
|
} else {
|
||||||
callback.onClassifyComplete.call(undefined, ...args);
|
callback.onClassifyComplete.call(undefined, ...args);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return classifierService.classify(unwrapIfWrapped(principal), eventTarget,
|
return classifierService.classify(unwrapIfWrapped(principal), eventTarget,
|
||||||
@@ -2158,13 +2158,13 @@ SpecialPowersAPI.prototype = {
|
|||||||
Cc["@mozilla.org/url-classifier/dbservice;1"].getService(Ci.nsIURIClassifier);
|
Cc["@mozilla.org/url-classifier/dbservice;1"].getService(Ci.nsIURIClassifier);
|
||||||
|
|
||||||
let wrapCallback = (...args) => {
|
let wrapCallback = (...args) => {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
if (typeof callback == 'function') {
|
if (typeof callback == 'function') {
|
||||||
callback.call(undefined, ...args);
|
callback.call(undefined, ...args);
|
||||||
} else {
|
} else {
|
||||||
callback.onClassifyComplete.call(undefined, ...args);
|
callback.onClassifyComplete.call(undefined, ...args);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return classifierService.asyncClassifyLocalWithTables(unwrapIfWrapped(uri),
|
return classifierService.asyncClassifyLocalWithTables(unwrapIfWrapped(uri),
|
||||||
|
|||||||
@@ -697,7 +697,7 @@ function do_execute_soon(callback, aName) {
|
|||||||
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
||||||
.getService(Components.interfaces.nsIThreadManager);
|
.getService(Components.interfaces.nsIThreadManager);
|
||||||
|
|
||||||
tm.mainThread.dispatch({
|
tm.dispatchToMainThread({
|
||||||
run: function() {
|
run: function() {
|
||||||
try {
|
try {
|
||||||
callback();
|
callback();
|
||||||
@@ -722,7 +722,7 @@ function do_execute_soon(callback, aName) {
|
|||||||
do_test_finished(funcName);
|
do_test_finished(funcName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ AboutProtocolChannel.prototype = {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
},
|
},
|
||||||
|
|
||||||
asyncOpen2(listener) {
|
asyncOpen2(listener) {
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ function testAboutModuleRegistration() {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Services.tm.currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
},
|
},
|
||||||
|
|
||||||
asyncOpen2(listener) {
|
asyncOpen2(listener) {
|
||||||
|
|||||||
@@ -784,8 +784,7 @@ ContentPrefService2.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_schedule: function CPS2__schedule(fn) {
|
_schedule: function CPS2__schedule(fn) {
|
||||||
Services.tm.mainThread.dispatch(fn.bind(this),
|
Services.tm.dispatchToMainThread(fn.bind(this));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addObserverForName: function CPS2_addObserverForName(name, observer) {
|
addObserverForName: function CPS2_addObserverForName(name, observer) {
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ ContentPrefService.prototype = {
|
|||||||
|
|
||||||
_scheduleCallback(func) {
|
_scheduleCallback(func) {
|
||||||
let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
let tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||||
tm.mainThread.dispatch(func, Ci.nsIThread.DISPATCH_NORMAL);
|
tm.dispatchToMainThread(func);
|
||||||
},
|
},
|
||||||
|
|
||||||
_selectPref: function ContentPrefService__selectPref(aGroup, aSetting, aCallback) {
|
_selectPref: function ContentPrefService__selectPref(aGroup, aSetting, aCallback) {
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ nsFilePicker.prototype = {
|
|||||||
open(aFilePickerShownCallback) {
|
open(aFilePickerShownCallback) {
|
||||||
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
var tm = Components.classes["@mozilla.org/thread-manager;1"]
|
||||||
.getService(Components.interfaces.nsIThreadManager);
|
.getService(Components.interfaces.nsIThreadManager);
|
||||||
tm.mainThread.dispatch(() => {
|
tm.dispatchToMainThread(() => {
|
||||||
let result = Components.interfaces.nsIFilePicker.returnCancel;
|
let result = Components.interfaces.nsIFilePicker.returnCancel;
|
||||||
try {
|
try {
|
||||||
result = this.show();
|
result = this.show();
|
||||||
@@ -248,7 +248,7 @@ nsFilePicker.prototype = {
|
|||||||
aFilePickerShownCallback.done(result);
|
aFilePickerShownCallback.done(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ FormHandler.prototype = {
|
|||||||
*/
|
*/
|
||||||
waitForTick() {
|
waitForTick() {
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
Services.tm.currentThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ LoginManagerPromptFactory.prototype = {
|
|||||||
prompt.inProgress = true;
|
prompt.inProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(runnable, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(runnable);
|
||||||
this.log("_doAsyncPrompt:run dispatched");
|
this.log("_doAsyncPrompt:run dispatched");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ BufferedObserver.prototype.observe = function(source, details) {
|
|||||||
this._buffer.push({source, details});
|
this._buffer.push({source, details});
|
||||||
if (!this._isDispatching) {
|
if (!this._isDispatching) {
|
||||||
this._isDispatching = true;
|
this._isDispatching = true;
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
// Grab buffer, in case something in the listener could modify it.
|
// Grab buffer, in case something in the listener could modify it.
|
||||||
let buffer = this._buffer;
|
let buffer = this._buffer;
|
||||||
this._buffer = [];
|
this._buffer = [];
|
||||||
@@ -284,7 +284,7 @@ BufferedObserver.prototype.observe = function(source, details) {
|
|||||||
this._isDispatching = false;
|
this._isDispatching = false;
|
||||||
|
|
||||||
this._listener(buffer);
|
this._listener(buffer);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1560,7 +1560,7 @@ this.PlacesUtils = {
|
|||||||
|
|
||||||
// Delaying to catch issues with asynchronous behavior while waiting
|
// Delaying to catch issues with asynchronous behavior while waiting
|
||||||
// to implement asynchronous annotations in bug 699844.
|
// to implement asynchronous annotations in bug 699844.
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
if (aCharset && aCharset.length > 0) {
|
if (aCharset && aCharset.length > 0) {
|
||||||
PlacesUtils.annotations.setPageAnnotation(
|
PlacesUtils.annotations.setPageAnnotation(
|
||||||
aURI, PlacesUtils.CHARSET_ANNO, aCharset, 0,
|
aURI, PlacesUtils.CHARSET_ANNO, aCharset, 0,
|
||||||
@@ -1570,7 +1570,7 @@ this.PlacesUtils = {
|
|||||||
aURI, PlacesUtils.CHARSET_ANNO);
|
aURI, PlacesUtils.CHARSET_ANNO);
|
||||||
}
|
}
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
},
|
||||||
@@ -1585,7 +1585,7 @@ this.PlacesUtils = {
|
|||||||
getCharsetForURI: function PU_getCharsetForURI(aURI) {
|
getCharsetForURI: function PU_getCharsetForURI(aURI) {
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
let charset = null;
|
let charset = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1594,7 +1594,7 @@ this.PlacesUtils = {
|
|||||||
} catch (ex) { }
|
} catch (ex) { }
|
||||||
|
|
||||||
deferred.resolve(charset);
|
deferred.resolve(charset);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
},
|
||||||
@@ -1975,7 +1975,7 @@ this.PlacesUtils = {
|
|||||||
// So we let everyone else have a go every few items (bug 1186714).
|
// So we let everyone else have a go every few items (bug 1186714).
|
||||||
if (++yieldCounter % 50 == 0) {
|
if (++yieldCounter % 50 == 0) {
|
||||||
yield new Promise(resolve => {
|
yield new Promise(resolve => {
|
||||||
Services.tm.currentThread.dispatch(resolve, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -676,9 +676,9 @@ Livemark.prototype = {
|
|||||||
let nodes = this._nodes.get(container);
|
let nodes = this._nodes.get(container);
|
||||||
for (let node of nodes) {
|
for (let node of nodes) {
|
||||||
if (!aURI || node.uri == aURI.spec) {
|
if (!aURI || node.uri == aURI.spec) {
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
observer.nodeHistoryDetailsChanged(node, 0, aVisitedStatus);
|
observer.nodeHistoryDetailsChanged(node, 0, aVisitedStatus);
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,14 +133,14 @@ add_task(function* shutdown() {
|
|||||||
Services.obs.removeObserver(onNotification, "places-will-close-connection");
|
Services.obs.removeObserver(onNotification, "places-will-close-connection");
|
||||||
do_check_true(true, "Observed fake places shutdown");
|
do_check_true(true, "Observed fake places shutdown");
|
||||||
|
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
// WARNING: this is very bad, never use out of testing code.
|
// WARNING: this is very bad, never use out of testing code.
|
||||||
PlacesUtils.bookmarks.QueryInterface(Ci.nsINavHistoryObserver)
|
PlacesUtils.bookmarks.QueryInterface(Ci.nsINavHistoryObserver)
|
||||||
.onPageChanged(NetUtil.newURI("http://book.ma.rk/"),
|
.onPageChanged(NetUtil.newURI("http://book.ma.rk/"),
|
||||||
Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON,
|
Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON,
|
||||||
"test", "test");
|
"test", "test");
|
||||||
deferred.resolve(promiseTopicObserved("places-connection-closed"));
|
deferred.resolve(promiseTopicObserved("places-connection-closed"));
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}, "places-will-close-connection");
|
}, "places-will-close-connection");
|
||||||
shutdownPlaces();
|
shutdownPlaces();
|
||||||
|
|
||||||
|
|||||||
@@ -284,11 +284,10 @@
|
|||||||
// runnable, and if exiting moral state posts a runnable we will
|
// runnable, and if exiting moral state posts a runnable we will
|
||||||
// incorrectly process that runnable before leaving our event
|
// incorrectly process that runnable before leaving our event
|
||||||
// loop spin.
|
// loop spin.
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
this.Dialog["onButton" + buttonNum]();
|
this.Dialog["onButton" + buttonNum]();
|
||||||
this.shutdownPrompt();
|
this.shutdownPrompt();
|
||||||
},
|
});
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|||||||
@@ -2637,7 +2637,7 @@ const gEmptyParseSubmissionResult =
|
|||||||
Object.freeze(new ParseSubmissionResult(null, "", -1, 0));
|
Object.freeze(new ParseSubmissionResult(null, "", -1, 0));
|
||||||
|
|
||||||
function executeSoon(func) {
|
function executeSoon(func) {
|
||||||
Services.tm.mainThread.dispatch(func, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1974,12 +1974,12 @@ var Impl = {
|
|||||||
case "idle-daily":
|
case "idle-daily":
|
||||||
// Enqueue to main-thread, otherwise components may be inited by the
|
// Enqueue to main-thread, otherwise components may be inited by the
|
||||||
// idle-daily category and miss the gather-telemetry notification.
|
// idle-daily category and miss the gather-telemetry notification.
|
||||||
Services.tm.mainThread.dispatch((function() {
|
Services.tm.dispatchToMainThread((function() {
|
||||||
// Notify that data should be gathered now.
|
// Notify that data should be gathered now.
|
||||||
// TODO: We are keeping this behaviour for now but it will be removed as soon as
|
// TODO: We are keeping this behaviour for now but it will be removed as soon as
|
||||||
// bug 1127907 lands.
|
// bug 1127907 lands.
|
||||||
Services.obs.notifyObservers(null, "gather-telemetry");
|
Services.obs.notifyObservers(null, "gather-telemetry");
|
||||||
}), Ci.nsIThread.DISPATCH_NORMAL);
|
}));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "application-background":
|
case "application-background":
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ const PingServer = {
|
|||||||
const deferred = this._defers[this._currentDeferred++];
|
const deferred = this._defers[this._currentDeferred++];
|
||||||
// Send the ping to the consumer on the next tick, so that the completion gets
|
// Send the ping to the consumer on the next tick, so that the completion gets
|
||||||
// signaled to Telemetry.
|
// signaled to Telemetry.
|
||||||
return new Promise(r => Services.tm.currentThread.dispatch(() => r(deferred.promise),
|
return new Promise(r => Services.tm.dispatchToMainThread(() => r(deferred.promise)));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
promiseNextPing() {
|
promiseNextPing() {
|
||||||
@@ -315,7 +314,7 @@ if (runningInParent) {
|
|||||||
|
|
||||||
|
|
||||||
fakePingSendTimer((callback, timeout) => {
|
fakePingSendTimer((callback, timeout) => {
|
||||||
Services.tm.mainThread.dispatch(() => callback(), Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(() => callback());
|
||||||
},
|
},
|
||||||
() => {});
|
() => {});
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ add_task(function* test_pingSender() {
|
|||||||
|
|
||||||
if (hitCount >= 2) {
|
if (hitCount >= 2) {
|
||||||
// Resolve the promise on the next tick.
|
// Resolve the promise on the next tick.
|
||||||
Services.tm.currentThread.dispatch(() => deferred404Hit.resolve(),
|
Services.tm.dispatchToMainThread(() => deferred404Hit.resolve());
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
failingServer.start(-1);
|
failingServer.start(-1);
|
||||||
|
|||||||
@@ -264,9 +264,9 @@ const BackgroundPageThumbs = {
|
|||||||
// browser's message manager if it happens on the same stack as the
|
// browser's message manager if it happens on the same stack as the
|
||||||
// listener. Trying to send a message to the manager in that case
|
// listener. Trying to send a message to the manager in that case
|
||||||
// throws NS_ERROR_NOT_INITIALIZED.
|
// throws NS_ERROR_NOT_INITIALIZED.
|
||||||
Services.tm.currentThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
|
curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
|
||||||
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
// else: we must have been idle and not currently doing a capture (eg,
|
// else: we must have been idle and not currently doing a capture (eg,
|
||||||
// maybe a GC or similar crashed) - so there's no need to attempt a
|
// maybe a GC or similar crashed) - so there's no need to attempt a
|
||||||
@@ -502,5 +502,5 @@ function tel(histogramID, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function schedule(callback) {
|
function schedule(callback) {
|
||||||
Services.tm.mainThread.dispatch(callback, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(callback);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ HashCompleter.prototype = {
|
|||||||
|
|
||||||
// Start off this request. Without dispatching to a thread, every call to
|
// Start off this request. Without dispatching to a thread, every call to
|
||||||
// complete makes an individual HTTP request.
|
// complete makes an individual HTTP request.
|
||||||
Services.tm.currentThread.dispatch(this, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// This is called after several calls to |complete|, or after the
|
// This is called after several calls to |complete|, or after the
|
||||||
@@ -273,7 +273,7 @@ HashCompleter.prototype = {
|
|||||||
// gethashUrl and fetch the next pending request, if there is one.
|
// gethashUrl and fetch the next pending request, if there is one.
|
||||||
finishRequest: function(url, aStatus) {
|
finishRequest: function(url, aStatus) {
|
||||||
this._backoffs[url].noteServerResponse(aStatus);
|
this._backoffs[url].noteServerResponse(aStatus);
|
||||||
Services.tm.currentThread.dispatch(this, Ci.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns true if we can make a request from the given url, false otherwise.
|
// Returns true if we can make a request from the given url, false otherwise.
|
||||||
|
|||||||
@@ -656,7 +656,7 @@ var Printing = {
|
|||||||
// The print preview docshell will be in a different TabGroup,
|
// The print preview docshell will be in a different TabGroup,
|
||||||
// so we run it in a separate runnable to avoid touching a
|
// so we run it in a separate runnable to avoid touching a
|
||||||
// different TabGroup in our own runnable.
|
// different TabGroup in our own runnable.
|
||||||
Services.tm.mainThread.dispatch(() => {
|
Services.tm.dispatchToMainThread(() => {
|
||||||
try {
|
try {
|
||||||
docShell.printPreview.printPreview(printSettings, contentWindow, this);
|
docShell.printPreview.printPreview(printSettings, contentWindow, this);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -665,7 +665,7 @@ var Printing = {
|
|||||||
Components.utils.reportError(error);
|
Components.utils.reportError(error);
|
||||||
notifyEntered(error);
|
notifyEntered(error);
|
||||||
}
|
}
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// This might fail if we, for example, attempt to print a XUL document.
|
// This might fail if we, for example, attempt to print a XUL document.
|
||||||
// In that case, we inform the parent to bail out of print preview.
|
// In that case, we inform the parent to bail out of print preview.
|
||||||
|
|||||||
@@ -690,9 +690,9 @@ function promiseTargetFile(aFpP, /* optional */ aSkipPrompt, /* optional */ aRel
|
|||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
if (useDownloadDir) {
|
if (useDownloadDir) {
|
||||||
// Keep async behavior in both branches
|
// Keep async behavior in both branches
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
deferred.resolve(null);
|
deferred.resolve(null);
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
} else {
|
} else {
|
||||||
downloadLastDir.getFileAsync(aRelatedURI, function getFileAsyncCB(aFile) {
|
downloadLastDir.getFileAsync(aRelatedURI, function getFileAsyncCB(aFile) {
|
||||||
deferred.resolve(aFile);
|
deferred.resolve(aFile);
|
||||||
|
|||||||
@@ -346,7 +346,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch something to ensure that the main thread wakes up.
|
// Dispatch something to ensure that the main thread wakes up.
|
||||||
Services.tm.mainThread.dispatch(function() {}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(function() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
let timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
|
let timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
|
||||||
|
|||||||
@@ -382,9 +382,9 @@ function waitForPurgeNotification() {
|
|||||||
// test_storage_cleared needs this extra executeSoon because
|
// test_storage_cleared needs this extra executeSoon because
|
||||||
// the DOMStorage clean-up is also listening to this same observer
|
// the DOMStorage clean-up is also listening to this same observer
|
||||||
// which is run synchronously.
|
// which is run synchronously.
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Services.obs.addObserver(observer, "browser:purge-domain-data");
|
Services.obs.addObserver(observer, "browser:purge-domain-data");
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ this.PropertyListUtils = Object.freeze({
|
|||||||
|
|
||||||
// We guarantee not to throw directly for any other exceptions, and always
|
// We guarantee not to throw directly for any other exceptions, and always
|
||||||
// call aCallback.
|
// call aCallback.
|
||||||
Services.tm.mainThread.dispatch(function() {
|
Services.tm.dispatchToMainThread(function() {
|
||||||
let self = this;
|
let self = this;
|
||||||
function readDOMFile(aFile) {
|
function readDOMFile(aFile) {
|
||||||
let fileReader = new FileReader();
|
let fileReader = new FileReader();
|
||||||
@@ -126,7 +126,7 @@ this.PropertyListUtils = Object.freeze({
|
|||||||
aCallback(null);
|
aCallback(null);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -151,8 +151,7 @@ this.Troubleshoot = {
|
|||||||
snapshot[providerName] = providerData;
|
snapshot[providerName] = providerData;
|
||||||
if (--numPending == 0)
|
if (--numPending == 0)
|
||||||
// Ensure that done is always and truly called asynchronously.
|
// Ensure that done is always and truly called asynchronously.
|
||||||
Services.tm.mainThread.dispatch(done.bind(null, snapshot),
|
Services.tm.dispatchToMainThread(done.bind(null, snapshot));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
}
|
}
|
||||||
for (let name in dataProviders) {
|
for (let name in dataProviders) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ var RequestId = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function runLater(job) {
|
function runLater(job) {
|
||||||
Services.tm.currentThread.dispatch(job, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
Services.tm.dispatchToMainThread(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseFilter(filter) {
|
function parseFilter(filter) {
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
|||||||
*/
|
*/
|
||||||
function promiseResolvedLater(aValue) {
|
function promiseResolvedLater(aValue) {
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
Services.tm.mainThread.dispatch(() => deferred.resolve(aValue),
|
Services.tm.dispatchToMainThread(() => deferred.resolve(aValue));
|
||||||
Ci.nsIThread.DISPATCH_NORMAL);
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -148,8 +148,7 @@ DownloadLastDir.prototype = {
|
|||||||
getFileAsync(aURI, aCallback) {
|
getFileAsync(aURI, aCallback) {
|
||||||
let plainPrefFile = this._getLastFile();
|
let plainPrefFile = this._getLastFile();
|
||||||
if (!aURI || !isContentPrefEnabled()) {
|
if (!aURI || !isContentPrefEnabled()) {
|
||||||
Services.tm.mainThread.dispatch(() => aCallback(plainPrefFile),
|
Services.tm.dispatchToMainThread(() => aCallback(plainPrefFile));
|
||||||
Components.interfaces.nsIThread.DISPATCH_NORMAL);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ IncrementalDownload.prototype = {
|
|||||||
getService(Ci.nsIThreadManager);
|
getService(Ci.nsIThreadManager);
|
||||||
// Do the actual operation async to give a chance for observers
|
// Do the actual operation async to give a chance for observers
|
||||||
// to add themselves.
|
// to add themselves.
|
||||||
tm.mainThread.dispatch(function() {
|
tm.dispatchToMainThread(function() {
|
||||||
this._observer = observer.QueryInterface(Ci.nsIRequestObserver);
|
this._observer = observer.QueryInterface(Ci.nsIRequestObserver);
|
||||||
this._ctxt = ctxt;
|
this._ctxt = ctxt;
|
||||||
this._observer.onStartRequest(this, this._ctxt);
|
this._observer.onStartRequest(this, this._ctxt);
|
||||||
@@ -129,15 +129,15 @@ IncrementalDownload.prototype = {
|
|||||||
// status being changed to online.
|
// status being changed to online.
|
||||||
let tm2 = Cc["@mozilla.org/thread-manager;1"].
|
let tm2 = Cc["@mozilla.org/thread-manager;1"].
|
||||||
getService(Ci.nsIThreadManager);
|
getService(Ci.nsIThreadManager);
|
||||||
tm2.mainThread.dispatch(function() {
|
tm2.dispatchToMainThread(function() {
|
||||||
Services.obs.notifyObservers(gAUS,
|
Services.obs.notifyObservers(gAUS,
|
||||||
"network:offline-status-changed",
|
"network:offline-status-changed",
|
||||||
"online");
|
"online");
|
||||||
}, Ci.nsIThread.DISPATCH_NORMAL);
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this._observer.onStopRequest(this, this._ctxt, status);
|
this._observer.onStopRequest(this, this._ctxt, status);
|
||||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
get URI() {
|
get URI() {
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ function run_test() {
|
|||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
Components.classes["@mozilla.org/thread-manager;1"].
|
Components.classes["@mozilla.org/thread-manager;1"].
|
||||||
getService(Ci.nsIThreadManager).mainThread.dispatch(function() {
|
getService(Ci.nsIThreadManager).dispatchToMainThread(function() {
|
||||||
cs.unregisterListener(kConsoleListener);
|
cs.unregisterListener(kConsoleListener);
|
||||||
do_check_true(gFound);
|
do_check_true(gFound);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}, 0);
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user