fix(javascript): keep bare relative URLs for computed-method XHR

`xhr.open(method, "api/users")` is a same-origin request, but the
computed-method fallback required an absolute URL or a path prefix.
Keep the literal unless it is provably not a URL: a Node fs open flag,
a reserved browsing-context name, or a call on a receiver spelled as a
browsing context or document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-07 00:01:16 -07:00
co-authored by Claude Opus 5.5
parent e3e7664665
commit e32028d1b5
2 changed files with 48 additions and 7 deletions
+4
View File
@@ -190,6 +190,9 @@ describe("web bundle static-analysis parity", () => {
document.open("text/html", "/replace");
parent.open("GET", "/parent-xhr");
self.open("post", "/self-xhr");
xhr.open(method, "api/relative");
fs.open(path, "w+", done);
popup.open(url, "_TOP");
`),
);
expect(
@@ -200,6 +203,7 @@ describe("web bundle static-analysis parity", () => {
"/parent-xhr",
"/self-xhr",
"/xhr-get",
"api/relative",
"https://xhr.example.test/submit",
]);
});