* @param {MozMillController} controller The browser's MozMill controller.
*/
function Controller(controller) {
- var self = this;
this.controller = controller;
/**
this.errorCount = 0;
- this._countBeep = function countBeep() {
- self.beepCount++;
+ this._countBeep = () => {
+ this.beepCount++;
}
this.errors = [];
- this._countError = function countError(message, highlight) {
+ this._countError = (message, highlight) => {
if (/\b(Error|Warning)Msg\b/.test(highlight))
- self.errors.push(String(message));
+ this.errors.push(String(message));
}
this.modules.dactyl.registerObserver("beep", this._countBeep);
this.modules.dactyl.registerObserver("echoLine", this._countError);
* @param {string} message The message to display upon assertion failure. @optional
*/
wrapAssertNoErrors: function (func, message) {
- let self = this;
- return function wrapped() self.assertNoErrors(func, this, arguments, message);
+ return () => this.assertNoErrors(func, this, arguments, message);
},
/**
* @param {...} Extra arguments are passed to the completion
* function directly.
*/
- testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message) {
+ testCompleter: wrapAssertNoErrors(function testCompleter(self, func, string, message, ...args) {
var context = this.modules.CompletionContext(string || "");
context.tabPressed = true;
- context.forkapply("completions", 0, self, func, Array.slice(arguments, testCompleter.length));
+ context.forkapply("completions", 0, self, func, args);
utils.assert("dactyl.runCompletions", context.wait(5000),
message || "Completion failed: " + self + "." + func);