From 95e75e96f83fa3ff59d37aa1aafe7fa82cc4c0d6 Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Wed, 23 Sep 2015 18:40:52 +0900 Subject: [PATCH] Bug 1207496 - Part 1: Remove use of expression closure from services/common/. r=gps --HG-- extra : commitid : EeWW6zhKp9t extra : rebase_source : b23def2c39cad03dd5e4b3a3b440e43d3b343b7a --- services/common/observers.js | 6 +++--- services/common/tests/unit/test_utils_stackTrace.js | 4 ++-- services/common/utils.js | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/services/common/observers.js b/services/common/observers.js index 46f79b9b5b5f..78b14376a37f 100644 --- a/services/common/observers.js +++ b/services/common/observers.js @@ -62,9 +62,9 @@ this.Observers = { // we can make it. We could index by topic, but we can't index by callback // or thisObject, as far as I know, since the keys to JavaScript hashes // (a.k.a. objects) can apparently only be primitive values. - let [observer] = this._cache.filter(function(v) v.topic == topic && - v.callback == callback && - v.thisObject == thisObject); + let [observer] = this._cache.filter(v => v.topic == topic && + v.callback == callback && + v.thisObject == thisObject); if (observer) { this._service.removeObserver(observer, topic); this._cache.splice(this._cache.indexOf(observer), 1); diff --git a/services/common/tests/unit/test_utils_stackTrace.js b/services/common/tests/unit/test_utils_stackTrace.js index 31fa598248aa..6c71d07535d2 100644 --- a/services/common/tests/unit/test_utils_stackTrace.js +++ b/services/common/tests/unit/test_utils_stackTrace.js @@ -2,8 +2,8 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ _("Define some functions in well defined line positions for the test"); -function foo(v) bar(v + 1); // line 2 -function bar(v) baz(v + 1); // line 3 +function foo(v) { return bar(v + 1); } // line 2 +function bar(v) { return baz(v + 1); } // line 3 function baz(v) { throw new Error(v + 1); } // line 4 _("Make sure lazy constructor calling/assignment works"); diff --git a/services/common/utils.js b/services/common/utils.js index 6921dbbe35ef..4353a12cf7f4 100644 --- a/services/common/utils.js +++ b/services/common/utils.js @@ -314,8 +314,9 @@ this.CommonUtils = { } // Handle a left shift, restricted to bytes. - function left(octet, shift) - (octet << shift) & 0xff; + function left(octet, shift) { + return (octet << shift) & 0xff; + } advance(); accumulate(left(val, 3));