figwheel

general discussion about figwheel, specific discussions in #figwheel-main and #lein-figwheel
lwhorton 2020-06-03T18:00:11.082600Z

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?

bhauman 2020-06-03T18:48:25.084400Z

@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.

bhauman 2020-06-03T18:56:46.084800Z

I’ll be doing a release soon

lwhorton 2020-06-03T19:29:29.085Z

ill see what i can do this afternoon

lwhorton 2020-06-03T20:35:49.086900Z

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.

lwhorton 2020-06-03T20:36:52.087400Z

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)))

lwhorton 2020-06-03T20:37:41.087900Z

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

bhauman 2020-06-03T21:18:14.088400Z

that relies on the feature not existing

bhauman 2020-06-03T21:18:45.089300Z

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

bhauman 2020-06-03T21:18:55.089600Z

@lwhorton ^

lwhorton 2020-06-03T21:21:18.091Z

if i turn on the chrome feature ‘block sites from setting …’ described here https://stackoverflow.com/questions/30481516/iframe-in-chrome-error-failed-to-read-localstorage-from-window-access-deni 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:

lwhorton 2020-06-03T21:21:22.091400Z

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

lwhorton 2020-06-03T21:23:53.092Z

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 😞

lwhorton 2020-06-03T21:24:55.092500Z

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

lwhorton 2020-06-03T21:27:05.092600Z

lwhorton 2020-06-03T21:27:49.093100Z

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