Bug 1167704 - Remove SpiderMonkey specific syntax in browser/devtools/shared and browser/devtools/framework; r=jryans

This commit is contained in:
Patrick Brosset 2015-05-22 21:17:11 +02:00
parent 35b2198351
commit 2198b2a542
11 changed files with 35 additions and 27 deletions

View File

@ -29,7 +29,7 @@ function test() {
function runTests1(aTab) {
let toolDefinition = {
id: toolId1,
isTargetSupported: function() true,
isTargetSupported: () => true,
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
label: "someLabel",
@ -90,7 +90,7 @@ function runTests1(aTab) {
function runTests2() {
let toolDefinition = {
id: toolId2,
isTargetSupported: function() true,
isTargetSupported: () => true,
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
label: "someLabel",
@ -229,11 +229,17 @@ DevToolPanel.prototype = {
return deferred.promise;
},
get target() this._toolbox.target,
get target() {
return this._toolbox.target;
},
get toolbox() this._toolbox,
get toolbox() {
return this._toolbox;
},
get isReady() this._isReady,
get isReady() {
return this._isReady;
},
_isReady: false,

View File

@ -13,7 +13,7 @@ function runTests(aTab) {
let toolDefinition = {
id: "testTool",
visibilityswitch: "devtools.testTool.enabled",
isTargetSupported: function() true,
isTargetSupported: () => true,
url: "about:blank",
label: "someLabel",
build: function(iframeWindow, toolbox) {

View File

@ -26,7 +26,7 @@ function testRegister(aToolbox)
id: "test-tool",
label: "Test Tool",
inMenu: true,
isTargetSupported: function() true,
isTargetSupported: () => true,
build: function() {}
});
}

View File

@ -23,7 +23,7 @@ add_task(function*() {
function registerNewTool() {
let toolDefinition = {
id: "test-tool",
isTargetSupported: function() true,
isTargetSupported: () => true,
visibilityswitch: "devtools.test-tool.enabled",
url: "about:blank",
label: "someLabel"

View File

@ -27,7 +27,7 @@ function test() {
visibilityswitch: "devtools.fakeTool4242.enabled",
url: toolURL,
label: "FAKE TOOL!!!",
isTargetSupported: function() true,
isTargetSupported: () => true,
build: function(iframeWindow, toolbox) {
let deferred = promise.defer();
executeSoon(() => {
@ -35,7 +35,7 @@ function test() {
target: toolbox.target,
toolbox: toolbox,
isReady: true,
destroy: function(){},
destroy: function() {},
panelDoc: iframeWindow.document,
});
});

View File

@ -22,7 +22,7 @@ function test() {
visibilityswitch: "devtools.testTool1072208.enabled",
url: toolURL,
label: "Test tool",
isTargetSupported: function() true,
isTargetSupported: () => true,
build: function(iframeWindow, toolbox) {
let deferred = promise.defer();
executeSoon(() => {
@ -30,7 +30,7 @@ function test() {
target: toolbox.target,
toolbox: toolbox,
isReady: true,
destroy: function(){},
destroy: function() {},
panelDoc: iframeWindow.document,
});
});

View File

@ -4,12 +4,12 @@
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
function performChecks(target) {
return Task.spawn(function() {
return Task.spawn(function*() {
let toolIds = gDevTools.getToolDefinitionArray()
.filter(def => def.isTargetSupported(target))
.map(def => def.id);
@ -32,7 +32,7 @@ function performChecks(target) {
}
function test() {
Task.spawn(function() {
Task.spawn(function*() {
toggleAllTools(true);
let tab = yield addTab("about:blank");
let target = TargetFactory.forTab(tab);

View File

@ -4,7 +4,7 @@
///////////////////
//
// Whitelisting this test.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
// As part of bug 1077403, the leaking uncaught rejection should be fixed.
//
thisTestLeaksUncaughtRejectionsAndShouldBeFixed("Error: Shader Editor is still waiting for a WebGL context to be created.");
@ -40,7 +40,7 @@ const { DebuggerClient } =
*/
function runTools(target) {
return Task.spawn(function() {
return Task.spawn(function*() {
let toolIds = gDevTools.getToolDefinitionArray()
.filter(def => def.isTargetSupported(target))
.map(def => def.id);
@ -96,7 +96,7 @@ function getTarget(client) {
}
function test() {
Task.spawn(function() {
Task.spawn(function*() {
toggleAllTools(true);
yield addTab("about:blank");

View File

@ -23,20 +23,20 @@ function test() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
gDevTools.showToolbox(target, null, Toolbox.HostType.BOTTOM)
.then(function (aToolbox) { toolbox = aToolbox; })
.then(function () toolbox.selectTool(TOOL_ID_1))
.then(() => toolbox.selectTool(TOOL_ID_1))
// undock toolbox and check title
.then(function () toolbox.switchHost(Toolbox.HostType.WINDOW))
.then(() => toolbox.switchHost(Toolbox.HostType.WINDOW))
.then(checkTitle.bind(null, LABEL_1, URL_1, "toolbox undocked"))
// switch to different tool and check title
.then(function () toolbox.selectTool(TOOL_ID_2))
.then(() => toolbox.selectTool(TOOL_ID_2))
.then(checkTitle.bind(null, LABEL_2, URL_1, "tool changed"))
// navigate to different url and check title
.then(function () {
let deferred = promise.defer();
target.once("navigate", function () deferred.resolve());
target.once("navigate", () => deferred.resolve());
gBrowser.loadURI(URL_2);
return deferred.promise;
})
@ -55,12 +55,12 @@ function test() {
return gDevTools.showToolbox(target, null, Toolbox.HostType.WINDOW);
})
.then(function (aToolbox) { toolbox = aToolbox; })
.then(function () toolbox.selectTool(TOOL_ID_1))
.then(() => toolbox.selectTool(TOOL_ID_1))
.then(checkTitle.bind(null, LABEL_1, URL_2,
"toolbox destroyed and recreated"))
// clean up
.then(function () toolbox.destroy())
.then(() => toolbox.destroy())
.then(function () {
toolbox = null;
gBrowser.removeCurrentTab();

View File

@ -111,7 +111,7 @@ function testAdvanceCharsFunction(doc) {
return aText.length > 0;
},
start: function(editor) {
for each (let ch in ":Test:") {
for (let ch of ":Test:") {
EventUtils.sendChar(ch);
}
},

View File

@ -44,7 +44,7 @@ function promiseTab(aURL) {
addTab(aURL, resolve));
}
registerCleanupFunction(function tearDown() {
registerCleanupFunction(function* tearDown() {
let target = TargetFactory.forTab(gBrowser.selectedTab);
yield gDevTools.closeToolbox(target);
@ -126,7 +126,9 @@ function waitForValue(aOptions)
successFn(aOptions, lastValue);
}
else {
setTimeout(function() wait(validatorFn, successFn, failureFn), 100);
setTimeout(() => {
wait(validatorFn, successFn, failureFn);
}, 100);
}
}