Permalink
Browse files

Fix mistakes in the Sandbox tutorial.

Default profiles were incorrectly mapped, and I was not explicit enough
about Sandbox.no_writes and Sandbox.temporary_writes

git-svn-id: https://svn.macosforge.org/repository/ruby/MacRubyWebsite/trunk@4780 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent ea9bc3c commit 962f66b25994ae898ba5e15f7c19c124b44f487a mattaimonetti@gmail.com committed Oct 9, 2010
Showing with 8 additions and 9 deletions.
  1. +8 −9 content/documentation/the-sandbox-class.txt
@@ -47,15 +47,15 @@ Every profile returns an instance of the Sandbox class.
* Sandbox.no_internet
Access by the current process to the internet is restricted.
-* Sandbox.no_networking
+* Sandbox.no_network
Access by the current process to any kind of networking is restricted.
* Sandbox.temporary_writes
- Access by the current process to anywhere *but* /var/tmp and the directory specified by the
- configuration variable _CS_DARWIN_USER_TEMP_DIR.
+ Access by the current process to write to anywhere *but* /var/tmp and the directory specified by
+ the configuration variable _CS_DARWIN_USER_TEMP_DIR.
-* Sandbox.no_filesystem_write
- Access by the current process to anywhere on the filesystem is restricted.
+* Sandbox.no_writes
+ Access by the current process to write to anywhere on the filesystem is restricted.
h3. Initiating a sandbox
@@ -64,7 +64,7 @@ Sandbox class.The sandbox class defines a single instance method(excluding those
and that is *Sandbox#apply!*. The #apply! method will initiate the sandbox for the current
MacRuby process.
-For example, to apply the <b>Sandbox.pure_computation</b> profile, and create a sandbox for the
+For example, to apply the *Sandbox.pure_computation* profile, and create a sandbox for the
current MacRuby process, you would do the following:
<% coderay :lang => 'ruby' do %>
@@ -116,16 +116,14 @@ a SecurityError exception. This can be handled easily:
begin
Sandbox.pure_computation.apply!
Sandbox.pure_computation.apply!
- rescue SecurityError => e
+rescue SecurityError => e
puts "I couldn't initialize a sandbox!"
end
<% end %>
The second call to Sandbox.pure_computation.apply! will raise a SecurityError because of restrictions
imposed by the first call to Sandbox.pure_computation.apply!
-
-
h3. Notes
All resources acquired before the sandbox is initialized(Socket objects, File objects, …) are not
@@ -144,3 +142,4 @@ h3. See also
</div>
+

0 comments on commit 962f66b

Please sign in to comment.