Closed Bug 1336944 Opened 7 years ago Closed 7 years ago

Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays.

Categories

(Toolkit :: Storage, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox52 --- unaffected
firefox53 + fixed
firefox54 + fixed

People

(Reporter: mak, Assigned: mak)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

[Tracking Requested - why for this release]:

[Tracking Requested - why for this release]:

Currently binding an Array tries to bind it as a Blob.
This clashes with bug 483318, that would like to bind Arrays for IN clauses.

We should change Sqlite.jsm to bind only typedArrays as blobs.

We should fix this before FF53 ships, to avoid creating previous usage of Array to bind blobs.
Assignee: nobody → mak77
Status: NEW → ASSIGNED
Tracking 53/54+ so we have alignment befor 53 ships.
Comment on attachment 8834072 [details]
Bug 1336944 - Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays.

https://reviewboard.mozilla.org/r/110154/#review111496

So there are no non-test consumers right now? Interesting...
Attachment #8834072 - Flags: review?(gijskruitbosch+bugs) → review+
Comment on attachment 8834072 [details]
Bug 1336944 - Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays.

https://reviewboard.mozilla.org/r/110154/#review111500

::: toolkit/modules/tests/xpcshell/test_sqlite.js:1106
(Diff revision 1)
>    const bindings = [
>      {
>        null_col: null,
>        integer_col: 12345,
>        text_col: "qwerty",
> -      blob_col: new Array(256).fill(undefined).map( (value, index) => index % 256 ),
> +      blob_col: new Uint8Array(256).fill(undefined).map( (value, index) => index % 256 ),

Does this work, and/or is filling it with undefined here useful, given the map() call? If it is, shouldn't we fill with 0?
(In reply to :Gijs from comment #4)
> Does this work, and/or is filling it with undefined here useful, given the
> map() call? If it is, shouldn't we fill with 0?

Yeah, it's the same, afaict:
new Uint8Array(10).fill(undefined)
> Uint8Array [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]

I will just change undefined with 0, for clarity.
oh but yeah, the fill itself is pointless, will just remove it.
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/cf0424523e69
Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays. r=Gijs
https://hg.mozilla.org/mozilla-central/rev/cf0424523e69
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Comment on attachment 8834072 [details]
Bug 1336944 - Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays.

Approval Request Comment
[Feature/Bug causing the regression]: bug 1247602 
[User impact if declined]: We'd be shipping an API that is changing the next version
[Is this code covered by automated tests?]: yes
[Has the fix been verified in Nightly?]: not yet
[Needs manual test from QE? If yes, steps to reproduce]: no
[List of other uplifts needed for the feature/fix]: none
[Is the change risky?]: no
[Why is the change risky/not risky?]: just changing Array to Uint8Array, new API
[String changes made/needed]: none
Attachment #8834072 - Flags: approval-mozilla-aurora?
Comment on attachment 8834072 [details]
Bug 1336944 - Change Sqlite.jsm to bind TypedArrays as Blobs, not common Arrays.

Ship new API. Aurora53+.
Attachment #8834072 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: