File tree 2 files changed +13
-4
lines changed
2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change
1
+ // Want to remove this postMessage hack, tell them u want transferable streams:
2
+ // https://bugs.webkit.org/show_bug.cgi?id=215485
3
+
1
4
const WRITE = 0
2
5
const PULL = 0
3
6
const ERROR = 1
@@ -24,6 +27,10 @@ class MessagePortSource {
24
27
this . controller = controller
25
28
}
26
29
30
+ pull ( ) {
31
+ this . port . postMessage ( { type : PULL } )
32
+ }
33
+
27
34
/** @param {Error } reason */
28
35
cancel ( reason ) {
29
36
// Firefox can notify a cancel event, chrome can't
@@ -37,7 +44,6 @@ class MessagePortSource {
37
44
// enqueue() will call pull() if needed when there's no backpressure
38
45
if ( message . type === WRITE ) {
39
46
this . controller . enqueue ( message . chunk )
40
- this . port . postMessage ( { type : PULL } )
41
47
}
42
48
if ( message . type === ABORT ) {
43
49
this . controller . error ( message . reason )
Original file line number Diff line number Diff line change 9
9
} = config
10
10
11
11
const { GONE } = errors
12
- // @ts -ignore
13
- const isSafari = / c o n s t r u c t o r / i. test ( window . HTMLElement ) || window . safari || window . WebKitPoint
12
+ // @ts -ignore - Don't match newer versions of Safari, but that's okay
13
+ const isOldSafari = / c o n s t r u c t o r / i. test ( window . HTMLElement )
14
14
15
15
export class FileHandle {
16
16
constructor ( name = 'unkown' ) {
@@ -37,7 +37,7 @@ export class FileHandle {
37
37
38
38
link . download = this . name
39
39
40
- if ( isSafari || ! sw ) {
40
+ if ( isOldSafari || ! sw ) {
41
41
/** @type {Blob[] } */
42
42
let chunks = [ ]
43
43
ts . readable . pipeTo ( new WritableStream ( {
@@ -93,6 +93,9 @@ export class FileHandle {
93
93
}
94
94
}
95
95
96
+ // Want to remove this postMessage hack, tell them u want transferable streams:
97
+ // https://bugs.webkit.org/show_bug.cgi?id=215485
98
+
96
99
const WRITE = 0
97
100
const PULL = 0
98
101
const ERROR = 1
You can’t perform that action at this time.
0 commit comments