commit: 12fddfb30d49e02fb9392a12f2397ea65caade67
parent: 3085ab63e848a8d823dc98b34e484b9007ec7718
author: Chris Noxz <chris@noxz.tech>
date: Sun, 12 Mar 2023 17:17:16 +0100
add new article about github.com and cpu spikes
5 files changed, 44 insertions(+)
diff --git a/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.assemble b/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.assemble
@@ -0,0 +1 @@
+index.html
diff --git a/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.buildignore b/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.buildignore
diff --git a/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.metadata b/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.metadata
@@ -0,0 +1,6 @@
+.ds YEAR 2023
+.ds MONTH March
+.ds DAY 11
+.ds DATE \*[MONTH] \*[DAY], \*[YEAR]
+.ds TITLE Sites like github.com are causing CPU overload
+.ds AUTHOR Chris Noxz
diff --git a/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.tags b/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/.tags
@@ -0,0 +1,2 @@
+web browser
+fix
diff --git a/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/index.www b/noxz.tech/articles/sites_like_github_com_are_causing_cpu_overload/index.www
@@ -0,0 +1,35 @@
+I have disabled JavaScript access to the clipboard in my browser settings and
+have recently experienced frustration with the behavior of github.com in
+continually checking for clipboard support. I have discovered that github.com
+erroneously checks for clipboard support by checking the
+.ICD navigator.clipboard.read
+function,
+without taking into account whether the
+.ICD navigator.clipboard
+object is undefined, which can lead to an infinite loop that spikes CPU usage.
+
+I have found a temporary workaround by defining and injecting the
+.ICD navigator.clipboard
+object myself, creating a dummy object with the read and write functions set
+to zero (or some arbitrary non-function value). This solution effectively stops
+the infinite loop from occurring and tricks the website into thinking that
+clipboard support is disabled.
+
+.CDS
+.COS
+(function() {
+/* fix: when sites ask for a clipboard such as github.com
+ * in navigator-clipboard.js causing CPU-overload! */
+navigator.clipboard = {
+ read : 0,
+ write : 0,
+};
+}());
+.COE
+.CDE
+
+It's important to note that other users who have not disabled clipboard access
+in their browser settings may not have experienced this issue. However, the
+solution provided may still be helpful for those who have disabled clipboard
+access and are experiencing similar issues with github.com's clipboard support
+check.