Stop using StopIteration in Sqlite.jsm

RESOLVED FIXED in Firefox 57

Status

()

RESOLVED FIXED
a year ago
a year ago

People

(Reporter: emk, Assigned: emk)

Tracking

(Blocks: 1 bug)

unspecified
mozilla57
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

a year ago
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.
Comment hidden (mozreview-request)
(Assignee)

Comment 2

a year ago
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)
Comment hidden (mozreview-request)
(Assignee)

Updated

a year ago
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED

Comment 6

a year ago
mozreview-review
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 hidden (mozreview-request)
(Assignee)

Comment 8

a year ago
mozreview-review-reply
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.

Comment 9

a year ago
Pushed by VYV03354@nifty.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/b9ae810f6a04
Stop using the StopIteration object in Sqlite.jsm. r=mak

Comment 10

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/b9ae810f6a04
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Updated

a year ago
Depends on: 1393483
You need to log in before you can comment on or make changes to this bug.