mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-17 14:59:12 +02:00
* Adding send message and on message functions * moving table displaying into a new function * updating rootCertStats from var to let * updating comments * Apply Linter change, unused const Co-authored-by: Rob Wu <rob@robwu.nl> --------- Co-authored-by: Rob Wu <rob@robwu.nl> Co-authored-by: rebloor <git@sherpa.co.nz>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
// Note: declared with "var" because popup.js references this global variable.
|
||||
// If this were to be declared with "const" or "let", then the variable would
|
||||
// still be available to this file, but not to popup.js.
|
||||
var rootCertStats = {};
|
||||
let rootCertStats = {};
|
||||
|
||||
/*
|
||||
On an onHeadersReceived event, if there was a successful TLS connection
|
||||
@@ -39,3 +36,12 @@ browser.webRequest.onHeadersReceived.addListener(logRootCert,
|
||||
{urls: ["<all_urls>"]},
|
||||
["blocking"]
|
||||
);
|
||||
|
||||
/*
|
||||
Send the rootCertStats object to popup.js when requested.
|
||||
*/
|
||||
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
if (message.action === "getRootCertStats") {
|
||||
sendResponse({ rootCertStats: rootCertStats });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user