Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/pac_utils_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ int main() {
printf("// directly, so that the eval'd PAC sandbox can define its own\n");
printf("// dnsResolve() / myIpAddress() in the same scope as the utility\n");
printf("// functions — keeping DNS mocking correct via lexical scoping.\n");
printf("const PAC_UTILS_JS = `\n");
// String.raw preserves backslashes as-is, preventing the JS template
// literal parser from mangling regex patterns like /\*/g → /*/g (invalid).
printf("const PAC_UTILS_JS = String.raw`\n");
printf("%s", pacUtils);
printf("`;\n");
return 0;
Expand Down
2 changes: 1 addition & 1 deletion web/pac_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// directly, so that the eval'd PAC sandbox can define its own
// dnsResolve() / myIpAddress() in the same scope as the utility
// functions — keeping DNS mocking correct via lexical scoping.
const PAC_UTILS_JS = `
const PAC_UTILS_JS = String.raw`
function dnsDomainIs(host, domain) {
return (host.length >= domain.length &&
host.substring(host.length - domain.length) == domain);
Expand Down
Loading