Closed Bug 1392070 Opened 7 years ago Closed 7 years ago

Stop using StopIteration in Sqlite.jsm

Categories

(Core :: SQLite and Embedded Database Bindings, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: emk, Assigned: emk)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Sqlite.jsm is abusing StopIteration to indicate user cancelling in onRow callback. It does not even follow the legacy iteration protocol. We should use something different to drop StopIteration. Fortunately, we don't have to concern addon-compat anymore.
This patch is using a string instead of the global singleton. I'd appreciate better suggestions.
Maybe we could change the onRow signature from onRow(row) to onRow(row, canceler), so that the onRow consumer can invoke canceler(). Internally it can just do the same as the current StopIteration exception.
Comment on attachment 8899246 [details] Bug 1392070 - Stop using the StopIteration object in Sqlite.jsm. Removing the review flag as Marco offered a suggestion.
Attachment #8899246 - Flags: review?(florian)
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Comment on attachment 8899246 [details] Bug 1392070 - Stop using the StopIteration object in Sqlite.jsm. https://reviewboard.mozilla.org/r/170498/#review176234 ::: toolkit/modules/Sqlite.jsm:1286 (Diff revision 2) > * resources. > * > * If a `StopIteration` is thrown during execution of an `onRow` handler, > * the execution of the statement is immediately cancelled. Subsequent > * rows will not be processed and no more `onRow` invocations will be made. > * The promise is resolved immediately. This comment must be updated ::: toolkit/modules/Sqlite.jsm:1290 (Diff revision 2) > * rows will not be processed and no more `onRow` invocations will be made. > * The promise is resolved immediately. > * > * If a non-`StopIteration` exception is thrown by the `onRow` handler, the > * exception is logged and processing of subsequent rows occurs as if nothing > * happened. The promise is still resolved (not rejected). as well as this one
Attachment #8899246 - Flags: review?(mak77) → review+
Comment on attachment 8899246 [details] Bug 1392070 - Stop using the StopIteration object in Sqlite.jsm. https://reviewboard.mozilla.org/r/170498/#review176234 > This comment must be updated Comments updated.
Pushed by VYV03354@nifty.ne.jp: https://hg.mozilla.org/integration/autoland/rev/b9ae810f6a04 Stop using the StopIteration object in Sqlite.jsm. r=mak
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Depends on: 1393483
Duplicate of this bug: 1016004
Product: Toolkit → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: