diff --git a/src/client/shared/requests/xmlhttprequest.ts b/src/client/shared/requests/xmlhttprequest.ts index 1390794..cc59564 100644 --- a/src/client/shared/requests/xmlhttprequest.ts +++ b/src/client/shared/requests/xmlhttprequest.ts @@ -26,6 +26,12 @@ export default function (client: ScramjetClient, self: Self) { const args = ctx.this[ARGS]; if (!args || args[2]) return; + if (!self.$scramjet.config.flags.syncxhr) { + console.warn("sync xhr disabled in flags"); + + return; + } + // it's a sync request // sync xhr to service worker is not supported // there's a nice way of polyfilling this though, we can spin on an atomic using sharedarraybuffer. this will maintain the sync behavior diff --git a/src/controller/index.ts b/src/controller/index.ts index 58bad7f..6dfafd9 100644 --- a/src/controller/index.ts +++ b/src/controller/index.ts @@ -31,6 +31,7 @@ export class ScramjetController { serviceworkers: false, naiiveRewriter: false, captureErrors: true, + syncxhr: false, cleanerrors: false, sourcemaps: false, }, diff --git a/src/types.d.ts b/src/types.d.ts index 3e0283a..f460692 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -25,6 +25,7 @@ type ScramjetFlags = { captureErrors: boolean; cleanerrors: boolean; sourcemaps: boolean; + syncxhr: boolean; }; interface ScramjetConfig {