/**
* Hachette main content script run in all frames
*
* Copyright (C) 2021 Wojtek Kosior
* Copyright (C) 2021 jahoti
* Redistribution terms are gathered in the `copyright' file.
*/
/*
* IMPORTS_START
* IMPORT handle_page_actions
* IMPORT url_extract_target
* IMPORT gen_unique
* IMPORT gen_nonce
* IMPORT csp_rule
* IMPORT is_privileged_url
* IMPORT sanitize_attributes
* IMPORT mozilla_suppress_scripts
* IMPORT is_chrome
* IMPORT is_mozilla
* IMPORT start_activity_info_server
* IMPORTS_END
*/
/*
* Due to some technical limitations the chosen method of whitelisting sites
* is to smuggle whitelist indicator in page's url as a "magical" string
* after '#'. Right now this is only supplemental in HTTP(s) pages where
* blocking of native scripts also happens through CSP header injection but is
* necessary for protocols like ftp:// and file://.
*
* The code that actually injects the magical string into ftp:// and file://
* urls has not yet been added to the extension.
*/
var nonce = undefined;
function handle_mutation(mutations, observer)
{
if (document.readyState === 'complete') {
console.log("mutation handling complete");
observer.disconnect();
return;
}
for (const mutation of mutations) {
for (const node of mutation.addedNodes)
block_node(node);
}
}
function block_nodes_recursively(node)
{
block_node(nod