Skip to content

Commit d2fda2b

Browse files
committed
feat(replay): Update example worker script
I noticed that in #14867 we did not actually rebuild this, oops.
1 parent 1b85ea3 commit d2fda2b

3 files changed

Lines changed: 48 additions & 43 deletions

File tree

packages/replay-worker/examples/worker.js

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Sentry Replay Worker 8.33.1 (c992b3fad) | https://github.com/getsentry/sentry-javascript */
1+
/*! Sentry Replay Worker 10.53.1 (1b85ea392a) | https://github.com/getsentry/sentry-javascript */
22
// DEFLATE is a complex format; to read this code, you should probably check the RFC first:
33
// https://tools.ietf.org/html/rfc1951
44
// You may also wish to take a look at the guide I made about this program:
@@ -125,7 +125,6 @@ var shft = function (p) {
125125
// typed array slice - allows garbage collector to free original reference,
126126
// while being more compatible than .slice
127127
var slc = function (v, s, e) {
128-
if (s == null || s < 0) s = 0;
129128
if (e == null || e > v.length) e = v.length;
130129
// can't use .constructor in case user-supplied
131130
return new u8(v.subarray(s, e));
@@ -588,7 +587,7 @@ var dopt = function (dat, opt, pre, post, st) {
588587
return dflt(
589588
dat,
590589
opt.level == null ? 6 : opt.level,
591-
opt.mem == null ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 12 + opt.mem,
590+
opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : 12 + opt.mem,
592591
pre,
593592
post,
594593
st,
@@ -661,11 +660,9 @@ var Deflate = /*#__PURE__*/ (function () {
661660
this.b = newBuf;
662661
}
663662
var split = this.b.length - this.s.z;
664-
if (split) {
665-
this.b.set(chunk.subarray(0, split), this.s.z);
666-
this.s.z = this.b.length;
667-
this.p(this.b, false);
668-
}
663+
this.b.set(chunk.subarray(0, split), this.s.z);
664+
this.s.z = this.b.length;
665+
this.p(this.b, false);
669666
this.b.set(this.b.subarray(-32768));
670667
this.b.set(chunk.subarray(split), 32768);
671668
this.s.z = chunk.length - split + 32768;
@@ -680,6 +677,16 @@ var Deflate = /*#__PURE__*/ (function () {
680677
((this.s.w = this.s.i), (this.s.i -= 2));
681678
}
682679
};
680+
/**
681+
* Flushes buffered uncompressed data. Useful to immediately retrieve the
682+
* deflated output for small inputs.
683+
*/
684+
Deflate.prototype.flush = function () {
685+
if (!this.ondata) err(5);
686+
if (this.s.l) err(4);
687+
this.p(this.b, false);
688+
((this.s.w = this.s.i), (this.s.i -= 2));
689+
};
683690
return Deflate;
684691
})();
685692
/**
@@ -721,6 +728,13 @@ var Zlib = /*#__PURE__*/ (function () {
721728
if (f) wbytes(raw, raw.length - 4, this.c.d());
722729
this.ondata(raw, f);
723730
};
731+
/**
732+
* Flushes buffered uncompressed data. Useful to immediately retrieve the
733+
* zlibbed output for small inputs.
734+
*/
735+
Zlib.prototype.flush = function () {
736+
Deflate.prototype.flush.call(this);
737+
};
724738
return Zlib;
725739
})();
726740
// text encoder
@@ -729,7 +743,7 @@ var te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();
729743
var td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();
730744
try {
731745
td.decode(et, { stream: true });
732-
} catch {}
746+
} catch (e) {}
733747
/**
734748
* Streaming UTF-8 encoding
735749
*/
@@ -761,11 +775,7 @@ var EncodeUTF8 = /*#__PURE__*/ (function () {
761775
* @returns The string encoded in UTF-8/Latin-1 binary
762776
*/
763777
function strToU8(str, latin1) {
764-
if (latin1) {
765-
var ar_1 = new u8(str.length);
766-
for (var i = 0; i < str.length; ++i) ar_1[i] = str.charCodeAt(i);
767-
return ar_1;
768-
}
778+
var i;
769779
if (te) return te.encode(str);
770780
var l = str.length;
771781
var ar = new u8(str.length + (str.length >> 1));

0 commit comments

Comments
 (0)