Closed Bug 1119832 Opened 9 years ago Closed 9 years ago

Typo in apps/system/js/async_semaphore.js

Categories

(Firefox OS Graveyard :: Gaia::System, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: max, Unassigned)

Details

Attachments

(1 file)

Constructor AsyncSemaphore tries to guard against being called without 'new' by the following test (https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/async_semaphore.js#L8):

    if (!this instanceof AsyncSemaphore) {
      return new AsyncSemaphore();
    }

Note, however, that '!' binds more tightly than 'instanceof', so the 'if' condition will always evaluate to 'false', rendering the guard ineffective.
Comment on attachment 8553959 [details] [review]
[PullReq] KevinGrandon:bug_1119832_async_semaphore_typo to mozilla-b2g:master

Max - thank you for filing this bug.

Tzu-Lin - could you give this a quick review? Just fixing the syntax and adding a quick unit test.
Attachment #8553959 - Flags: review?(tzhuang)
Comment on attachment 8553959 [details] [review]
[PullReq] KevinGrandon:bug_1119832_async_semaphore_typo to mozilla-b2g:master

Nice catch, thanks
Attachment #8553959 - Flags: review?(tzhuang) → review+
In master: https://github.com/mozilla-b2g/gaia/commit/0f662dffef27599443cfcd790c2b39190a2b35c8
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: