Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Work in this release was contributed by @PeterWadie and @akshitsinha. Thank you

The SvelteKit SDK now supports SvelteKit 3, including client-side pageload and navigation tracing and server-side native tracing, alongside continued SvelteKit 2 support. No Sentry-specific setup changes are required. The SDK detects your SvelteKit version and picks the right implementation automatically.

### Other Changes

- fix(replay): Set `text/javascript` MIME type on the compression worker Blob ([#22377](https://github.com/getsentry/sentry-javascript/pull/22377))

## 10.66.0

- chore(node-core): Deprecate `@sentry/node-core` package ([#22285](https://github.com/getsentry/sentry-javascript/pull/22285))
Expand Down
8 changes: 7 additions & 1 deletion packages/replay-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import workerString from './worker';
* Get the URL for a web worker.
*/
export function getWorkerURL(): string {
const workerBlob = new Blob([workerString]);
// Safari (particularly on iOS) validates the MIME type of a Blob before it
// will execute it as a classic Worker script. A Blob created without an
// explicit `type` defaults to an empty string, which WebKit may reject,
// firing a bare `error` event with no message. Blink/Gecko are lenient here,
// so this only manifests on Safari. Set an explicit JavaScript MIME type so
// the worker loads across browsers.
const workerBlob = new Blob([workerString], { type: 'text/javascript' });
return URL.createObjectURL(workerBlob);
}
25 changes: 25 additions & 0 deletions packages/replay-worker/test/unit/getWorkerURL.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @vitest-environment jsdom
*/

import { describe, expect, it, vi } from 'vitest';
import { getWorkerURL } from '../../src';

describe('getWorkerURL', () => {
// Safari (esp. iOS) rejects executing a Blob worker without a JavaScript MIME
// type, firing a bare `error` event. The Blob must be tagged `text/javascript`
// so the worker loads across browsers.
it('creates the worker Blob with a JavaScript MIME type', () => {
// jsdom does not implement `URL.createObjectURL`, so stub it and capture the Blob.
const createObjectURL = vi.fn<(blob: Blob) => string>().mockReturnValue('blob:mock');
URL.createObjectURL = createObjectURL as unknown as typeof URL.createObjectURL;

const url = getWorkerURL();

expect(url).toBe('blob:mock');
expect(createObjectURL).toHaveBeenCalledTimes(1);
const blob = createObjectURL.mock.calls[0]![0];
expect(blob).toBeInstanceOf(Blob);
expect(blob.type).toBe('text/javascript');
});
});
Loading