Skip to content

Commit 555ee68

Browse files
committed
fix(ipc): handle 'runtime-preload-injection' header in 'socket:' scheme
1 parent c741b35 commit 555ee68

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/ipc/bridge.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,11 @@ export * from '{{url}}'
643643
response.setHeader("cache-control", "public");
644644
response.send(resource);
645645
} else {
646-
const auto html = this->client.preload.insertIntoHTML(resource.str(), {
647-
.protocolHandlerSchemes = this->navigator.serviceWorker.protocols.getSchemes()
648-
});
646+
const auto html = request->headers["runtime-preload-injection"] == "disabled"
647+
? resource.str()
648+
: this->client.preload.insertIntoHTML(resource.str(), {
649+
.protocolHandlerSchemes = this->navigator.serviceWorker.protocols.getSchemes()
650+
});
649651

650652
response.setHeader("content-type", "text/html");
651653
response.setHeader("content-length", html.size());

src/ipc/preload.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ namespace SSC::IPC {
298298
enumerable: true,
299299
get: () => {
300300
if (
301-
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
301+
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
302302
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
303303
) {
304304
return globalThis.top
@@ -466,7 +466,7 @@ namespace SSC::IPC {
466466
globalThis.document &&
467467
!globalThis.RUNTIME_APPLICATION_URL_EVENT_BACKLOG &&
468468
(
469-
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
469+
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
470470
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
471471
)
472472
) {
@@ -557,7 +557,7 @@ namespace SSC::IPC {
557557
}
558558
559559
if (
560-
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
560+
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
561561
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
562562
) {
563563
if (globalThis.document && globalThis.document.readyState !== 'complete') {
@@ -598,7 +598,7 @@ namespace SSC::IPC {
598598
buffers.push_back(R"JAVASCRIPT(
599599
if (
600600
globalThis.document && !globalThis.module && (
601-
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
601+
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
602602
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
603603
)
604604
) {
@@ -660,7 +660,7 @@ namespace SSC::IPC {
660660
buffers.push_back(R"JAVASCRIPT(
661661
if (
662662
globalThis.document && !globalThis.process && (
663-
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
663+
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
664664
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
665665
)
666666
) {

0 commit comments

Comments
 (0)