11 Replies
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 visibleCan 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
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 messagingInteresting
Does the sandbox have a lifespan or is it indefinite?
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
Ok, I see
plasmo doc on Sandbox Pages sucks, i dont understand. a single thing what it tries to achieve
@ibrahimyaacob has reached level 1. GG!
i copied the repo example and i have no clue what is this
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")
)