-
Notifications
You must be signed in to change notification settings - Fork 1
WIP: feat(har): experiment with finish callbacks #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Updates in the HAR capture Log Entries: * `serverIPAddress`: (string) This now gets populated. * `_serverPort`: (number) This now gets populated. There isn't an official field according to this [w3 doc][w3] (and I didn't see a suitable field in a HAR download from Chromium DevTools). I used the field name from [WK WebInspector HARBuilder.js][wk]. * _securityDetails: non-standard info that is helpful in making assertions about cert expiries. This also introduces new APIs on `network.Response` exposing the new info. NB: At first these APIs were synchonous and populated with info that is readily available at the beginning of the Response creation, but WK does not emit IP address info until _loadingFinished, so the API's were all turned into Promise-based approaches. Closes microsoft#6624. [w3]: https://www.w3.org/community/bigdata-tools/files/2017/10/HAR_Spec_TO_HAR_Vocabulary.pdf [wk]: https://opensource.apple.com/source/WebInspectorUI/WebInspectorUI-7608.4.9.1.3/UserInterface/Controllers/HARBuilder.js.auto.html
|
|
||
| const detailsFoo = log.entries[0]; | ||
|
|
||
| if (browserName === 'webkit') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be a quirk of WK dev protocol wrt to redirects, atm. If you run the following with DEBUG="pw:protocol" you'll only see one remoteAddress in the all the logged events (corresponding to the destination, but not the intermediate redirects).
This matches what Safari shows in the Inspector tab.
// @ts-check
const http = require("http");
const pw = require("playwright");
const redirect = http.createServer((req, res) => {
res.writeHead(301, "Redirect", { Location: "http://localhost:4848"});
res.end();
});
const server = http.createServer((req, res) => {
res.setHeader("Content-Type", "text/html");
res.end("<p>OK</p>");
});
redirect.listen(4747);
server.listen(4848);
(async () => {
const browser = await pw.webkit.launch();
const context = await browser.newContext({ recordHar: { path: "record.har" }});
const page = await browser.newPage();
await page.goto("http://localhost:4747/foo");
await page.waitForSelector("text='OK'");
await context.close();
await browser.close();
redirect.close();
server.close();
})();
No description provided.