What's a sandbox?

And how does manifest.content_security_policy.sandbox affect it?
11 Replies
lab
lab•2y ago
So sandbox pages are similar to tab-pages, however they do not have access to cross-origin resources, as well as chrome runtime API This means: - No localStorage/cookie/any API that share states with other pages - No chrome.* It however, has access to all of web API so a sandbox page can be used to evaluate WASM, dynamic script, as well as spawning web worker etc... you can do a lot of background works with it - it's like the background page in MV2, but much more locked down and must be visible
Avi
AviOP•2y ago
Can it communicate with the rest of the extension somehow? For example, suppose you have to run a huge computation and it's better to do it via WASM and then you need to send the result back to the appropriate place in the extension
lab
lab•2y ago
manifest.content_security_policy.sandbox main job is to lock it down even further, or enable some host communication afaik - you will also need to add a flag to it to enable WASM yeah - through the relay messaging
Avi
AviOP•2y ago
Interesting Does the sandbox have a lifespan or is it indefinite?
lab
lab•2y ago
Indefinite as long as it's open unlike background page in MV2, this one must be visible to user - you can try to manipulate the windows, but the intention is to make it clear something is running when the window is closed, it will be terminated
Avi
AviOP•2y ago
Ok, I see
ibrahimyaacob
ibrahimyaacob•6mo ago
plasmo doc on Sandbox Pages sucks, i dont understand. a single thing what it tries to achieve
Arcane
Arcane•6mo ago
@ibrahimyaacob has reached level 1. GG!
ibrahimyaacob
ibrahimyaacob•6mo ago
i copied the repo example and i have no clue what is this
ibrahimyaacob
ibrahimyaacob•6mo ago
No description
Avi
AviOP•6mo ago
Essentially when you run plasno dev it will create sandboxes/test.html so that you can iframe it later (chrome.runtime.getURL("sandboxes/test.html"))
Want results from more Discord servers?
Add your server