feat(firefox): support Response.securityDetails() (#3997)
This commit is contained in:
parent
57e7f12fbc
commit
13224a761e
@ -149,10 +149,15 @@ class Response {
|
|||||||
this._status = payload.status;
|
this._status = payload.status;
|
||||||
this._statusText = payload.statusText;
|
this._statusText = payload.statusText;
|
||||||
this._headers = {};
|
this._headers = {};
|
||||||
|
this._securityDetails = payload.securityDetails ? new SecurityDetails(payload.securityDetails) : null;
|
||||||
for (const {name, value} of payload.headers)
|
for (const {name, value} of payload.headers)
|
||||||
this._headers[name.toLowerCase()] = value;
|
this._headers[name.toLowerCase()] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
securityDetails() {
|
||||||
|
return this._securityDetails;
|
||||||
|
}
|
||||||
|
|
||||||
headers() {
|
headers() {
|
||||||
return {...this._headers};
|
return {...this._headers};
|
||||||
}
|
}
|
||||||
@ -189,4 +194,53 @@ class Response {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {NetworkManager, Request, Response};
|
class SecurityDetails {
|
||||||
|
/**
|
||||||
|
* @param {!Protocol.Network.SecurityDetails} securityPayload
|
||||||
|
*/
|
||||||
|
constructor(securityPayload) {
|
||||||
|
this._subjectName = securityPayload['subjectName'];
|
||||||
|
this._issuer = securityPayload['issuer'];
|
||||||
|
this._validFrom = securityPayload['validFrom'];
|
||||||
|
this._validTo = securityPayload['validTo'];
|
||||||
|
this._protocol = securityPayload['protocol'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
subjectName() {
|
||||||
|
return this._subjectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
issuer() {
|
||||||
|
return this._issuer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
validFrom() {
|
||||||
|
return this._validFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {number}
|
||||||
|
*/
|
||||||
|
validTo() {
|
||||||
|
return this._validTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {string}
|
||||||
|
*/
|
||||||
|
protocol() {
|
||||||
|
return this._protocol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = {NetworkManager, Request, Response, SecurityDetails};
|
||||||
|
@ -14,6 +14,7 @@ module.exports = {
|
|||||||
Puppeteer: require('./Puppeteer').Puppeteer,
|
Puppeteer: require('./Puppeteer').Puppeteer,
|
||||||
Request: require('./NetworkManager').Request,
|
Request: require('./NetworkManager').Request,
|
||||||
Response: require('./NetworkManager').Response,
|
Response: require('./NetworkManager').Response,
|
||||||
|
SecurityDetails: require('./NetworkManager').SecurityDetails,
|
||||||
Target: require('./Browser').Target,
|
Target: require('./Browser').Target,
|
||||||
TimeoutError: require('./Errors').TimeoutError,
|
TimeoutError: require('./Errors').TimeoutError,
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"node": ">=8.9.4"
|
"node": ">=8.9.4"
|
||||||
},
|
},
|
||||||
"puppeteer": {
|
"puppeteer": {
|
||||||
"firefox_revision": "167f4a537c7d87e967f5c1ce71fc9a100c347c8b"
|
"firefox_revision": "ac50a00d0cb3522407d3c84ec85360cbc4d14c9c"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"install": "node install.js",
|
"install": "node install.js",
|
||||||
|
@ -37,7 +37,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
delete state.page;
|
delete state.page;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe_fails_ffox('Response.securityDetails', function() {
|
describe('Response.securityDetails', function() {
|
||||||
it('should work', async({page, httpsServer}) => {
|
it('should work', async({page, httpsServer}) => {
|
||||||
const response = await page.goto(httpsServer.EMPTY_PAGE);
|
const response = await page.goto(httpsServer.EMPTY_PAGE);
|
||||||
const securityDetails = response.securityDetails();
|
const securityDetails = response.securityDetails();
|
||||||
@ -63,7 +63,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it_fails_ffox('should work', async({page, httpsServer}) => {
|
it('should work', async({page, httpsServer}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
const response = await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e);
|
const response = await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e);
|
||||||
expect(error).toBe(null);
|
expect(error).toBe(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user