]> git.donarmstrong.com Git - dactyl.git/blobdiff - common/tests/functional/dactyl.jsm
Import r6948 from upstream hg supporting Firefox up to 24.*
[dactyl.git] / common / tests / functional / dactyl.jsm
index 5f7bda5a4b50d4462a2399f9615c09a1860ddf1c..d738da635b1cfb630e5be285e2384e7d26c94f0b 100644 (file)
@@ -40,7 +40,6 @@ function assertMessage(funcName, want, got, message) {
  * @param {MozMillController} controller The browser's MozMill controller.
  */
 function Controller(controller) {
-    var self = this;
     this.controller = controller;
 
     /**
@@ -51,13 +50,13 @@ function 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);
@@ -251,8 +250,7 @@ Controller.prototype = {
      * @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);
     },
 
     /**
@@ -391,10 +389,10 @@ Controller.prototype = {
      * @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);