Skip to content

Conversation

@Skn0tt
Copy link
Member

@Skn0tt Skn0tt commented Dec 22, 2025

Draft for #38622, propagating auth tokens in search params. Adds a post-build patchup that replaces <script> and <link> tags into script that creates these tags dynamically, but with the search param. Here's how it looks:

const search = window.location.search;
const assets = [
{
  tag: "script",
  attrs: {
    type: "module",
    crossorigin: true,
    src: "./index.CyZ5k941.js",
  },
},
{
  tag: "link",
  attrs: {
    rel: "icon",
    href: "./playwright-logo.svg",
    type: "image/svg+xml",
  },
},
{
  tag: "link",
  attrs: { rel: "manifest", href: "./manifest.webmanifest" },
},
{
  tag: "link",
  attrs: {
    rel: "modulepreload",
    crossorigin: true,
    href: "./assets/defaultSettingsView-jbPn2iCt.js",
  },
},
{
  tag: "link",
  attrs: {
    rel: "stylesheet",
    crossorigin: true,
    href: "./defaultSettingsView.CePOtT32.css",
  },
},
{
  tag: "link",
  attrs: {
    rel: "stylesheet",
    crossorigin: true,
    href: "./index.BVu7tZDe.css",
  },
},
];
const imports = {
"./assets/defaultSettingsView-jbPn2iCt.js":
  "./assets/defaultSettingsView-jbPn2iCt.js",
};

// Create import map with search params appended
if (search && Object.keys(imports).length > 0) {
  const importMap = { imports: {} };
  for (const key in imports) {
    importMap.imports[key] = key + search;
  }
  const script = document.createElement("script");
  script.type = "importmap";
  script.textContent = JSON.stringify(importMap);
  document.head.appendChild(script);
}

assets.forEach(function (asset) {
const el = document.createElement(asset.tag);
for (const key in asset.attrs) {
  let value = asset.attrs[key];
  // Add search params to src/href if present
  if ((key === "src" || key === "href") && search) {
    value += search;
  }
  // Set boolean attributes without value, others with value
  if (value === true) {
    el.setAttribute(key, "");
  } else {
    el.setAttribute(key, value);
  }
}
document.head.appendChild(el);

@Skn0tt Skn0tt self-assigned this Dec 22, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Skn0tt
Copy link
Member Author

Skn0tt commented Dec 23, 2025

I tried my best to make this work, but there's asset links in too many places that we can't propagate the SAS token to. JS imports and top-level CSS imports can be hacked around with dynamic scripts and import maps. But there's also font files referenced from CSS, and I just don't see any way for making that work.

@github-actions
Copy link
Contributor

Test results for "MCP"

4 failed
❌ [chromium] › mcp/test-debug.spec.ts:275 › test_debug / evaluate (with element) @mcp-windows-latest
❌ [firefox] › mcp/test-run.spec.ts:67 › test_run for a failed tests is not an error @mcp-windows-latest
❌ [webkit] › mcp/seed-default-project.spec.ts:50 › respects provided seed test @mcp-windows-latest
❌ [msedge] › mcp/planner.spec.ts:69 › planner_setup_page seed resolution @mcp-windows-latest

2723 passed, 116 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

75 failed
❌ [playwright-test] › reporter-blob.spec.ts:633 › generate html with attachment urls @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:364 › merged › should use different path if attachments base url option is provided @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:572 › merged › should show trace source @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:608 › merged › should not show stack trace @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:638 › merged › should show trace title @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:660 › merged › should show multi trace source @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:694 › merged › trace should not hang when showing parallel api requests @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › merged › auth tokens are inherited @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:364 › created › should use different path if attachments base url option is provided @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:572 › created › should show trace source @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:608 › created › should not show stack trace @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:638 › created › should show trace title @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:660 › created › should show multi trace source @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:694 › created › trace should not hang when showing parallel api requests @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › created › auth tokens are inherited @ubuntu-latest-node22-2
❌ [playwright-test] › reporter-blob.spec.ts:633 › generate html with attachment urls @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › merged › should use different path if attachments base url option is provided @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › merged › should show trace source @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › merged › should not show stack trace @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › merged › should show trace title @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › merged › should show multi trace source @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › merged › trace should not hang when showing parallel api requests @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › merged › auth tokens are inherited @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › created › should use different path if attachments base url option is provided @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › created › should show trace source @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › created › should not show stack trace @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › created › should show trace title @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › created › should show multi trace source @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › created › trace should not hang when showing parallel api requests @windows-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › created › auth tokens are inherited @windows-latest-node20-2
❌ [playwright-test] › reporter-blob.spec.ts:633 › generate html with attachment urls @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › merged › should use different path if attachments base url option is provided @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › merged › should show trace source @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › merged › should not show stack trace @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › merged › should show trace title @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › merged › should show multi trace source @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › merged › trace should not hang when showing parallel api requests @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › merged › auth tokens are inherited @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › created › should use different path if attachments base url option is provided @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › created › should show trace source @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › created › should not show stack trace @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › created › should show trace title @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › created › should show multi trace source @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › created › trace should not hang when showing parallel api requests @macos-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › created › auth tokens are inherited @macos-latest-node20-2
❌ [playwright-test] › reporter-blob.spec.ts:633 › generate html with attachment urls @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › merged › should use different path if attachments base url option is provided @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › merged › should show trace source @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › merged › should not show stack trace @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › merged › should show trace title @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › merged › should show multi trace source @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › merged › trace should not hang when showing parallel api requests @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › merged › auth tokens are inherited @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:364 › created › should use different path if attachments base url option is provided @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:572 › created › should show trace source @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:608 › created › should not show stack trace @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:638 › created › should show trace title @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:660 › created › should show multi trace source @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:694 › created › trace should not hang when showing parallel api requests @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › created › auth tokens are inherited @ubuntu-latest-node20-2
❌ [playwright-test] › reporter-blob.spec.ts:633 › generate html with attachment urls @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:364 › merged › should use different path if attachments base url option is provided @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:572 › merged › should show trace source @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:608 › merged › should not show stack trace @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:638 › merged › should show trace title @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:660 › merged › should show multi trace source @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:694 › merged › trace should not hang when showing parallel api requests @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › merged › auth tokens are inherited @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:364 › created › should use different path if attachments base url option is provided @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:572 › created › should show trace source @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:608 › created › should not show stack trace @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:638 › created › should show trace title @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:660 › created › should show multi trace source @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:694 › created › trace should not hang when showing parallel api requests @ubuntu-latest-node24-2
❌ [playwright-test] › reporter-html.spec.ts:3312 › created › auth tokens are inherited @ubuntu-latest-node24-2

3 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1082 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:118 › should collapse repeated console messages for test `@ubuntu-latest-node20-2`

34325 passed, 689 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant