Bug 1454813: Part 1b - Stop automatically exposing Task singleton to browser tests. r=florian

Now that Task.jsm is deprecated and add_task no longer accepts generators, it
doesn't make sense to continue making this automatically available in test
scopes.

MozReview-Commit-ID: AckO5nnFngG

--HG--
extra : rebase_source : 826b7cce67d9ab000d6385663c543bc72eef174b
This commit is contained in:
Kris Maglione 2018-04-19 14:52:47 -07:00
Родитель dfd8eb706c
Коммит f1f4e87948
3 изменённых файлов: 11 добавлений и 17 удалений

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

@ -19,12 +19,12 @@ let promise = require("promise");
* @param {String} hostType Optional. The type of toolbox host to be used.
* @return {Promise} Resolves with the toolbox, when it has been opened.
*/
var openToolboxForTab = Task.async(function* (tab, toolId, hostType) {
var openToolboxForTab = async function(tab, toolId, hostType) {
info("Opening the toolbox");
let toolbox;
let target = TargetFactory.forTab(tab);
yield target.makeRemote();
await target.makeRemote();
// Check if the toolbox is already loaded.
toolbox = gDevTools.getToolbox(target);
@ -36,15 +36,15 @@ var openToolboxForTab = Task.async(function* (tab, toolId, hostType) {
}
// If not, load it now.
toolbox = yield gDevTools.showToolbox(target, toolId, hostType);
toolbox = await gDevTools.showToolbox(target, toolId, hostType);
// Make sure that the toolbox frame is focused.
yield new Promise(resolve => waitForFocus(resolve, toolbox.win));
await new Promise(resolve => waitForFocus(resolve, toolbox.win));
info("Toolbox opened and focused");
return toolbox;
});
};
/**
* Find multiple messages in the output.

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

@ -21,12 +21,12 @@ let promise = require("promise");
* @param {String} hostType Optional. The type of toolbox host to be used.
* @return {Promise} Resolves with the toolbox, when it has been opened.
*/
var openToolboxForTab = Task.async(function* (tab, toolId, hostType) {
var openToolboxForTab = async function(tab, toolId, hostType) {
info("Opening the toolbox");
let toolbox;
let target = TargetFactory.forTab(tab);
yield target.makeRemote();
await target.makeRemote();
// Check if the toolbox is already loaded.
toolbox = gDevTools.getToolbox(target);
@ -38,15 +38,15 @@ var openToolboxForTab = Task.async(function* (tab, toolId, hostType) {
}
// If not, load it now.
toolbox = yield gDevTools.showToolbox(target, toolId, hostType);
toolbox = await gDevTools.showToolbox(target, toolId, hostType);
// Make sure that the toolbox frame is focused.
yield new Promise(resolve => waitForFocus(resolve, toolbox.win));
await new Promise(resolve => waitForFocus(resolve, toolbox.win));
info("Toolbox opened and focused");
return toolbox;
});
};
function console_observer(subject, topic, data) {

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

@ -5,7 +5,6 @@ var gConfig;
var gSaveInstrumentationData = null;
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Task.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
@ -409,11 +408,9 @@ function Tester(aTests, structuredLogger, aCallback) {
this.SimpleTest.harnessParameters = gConfig;
this.MemoryStats = simpleTestScope.MemoryStats;
this.Task = Task;
this.ContentTask = ChromeUtils.import("resource://testing-common/ContentTask.jsm", null).ContentTask;
this.BrowserTestUtils = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm", null).BrowserTestUtils;
this.TestUtils = ChromeUtils.import("resource://testing-common/TestUtils.jsm", null).TestUtils;
this.Task.Debugging.maintainStack = true;
this.Promise = ChromeUtils.import("resource://gre/modules/Promise.jsm", null).Promise;
this.PromiseTestUtils = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", null).PromiseTestUtils;
this.Assert = ChromeUtils.import("resource://testing-common/Assert.jsm", null).Assert;
@ -456,7 +453,6 @@ function Tester(aTests, structuredLogger, aCallback) {
Tester.prototype = {
EventUtils: {},
SimpleTest: {},
Task: null,
ContentTask: null,
ExtensionTestUtils: null,
Assert: null,
@ -990,7 +986,6 @@ Tester.prototype = {
scope.EventUtils = this.currentTest.usesUnsafeCPOWs ? this.cpowEventUtils : this.EventUtils;
scope.SimpleTest = this.SimpleTest;
scope.gTestPath = this.currentTest.path;
scope.Task = this.Task;
scope.ContentTask = this.ContentTask;
scope.BrowserTestUtils = this.BrowserTestUtils;
scope.TestUtils = this.TestUtils;
@ -1256,7 +1251,7 @@ function testResult({ name, pass, todo, ex, stack, allowFailure }) {
} else {
normalized = "" + stack;
}
this.msg += Task.Debugging.generateReadableStack(normalized, " ");
this.msg += normalized;
}
if (gConfig.debugOnFailure) {
@ -1424,7 +1419,6 @@ testScope.prototype = {
EventUtils: {},
SimpleTest: {},
Task: null,
ContentTask: null,
BrowserTestUtils: null,
TestUtils: null,