Skip to content

restore-file - Add support for binaries on Firefox - #10129

Merged
fregante merged 4 commits into
mainfrom
firefox-binaries
Sep 28, 2026
Merged

fregante merged 4 commits into
mainfrom
firefox-binaries

Conversation

Comment thread source/github-helpers/api.tsx Outdated
if (responseFormat === 'base64') {
const arrayBuffer = await response.arrayBuffer();
const content = uint8ArrayToBase64(new Uint8Array(arrayBuffer));
const buffer = await response.arrayBuffer();

@sindresorhus sindresorhus Sep 26, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const buffer = await response.arrayBuffer();
const buffer = await response.bytes();

?

@fregante fregante Sep 26, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will try. I think the issue here is using the wrong Uint8Array constructor anyway, maybe the issue would be using new window.Uint8Array instead of whatever GPT suggested here. I haven't tested the PR yet.

Not sure if Response.bytes is affected by the same behavior but I have a feeling it is

@fregante fregante Sep 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with .bytes() and the native .toBase64(). Tested in both Safari 27, Firefox 157, and Chrome 153

Safari 18.2 is the new minimum, do you need to change anything Xcode-side?

@fregante fregante added bug firefox Related to Firefox only labels Sep 27, 2026
@fregante
fregante marked this pull request as ready for review September 27, 2026 06:53
@fregante
fregante requested a lite review from Copilot September 27, 2026 06:54
Comment thread source/manifest.json
},
"gecko_android": {
"strict_min_version": "128.0"
"strict_min_version": "133.0"

@fregante fregante Sep 27, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add compatible fallbacks or capability gates for the native APIs used on supported Safari versions.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds native binary/Base64 handling to fix restore-file on Firefox.

Changes:

  • Replaces uint8array-extras with native Web APIs.
  • Updates browser minimums and TypeScript typings.
  • Removes the direct encoding dependency.
File Summary
tsconfig.json Enables ESNext API typings.
source/​manifest.json Raises browser minimum versions.
source/​github-helpers/​api.tsx Uses native binary response and Base64 APIs.
source/​features/​last-notification-page-button.tsx Uses native cursor encoding.
package.json Removes the direct dependency.
package-lock.json Updates dependency metadata.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

const lastCursor = Math.floor((totalNotificationsNumber - 1) / itemsPerNotificationsPage) * itemsPerNotificationsPage;
const nextButtonSearch = new URLSearchParams(nextButton.search);
nextButtonSearch.set('after', stringToBase64(`cursor:${lastCursor}`));
nextButtonSearch.set('after', encoder.encode(`cursor:${lastCursor}`).toBase64());
Comment thread source/github-helpers/api.tsx Resolved
Comment thread package.json
"tiny-version-compare": "^4.0.0",
"ts-extras": "^1.3.0",
"twas": "^2.1.3",
"uint8array-extras": "^1.5.0",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sowrry! 👉👈

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was always meant to be made obsolete 👍

Comment thread source/manifest.json
"manifest_version": 3,
"minimum_chrome_version": "123",
"minimum_chrome_version": "140",
"browser_specific_settings": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set minimum version for safari too: https://developer.apple.com/documentation/safariservices/optimizing-your-web-extension-for-safari#Ensure-feature-compatibility-by-specifying-versions

We also need to bump the macOS/iOS version to iOS 18.2 and macOS 15 then, but if you don't have Xcode, I can do it later.

@fregante
fregante enabled auto-merge (squash) September 28, 2026 10:40
@fregante
fregante merged commit f9b05bd into main Sep 28, 2026
13 checks passed
@fregante
fregante deleted the firefox-binaries branch September 28, 2026 10:41
@fregante

Copy link
Copy Markdown
Member Author

We also need to bump the macOS/iOS version to iOS 18.2 and macOS 15 then, [..] I can do it later.

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug firefox Related to Firefox only

Development

Successfully merging this pull request may close these issues.

3 participants