shithub: mycel

Download patch

ref: 4de121d2ae73148170b35ff881c4aa97d77cd5dd
parent: c9faa5d093ef6a890e00fb92880ab1a2edf9801c
author: Philip Silva <philip.silva@protonmail.com>
date: Wed Dec 16 14:56:05 EST 2020

Disable noscript tag by default

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -34,6 +34,7 @@
 
 var DebugDumpCSS *bool
 var ExperimentalJsInsecure *bool
+var EnableNoScriptTag *bool
 
 var browser *Browser // TODO: limit global objects;
 //       at least put them in separate pkgs
@@ -833,7 +834,7 @@
 			numElements++
 			return NewTable(n).Element(r+1, b, n.Map)
 		case "noscript":
-			if *ExperimentalJsInsecure {
+			if *ExperimentalJsInsecure || !*EnableNoScriptTag {
 				return nil
 			}
 			fallthrough
--- a/browser/browser_test.go
+++ b/browser/browser_test.go
@@ -59,6 +59,8 @@
 }
 
 func TestNodeToBoxNoscript(t *testing.T) {
+	enable := true
+	EnableNoScriptTag = &enable
 	htm := `
 		<body>
 			<noscript>
--- a/cmd/browse/main.go
+++ b/cmd/browse/main.go
@@ -33,6 +33,7 @@
 	browser.DebugDumpCSS = flag.Bool("debugDumpCSS", false, "write css to info.css")
 	domino.DebugDumpJS = flag.Bool("debugDumpJS", false, "write js to main.js")
 	browser.ExperimentalJsInsecure = flag.Bool("experimentalJsInsecure", false, "DO NOT ACTIVATE UNLESS INSTRUCTED OTHERWISE")
+	browser.EnableNoScriptTag = flag.Bool("enableNoScriptTag", false, "enable noscript tag")
 	logger.Quiet = flag.Bool("quiet", defaultQuietActive, "don't print info messages and non-fatal errors")
 }