aboutsummaryrefslogtreecommitdiff
path: root/content/freezer.js
blob: 9dbc95eaf32e1dca8fe77cc2fa1b33cd08b00227 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
 * Helper functions for blocking scripts in pages, based off NoScript's lib/DocumentFreezer.js
 *
 * Copyright (C) 2005-2021 Giorgio Maone - https://maone.net
 * Copyright (C) 2021 jahoti
 * Redistribution terms are gathered in the `copyright' file.
 */

const loaderAttributes = ["href", "src", "data"];
const jsOrDataUrlRx = /^(?:data:(?:[^,;]*ml|unknown-content-type)|javascript:)/i;

function sanitize_attributes(element) {
    if (element._frozen)
	return;
    let fa = [];
    let loaders = [];
    let attributes = element.attributes || [];

    for (let a of attributes) {
	let name = a.localName.toLowerCase();
	if (loaderAttributes.includes(name))
	    if (jsOrDataUrlRx.test(a.value))
		loaders.push(a);

	else if (name.startsWith("on")) {
	    console.debug("Removing", a, element.outerHTML);
	    fa.push(a.cloneNode());
	    a.value = "";
	    element[name] = null;
	}
    }
    if (loaders.length) {
	for (let a of loaders) {
	    fa.push(a.cloneNode());
	    a.value = "javascript://frozen";
	}
	if ("contentWindow" in element)
	    element.replaceWith(element = element.cloneNode(true));

    }
    if (fa.length)
	element._frozenAttributes = fa;
    element._frozen = true;
}

function mozilla_suppress_scripts(e) {
    if (document.readyState === 'complete') {
	removeEventListener('beforescriptexecute', blockExecute, true);
	console.log('Script suppressor has detached.');
	return;
    }
    if (e.isTrusted && !e.target._hachette_payload) {
	e.preventDefault();
	console.log('Suppressed script', e.target);
    }
};

/*
 * EXPORTS_START
 * EXPORT mozilla_suppress_scripts
 * EXPORT sanitize_attributes
 * EXPORTS_END
 */
ples/vm-image.tmpl: Likewise * gnu/system/examples/yggdrasil.tmpl: Likewise * gnu/system/hurd.scm: Likewise * gnu/system/images/hurd.scm: Likewise * gnu/system/images/novena.scm: Likewise * gnu/system/images/pine64.scm: Likewise * gnu/system/images/pinebook-pro.scm: Likewise * gnu/system/images/rock64.scm: Likewise * gnu/system/install.scm: Likewise * gnu/system/vm.scm: Likewise * gnu/tests.scm: Likewise * gnu/tests/ganeti.scm: Likewise * gnu/tests/install.scm: Likewise * gnu/tests/nfs.scm: Likewise * gnu/tests/telephony.scm: Likewise * tests/boot-parameters.scm: Likewise * tests/system.scm: Likewise 2021-08-15Update copyright/name notices for Christine Lemmer-Webber.Christopher Lemmer Webber * doc/guix-cookbook.texi: Update copyright/name for Christine Lemmer-Webber. * gnu/build/image.scm: Likewise. * gnu/build/vm.scm: Likewise. * gnu/packages/admin.scm: Likewise. * gnu/packages/assembly.scm: Likewise. * gnu/packages/audio.scm: Likewise. * gnu/packages/backup.scm: Likewise. * gnu/packages/check.scm: Likewise. * gnu/packages/databases.scm: Likewise. * gnu/packages/emacs-xyz.scm: Likewise. * gnu/packages/finance.scm: Likewise. * gnu/packages/gnupg.scm: Likewise. * gnu/packages/guile-xyz.scm: Likewise. * gnu/packages/guile.scm: Likewise. * gnu/packages/haskell-xyz.scm: Likewise. * gnu/packages/linux.scm: Likewise. * gnu/packages/mail.scm: Likewise. * gnu/packages/password-utils.scm: Likewise. * gnu/packages/perl.scm: Likewise. * gnu/packages/python-web.scm: Likewise. * gnu/packages/python-xyz.scm: Likewise. * gnu/packages/python.scm: Likewise. * gnu/packages/sphinx.scm: Likewise. * gnu/packages/ssh.scm: Likewise. * gnu/packages/xdisorg.scm: Likewise. * gnu/services/networking.scm: Likewise. * gnu/system/vm.scm: Likewise. 2021-08-15doc: Fix typo.Ricardo Wurmus * doc/guix-cookbook.texi (GUIX_PACKAGE_PATH): Fix typo in file name. Reported-by: breathein on IRC. 2021-07-18Merge branch 'master' into core-updatesLudovic Courtès 2021-07-12doc: cookbook: Adjust example to simplified input style.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Adjust example to new input style and adjust "Inputs" section. 2021-07-12doc: cookbook: Remove trailing #t from extended example.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Remove trailing #t from snippet and phases. 2021-07-07doc: Add guide showing auto-login on a specific TTY to the cookbook.Joshua Branson This is a follow-up to the discussion in <https://bugs.gnu.org/48974>. * doc/guix-cookbook.texi (System Configuration): Add a brief guide that explains auto login a user to one TTY. * doc/guix.texi (System Services): Add an texinfo anchor, so that the cookbook entry "Auto Login a User to a Specific TTY" can refer back to the precise point that the GNU Guix Reference manual. Also add a reference to the cookbook that shows how to auto login a specific user to one TTY. Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at> 2021-01-21doc: cookbook: Add "Guix System Image API" section.Joshua Branson * doc/guix-cookbook.texi (Guix System Image API): New section. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> 2021-01-20doc: Replace TP with Weblate mentions.Julien Lepiller * doc/contributing.texi: Replace link to TP with a link to Weblate. * doc/guix.texi: Replace link to TP with a link to Weblate. * doc/guix-cookbook.texi: Replace link to TP with a link to Weblate. 2020-12-23doc: cookbook: Fix "fiction-less" typo.Pierre Neidhardt * doc/guix-cookbook.texi (Guix Profiles in Practice): Change "friction-less" to "frictionless". 2020-10-17doc: cookbook: Balance parens in custom kernel examples.Ludovic Courtès * doc/guix-cookbook.texi (Customizing the Kernel): Add missing paren in example. Remove extra parens in other example. 2020-10-15doc: cookbook: Clarify what keywords are.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Clarify what keywords are. 2020-10-15doc: Add "Build Utilities" section.Ludovic Courtès * doc/guix.texi (Build Utilities): New section. (Defining Packages): Refer to it. (Build Systems): Likewise. * doc/guix-cookbook.texi (Extended example): Likewise. 2020-10-15doc: cookbook: Use @code for the identifiers of utility functions.Ludovic Courtès * doc/guix-cookbook.texi (Utility functions): Use @code instead of @asis. 2020-10-15doc: cookbook: More "#true" and "#false".Ludovic Courtès * doc/guix-cookbook.texi (Extended example) (Customizing the Kernel, Running Guix on a Linode Server): Use #true and #false. 2020-10-15doc: cookbook: Use @var for meta-syntactic variables.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Use @var for meta-syntactic variables in 'modify-phases' description. 2020-10-15doc: cookbook: Fix 'let' form in example.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Fix 'let' form in example. 2020-10-14services: nginx: Add lua module.Oleg Pykhalov * gnu/services/web.scm (<nginx-configuration>) [lua-package-path, lua-package-cpath]: New record types. * gnu/services/web.scm (default-nginx-config): Use them. * doc/guix.texi (Web Services): Document this. * doc/guix-cookbook.texi (System Configuration): Document this. 2020-10-14doc: cookbook: Mention "#true" and "#false".Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Mention "#true" and "#false". (Extended example): Likewise. 2020-09-09doc: cookbook: Adding a section "Running Guix on a Linode Server"Joshua Branson * doc/guix-cookbook.texi (Running Guix on a Linode Server): I added a section that explains how to run guix on a linode server. Thanks Chris Webber! Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-08-23doc: cookbook: Add chapter about Guix environment.Oleg Pykhalov * doc/guix-cookbook.texi (Environment management): New chapter. 2020-07-09doc: cookbook: Fix ‘file system’ spelling.Tobias Geerinckx-Rice * doc/guix-cookbook.texi (Getting help, Customizing the Kernel): Fix ‘file system’ spelling. 2020-06-28doc: cookbook: Fix encoding of "André".Ludovic Courtès This is a followup to f8945734a5abff69644284231cc47fb67456657b. * doc/guix-cookbook.texi: Encode "André" as UTF-8, not ISO-8859-1. 2020-06-28doc: cookbook: Update entry about getting substitutes through Tor.André Batista * doc/guix-cookbook.texi (Getting substitutes from Tor): Update section warning to mention the use of torsocks when pulling. 2020-06-23doc: cookbook: Fix typos.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Fix typos. 2020-06-23doc: cookbook: Tweak intro to the REPL.Ludovic Courtès * doc/guix-cookbook.texi (A Scheme Crash Course): Reword first paragraph. Remove extra paren. 2020-06-23doc: cookbook: Mention "guix hash -rx" for Git checkouts.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Mention "guix hash -rx ." 2020-06-23doc: cookbook: Clarify 'git-fetch' conventions.Ludovic Courtès * doc/guix-cookbook.texi (Extended example): Clarify use of 'git-file-name' and 'git-version'. 2020-06-04doc: cookbook: Add entry about getting substitutes through Tor.Brice Waegeneire * doc/guix-cookbook.texi (Getting substitutes from Tor): New section. 2020-06-02doc: cookbook: Add entry about Wireguard VPN.Marcin Karpezo Co-authored-by: Brice Waegeneire <brice@waegenei.re> * doc/guix-cookbook.texi (Connect to Wireguard VPN): New section. 2020-05-25doc: cookbook: Add subsection about session locking with xss-lock.Chris Bøg * doc/guix-cookbook.texi (Session lock): New node. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-05-05doc: cookbook: Fix sbcl-ttf-fonts package name.Jean-Baptiste Note * doc/guix-cookbook.texi (StumpWM): Adjust sbcl-ttf-fonts package name. Signed-off-by: Marius Bakke <mbakke@fastmail.com> 2020-04-30doc: cookbook: Rename stumpwm package to current state.Marcin Karpezo * doc/guix-cookbook.texi (StumpWM): Rename STUMPWM package to current state. Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com> 2020-04-25doc: cookbook: Fix quotes.Nicolas Goaziou * doc/guix-cookbook.texi (Basic setup with manifests): (Default profile): (The benefits of manifests): Use proper quotes in regular texts. 2020-04-24doc: cookbook: Use @file for file names and extensions.Nicolas Goaziou * doc/guix-cookbook.texi (@samp{GUIX_PACKAGE_PATH}): (Extended example): (Setting up a bind mount): (Basic setup with manifests): (Default profile): Use @file instead of @samp or @code for file names and extensions. 2020-04-24doc: cookbook: Fix misuses of double spacing.Nicolas Goaziou * doc/guix-cookbook.texi (Extended example): (StumpWM): (Basic setup with manifests): Prevent Texinfo from ending a sentence where it should not. (Setting up a bind mount): Add two spaces where needed. 2020-04-22doc: cookbook: Explain how to use bind mounts.Matthew Brooks * doc/guix-cookbook.texi (Setting up a bind mount): Add example. Signed-off-by: Leo Famulari <leo@famulari.name> 2020-03-30gnu: Add sbcl-stumpwm-ttf-fonts.Oleg Pykhalov * gnu/packages/wm.scm (sbcl-stumpwm-ttf-fonts): New variable. * doc/guix-cookbook.texi (Customizing a Window Manager): Document SBCL-STUMPWM-TTF-FONTS installation and configuration.