Fork me on GitHub

i might be misconfiguring figwheel, but if i turn off chrome > security > allow third party site cookies, figwheel vomits on load with a `DOMException: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.`. you … cant really use figwheel with this option disabled, but is there a way to at least have figwheel check property access in a try/catch without just throwing outright? maybe a `:preloads` namespace that overrides the window.local/sessionStorage options first-thing, then more gracefully handles those security access errors?


@lwhorton yeah this should probably be a try/catch. This is in #figwheel-main right? I’ll definitely take a PR if you’re into it.


I’ll be doing a release soon


ill see what i can do this afternoon


scratch that, no way i’ll be able to get anything submitted since this is a pretty low-prio issue on our end. definitely dont anticipate a PR. 😞 i’m a bad OSS contributor.


i would think maybe this does it? but i haven’t setup checkouts and dont know the workings of sidecar/plugin, etc. to test this out locally:

+++ b/support/src/figwheel/client/utils.clj
@@ -21,5 +21,7 @@

 (defmacro feature?
   [obj feature]
-  `(and (cljs.core/exists? ~obj)
-        (cljs.core/exists? (goog.object/get ~obj ~feature))))
+  `(try
+     (and (cljs.core/exists? ~obj)
+          (cljs.core/exists? (goog.object/get ~obj ~feature)))
+     (catch :default _ false)))


:default might not work in JS, it might have to be a js/DOMException


that relies on the feature not existing


does it actually not exist? or is there only a problem when you access it?


if i turn on the chrome feature ‘block sites from setting …’ described here it looks like (for chrome at least) whenever you attempt to even read that property (. js/Window -localStorage) (or sessionStorage) with that feature blocked, you get this error:


Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.


don’t let my code mislead you, though. i only had about 30m to poke around in the codebase so there’s a very good chance this is not at all in the right place. sorry 😞


also, fwiw… i dont think most webapps have supported disabling cookies in this manner since like 2008 🤷


> or is there only a problem when you access it this ^