Skip to content

Commit

Permalink
fix: collect header orders for all browsers [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
barjin committed Apr 5, 2023
1 parent 14b9da2 commit 62a1257
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/model-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- name: Install Playwright browsers and collect HTTP header orders
run: |
npx playwright install
npx playwright install webkit
npx playwright install chrome
npx playwright install msedge
xvfb-run --auto-servernum -- node ./packages/header-order-collector/collector.js > ./packages/header-generator/src/data_files/headers_order.json
Expand Down
28 changes: 16 additions & 12 deletions packages/header-order-collector/collector.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,26 @@ async function getHeadersFor(launcher, httpVersion) {
v2(HTTP2port);

const browserTypes = {
// safari: () => playwright.webkit.launch(),
safari: () => playwright.webkit.launch(),
chrome: (p) => playwright.chromium.launch(p),
firefox: (p) => playwright.firefox.launch(p),
// edge: () => playwright.chromium.launch({ channel: 'msedge' }),
edge: () => playwright.chromium.launch({ channel: 'msedge' }),
};

const x = await Promise.all(
Object.entries(browserTypes)
.map(async ([name, launcher]) => {
return [name, [...await getHeadersFor(launcher, 1), ...await getHeadersFor(launcher, 2)]];
})
);

console.log(JSON.stringify(Object.fromEntries(x), null, 4));

process.exit(0);
try {
const x = await Promise.all(
Object.entries(browserTypes)
.map(async ([name, launcher]) => {
return [name, [...await getHeadersFor(launcher, 1), ...await getHeadersFor(launcher, 2)]];
})
);
console.log(JSON.stringify(Object.fromEntries(x), null, 4));
process.exit(0);

} catch (e) {
console.error(e);
process.exit(1);
}
}
)();

0 comments on commit 62a1257

Please sign in to comment.