Naja Melan:
> ok,
>
> thanks, now it all makes sense ;)
>
Except for one thing. Sorry to be nitpicking, but the MDN page now says:

sameZoneAs: A JavaScript object in whose garbage collection region the sandbox 
should be created in. This helps to improve memory usage by allowing sandboxes 
to be discarded when that zone goes away. Content scripts pass the window 
they're running in as this parameter, in order to ensure that the script is 
cleaned up at the same time as the content itself.

This seems to claim that by setting this option will discard your sandbox 
automatically and that it ensures scripts will be cleaned up when the window is 
cleaned up. That seems in contradiction with what Bobby Holley explains.

I would suggest a wording like:

A JavaScript object in whose garbage collection region the sandbox should be 
created in. Objects created in the same garbage collection region will be 
allocated in the same block of heap memory, so if they are all freed at the 
same time the garbage collector can liberate bigger blocks of memory at once 
which reduces memory consumption [[or is it just a question of performance]]. 
For content scripts you should pass the window your script runs in as this 
option. You still have to use Components.utils.nukeSandbox or stop holding 
references to your sandbox when the user closes the browser tab for this to 
have effect.

Naja Melan
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to