Closed Bug 940217 Opened 12 years ago Closed 12 years ago

JavaScript Error: "A promise chain failed to handle a rejection.": [object StopIteration] from osfile_async_front.jsm

Categories

(Toolkit Graveyard :: OS.File, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla28

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch fix-promise-error (obsolete) — Splinter Review
I get tons of these messages when I run tests: TEST-INFO | chrome://mochitests/content/browser/browser/components/sessionstore/test/browser_636279.js | Console message: [JavaScript Error: "A promise chain failed to handle a rejection. Date: Mon Nov 18 2013 20:06:40 GMT-0800 (PST) Full Message: [object StopIteration] Full Stack: JS frame :: resource://gre/modules/osfile/osfile_async_front.jsm :: withIterator :: line 1032 JS frame :: resource://gre/modules/Promise.jsm :: Handler.prototype.process :: line 767 JS frame :: resource://gre/modules/Promise.jsm :: this.PromiseWalker.walkerLoop :: line 531 native frame :: <unknown filename> :: <TOP_LEVEL> :: line 0"] The problem is that DirectoryIterator is creating a rejected StopIteration promise that may never be used. This patch changes the code to create the promise more lazily. It seems to eliminate the errors.
Attachment #8334356 - Flags: review?(dteller)
Comment on attachment 8334356 [details] [diff] [review] fix-promise-error Review of attachment 8334356 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/osfile/modules/osfile_async_front.jsm @@ +893,5 @@ > + // Once close() is called, itmsg should reject with a > + // StopIteration. However, we don't want to create the promise until > + // it's needed because it might never be used. In that case, we > + // would get a warning on the console. > + get itmsg() { It's a private field, so please prefix it with "_". @@ +895,5 @@ > + // it's needed because it might never be used. In that case, we > + // would get a warning on the console. > + get itmsg() { > + if (!this._itmsg) > + this._itmsg = Promise.reject(StopIteration); Nit: braces. @@ +896,5 @@ > + // would get a warning on the console. > + get itmsg() { > + if (!this._itmsg) > + this._itmsg = Promise.reject(StopIteration); > + return this._itmsg; So _itmsg should become something along the lines of __itmsg. Alternatively, make |get itmsg| a lazy getter that deletes/overwrites itself.
Attachment #8334356 - Flags: review?(dteller) → feedback+
Attachment #8334356 - Attachment is obsolete: true
Attachment #8334966 - Flags: review?(dteller)
Attachment #8334966 - Flags: review?(dteller) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: