Skip to content

Fix encoding of CSI keys in Safari #8993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f7067e2
Enable only unicode / utf8 string tests
MarkDuckworth May 2, 2025
2c219e5
Attempting to mitigate failures caused by browser disconnect timout
MarkDuckworth May 5, 2025
d4b667e
Skip compareUtf8Strings should return correct results
MarkDuckworth May 5, 2025
a4b0f8a
Skip sort unicode strings
MarkDuckworth May 5, 2025
f5e632f
browserDisconnectTimeout back to default
MarkDuckworth May 5, 2025
944feac
reenable compareUtf8strings unit test"
MarkDuckworth May 5, 2025
baeb68e
another test
MarkDuckworth May 5, 2025
538f470
Reenable all tests and increase browserDisconnectTimeout to 65 seconds
MarkDuckworth May 7, 2025
aeec17a
Fix IndexDbIndexManager encoding of Uint8Array in Safari
MarkDuckworth May 7, 2025
3854785
Scripts for running tests in WebKit locally
MarkDuckworth May 7, 2025
53ecb67
lint fix
MarkDuckworth May 7, 2025
44cee47
formatting
MarkDuckworth May 7, 2025
2380e61
Create eighty-starfishes-listen.md
MarkDuckworth May 7, 2025
bccc89a
Merge branch 'main' of github.com:firebase/firebase-js-sdk into markd…
MarkDuckworth May 7, 2025
f421368
Merge branch 'markduckworth/timeout-flake' of github.com:firebase/fir…
MarkDuckworth May 7, 2025
e6860ac
cleanup
MarkDuckworth May 7, 2025
dfd8f22
Swap encoding of key safe bytes from number[] to sortable string. Thi…
MarkDuckworth May 8, 2025
022a55e
Update eighty-starfishes-listen.md
MarkDuckworth May 8, 2025
d4086bb
cleanup
MarkDuckworth May 8, 2025
fd64124
Merge branch 'markduckworth/timeout-flake' of github.com:firebase/fir…
MarkDuckworth May 8, 2025
26739c9
fix import
MarkDuckworth May 8, 2025
4d5b5cc
Address pr feedback
MarkDuckworth May 9, 2025
0dc1ea6
fix changelog
MarkDuckworth May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"test:browser:emulator": "karma start --targetBackend=emulator",
"test:browser:nightly": "karma start --targetBackend=nightly",
"test:browser:prod": "karma start --targetBackend=prod",
"test:webkit:prod": "BROWSERS=WebkitHeadless karma start --targetBackend=prod --browsers=WebkitHeadless",
"test:webkit:unit": "BROWSERS=WebkitHeadless karma start --unit --targetBackend=prod --browsers=WebkitHeadless",
"test:webkit:prod": "BROWSERS=WebkitHeadless karma start --targetBackend=prod",
"test:webkit:unit": "BROWSERS=WebkitHeadless karma start --unit --targetBackend=prod",
"test:browser:prod:nameddb": "karma start --targetBackend=prod --databaseId=test-db",
"test:browser:unit": "karma start --unit",
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
Expand Down
17 changes: 9 additions & 8 deletions packages/firestore/src/index/index_entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ export class IndexEntry {
orderedDocumentKey: Uint8Array,
documentKey: DocumentKey
): DbIndexEntryKey {
const entry = this.dbIndexEntry(uid, orderedDocumentKey, documentKey);
return [
this._indexId,
uid,
encodeKeySafeBytes(this._arrayValue),
encodeKeySafeBytes(this._directionalValue),
encodeKeySafeBytes(orderedDocumentKey),
documentKey.path.toArray()
entry.indexId,
entry.uid,
entry.arrayValue,
entry.directionalValue,
entry.orderedDocumentKey,
entry.documentKey
];
}
}
Expand Down Expand Up @@ -130,15 +131,15 @@ export function compareByteArrays(left: Uint8Array, right: Uint8Array): number {
* Otherwise, the input array will be returned in its original type.
*/
export function encodeKeySafeBytes(array: Uint8Array): KeySafeBytes {
if (isSafariOrWebkit() && !Array.isArray(array)) {
if (isSafariOrWebkit()) {
return encodeUint8ArrayToSortableString(array);
}
return array;
}

/**
* Reverts the key safe representation of Uint8Array (created by
* indexSafeUint8Array) to a normal Uint8Array.
* encodeKeySafeBytes) to a normal Uint8Array.
*/
export function decodeKeySafeBytes(input: KeySafeBytes): Uint8Array {
if (typeof input !== 'string') {
Expand Down
Loading