Skip to content

Commit

Permalink
fix(ipc): handle 'runtime-preload-injection' header in 'socket:' scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Dec 9, 2024
1 parent c741b35 commit 555ee68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/ipc/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,11 @@ export * from '{{url}}'
response.setHeader("cache-control", "public");
response.send(resource);
} else {
const auto html = this->client.preload.insertIntoHTML(resource.str(), {
.protocolHandlerSchemes = this->navigator.serviceWorker.protocols.getSchemes()
});
const auto html = request->headers["runtime-preload-injection"] == "disabled"
? resource.str()
: this->client.preload.insertIntoHTML(resource.str(), {
.protocolHandlerSchemes = this->navigator.serviceWorker.protocols.getSchemes()
});

response.setHeader("content-type", "text/html");
response.setHeader("content-length", html.size());
Expand Down
10 changes: 5 additions & 5 deletions src/ipc/preload.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ namespace SSC::IPC {
enumerable: true,
get: () => {
if (
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
) {
return globalThis.top
Expand Down Expand Up @@ -466,7 +466,7 @@ namespace SSC::IPC {
globalThis.document &&
!globalThis.RUNTIME_APPLICATION_URL_EVENT_BACKLOG &&
(
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
)
) {
Expand Down Expand Up @@ -557,7 +557,7 @@ namespace SSC::IPC {
}
if (
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
) {
if (globalThis.document && globalThis.document.readyState !== 'complete') {
Expand Down Expand Up @@ -598,7 +598,7 @@ namespace SSC::IPC {
buffers.push_back(R"JAVASCRIPT(
if (
globalThis.document && !globalThis.module && (
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
)
) {
Expand Down Expand Up @@ -660,7 +660,7 @@ namespace SSC::IPC {
buffers.push_back(R"JAVASCRIPT(
if (
globalThis.document && !globalThis.process && (
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier) ||
globalThis.origin.includes(globalThis.__args.config.meta_bundle_identifier.toLowerCase()) ||
globalThis.origin.includes(globalThis.__args.client.host + ':' + globalThis.__args.client.port)
)
) {
Expand Down

0 comments on commit 555ee68

Please sign in to comment.