@@ -63,9 +63,11 @@ class FetchResponse {
63
63
if ( this . isScript ) {
64
64
const script = document . createElement ( "script" ) ;
65
65
const metaTag = document . querySelector ( "meta[name=csp-nonce]" ) ;
66
- const nonce = metaTag && metaTag . content ;
67
- if ( nonce ) {
68
- script . setAttribute ( "nonce" , nonce ) ;
66
+ if ( metaTag ) {
67
+ const nonce = metaTag . nonce === "" ? metaTag . content : metaTag . nonce ;
68
+ if ( nonce ) {
69
+ script . setAttribute ( "nonce" , nonce ) ;
70
+ }
69
71
}
70
72
script . innerHTML = await this . text ;
71
73
document . body . appendChild ( script ) ;
@@ -166,7 +168,7 @@ class FetchRequest {
166
168
this . options . headers = headers ;
167
169
}
168
170
sameHostname ( ) {
169
- if ( ! this . originalUrl . startsWith ( "http:" ) ) {
171
+ if ( ! this . originalUrl . startsWith ( "http:" ) && ! this . originalUrl . startsWith ( "https:" ) ) {
170
172
return true ;
171
173
}
172
174
try {
@@ -182,7 +184,8 @@ class FetchRequest {
182
184
body : this . formattedBody ,
183
185
signal : this . signal ,
184
186
credentials : this . credentials ,
185
- redirect : this . redirect
187
+ redirect : this . redirect ,
188
+ keepalive : this . keepalive
186
189
} ;
187
190
}
188
191
get headers ( ) {
@@ -260,6 +263,9 @@ class FetchRequest {
260
263
get credentials ( ) {
261
264
return this . options . credentials || "same-origin" ;
262
265
}
266
+ get keepalive ( ) {
267
+ return this . options . keepalive || false ;
268
+ }
263
269
get additionalHeaders ( ) {
264
270
return this . options . headers || { } ;
265
271
}
0 commit comments