v147 · Isolated Web Apps · demo
API Explorer
Step through the webRequest event lifecycle inside a ControlledFrame and inspect the SecurityInfo object available at each stage. API available in Isolated Web App context only — this page shows the interface and code patterns.
event lifecycle
Fires before the request is made. No TLS information is available yet — the connection has not been established.
frame.webRequest.onBeforeRequest.addListener(
(details) => {
// details.url, details.method, details.requestId
// No certificate info available at this point
},
{ urls: ['https://*/*'] }
);
Fires after server response headers arrive. Request the securityInfo extra info key to receive details.securityInfo; request securityInfoRawDer when raw certificate bytes are needed.
frame.webRequest.onHeadersReceived.addListener(
(details) => {
// details.securityInfo is available with 'securityInfo'
const si = details.securityInfo;
if (si) {
console.log(si.certificates[0].fingerprint.sha256); // SHA-256 hex
}
},
{ urls: ['https://*/*'] },
['securityInfo'] // or 'securityInfoRawDer'
);
Fires when the response body is fully received. Use this event for completion status, but capture certificate trust data earlier from onHeadersReceived.
frame.webRequest.onCompleted.addListener(
(details) => {
const fp = trustedFingerprints.get(new URL(details.url).hostname);
if (details.statusCode === 200 && fp) {
openDirectSocket(details.url); // proceed with stored trust anchor
}
},
{ urls: ['https://*/*'] }
);
SecurityInfo object
'securityInfo' extra info key"secure", "insecure", "weak", or "broken".fingerprint.sha256, used as the trust anchor for a parallel Direct Socket.securityInfoRawDer is requested; use it when raw certificate bytes must be compared.securityInfo nor securityInfoRawDer is requested, details.securityInfo is omitted and the app must not trust the socket.failure branches
Choose a branch to see whether a Direct Socket may proceed.
see also
- Certificate Flow — how SecurityInfo enables Direct Socket trust
- Back to feature index
- ChromeStatus entry
scenario focus
Select a scenario to focus its rendered example and summary.