Skip to content
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

PDFs failing to save via extension on Safari #75

Closed
jacksonh opened this issue Feb 16, 2022 · 1 comment
Closed

PDFs failing to save via extension on Safari #75

jacksonh opened this issue Feb 16, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jacksonh
Copy link
Contributor

There are a few issues with PDFs in Safari. The main one is the blob type isn't supported so we can't transfer the PDF data from the tab to the background extension context. Sending the full data in the message will fail as there is a max message size for passing data between the two.

return new Promise((resolve, reject) => {
      const xhr = new XMLHttpRequest();
      // load `document` from `cache`
      xhr.open('GET', '', true);
      // xhr.responseType = 'blob';
      xhr.responseType = 'arraybuffer';

      xhr.onload = function (e) {
        if (this.status === 200) {
          // `blob` response
          console.log('response', this.response);
          var arrayBuffer = this.response; // Note: not oReq.responseText
          var byteArray = new Uint8Array(arrayBuffer);
          console.log('sending arraybuffer', byteArray);
            // const blobUrl = URL.createObjectURL(this.response)

          resolve(byteArray);
        } else {
          reject(e);
        }
@jacksonh jacksonh self-assigned this Feb 16, 2022
@jacksonh jacksonh added the bug Something isn't working label Feb 16, 2022
@jacksonh jacksonh added this to the 2022-02-24 milestone Feb 21, 2022
@jacksonh
Copy link
Contributor Author

This is resolved with the latest Safari extension update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant