Fork me on GitHub
#shadow-cljs
<
2023-05-02
>
Ertugrul Cetin14:05:31

I'm using flatted JS library (to use stringify, basically similar to JSON.stringify), and I get very odd error in CLJS REPL, any ideas?

["flatted" :refer [stringify]]

------

(stringify (pc/find-by-name "model")) ;; JS object

Execution error (SecurityError) at (<cljs repl>:1).
Blocked a frame with origin "" from accessing a cross-origin frame.
=> :repl/exception!

thheller15:05:54

pretty clear error? this is your browser telling you that you are trying to do cross site scripting, which it blocks for security reasons

thheller15:05:20

what does (pc/find-by-name "model") return?

Ertugrul Cetin15:05:01

It's an object, from PlayCanvas library - simple entity object

Ertugrul Cetin15:05:47

I can run (pc/find-by-name "model") alone and get; => #object[Entity [object Object]],

thheller16:05:45

"object" has a very very broad definition in JS, if it is from another frame/context/document it only looks like an object, but in fact is a proxy to the actual thing in the other context. which limits the things you are allowed to do with it

thheller16:05:04

could be enough if the object holds a reference to something, doesn't need to be the whole object

Ertugrul Cetin16:05:19

I see thank you for the explanation!