[docs] Add a bit of SeedContext documentation
authorTim Horton <hortont424@gmail.com>
Wed, 8 Jul 2009 21:49:29 +0000 (17:49 -0400)
committerTim Horton <hortont424@gmail.com>
Wed, 8 Jul 2009 21:49:29 +0000 (17:49 -0400)
doc/reference/tmpl/seed-context.sgml
libseed/seed-api.c
libseed/seed-engine.c

index 6dde241..41ab611 100644 (file)
@@ -6,7 +6,11 @@ Self-contained JavaScript execution environments
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-Long description
+A #SeedContext provides a complete "universe" for the execution of JavaScript. You can use seed_context_new() to create a sandboxed context that lacks the import system, so it can be used to execute somewhat untrusted JavaScript (as it has no way to access the rest of your system). You can also expose the default set of globals (including "print", "imports", and "Seed") to create more powerful but still self-contained environments within which to execute code.
+</para>
+
+<para>
+The "sandbox" module provides access to this system from the JavaScript side of Seed.
 </para>
 
 <!-- ##### SECTION See_Also ##### -->
index 3b8c646..336314d 100644 (file)
@@ -61,6 +61,10 @@ seed_value_unprotect (JSContextRef ctx,
  * @global_class: The #SeedClass to use to create the global object, or %NULL to
  *                create it with the default class.
  *
+ * Create a new #SeedContext. By default, this creates a new context
+ * which has no global objects; you can add the default set using
+ * seed_prepare_global_context().
+ *
  * Return value: A new #SeedContext.
  *
  */
index c8cb189..6a91a68 100644 (file)
@@ -60,8 +60,15 @@ static const GDebugKey seed_debug_keys[] = {
 };
 #endif /* SEED_ENABLE_DEBUG */
 
-void
-seed_prepare_global_context (JSContextRef ctx)
+/**
+ * seed_prepare_global_context:
+ * @group: A #SeedContext on which to add the default set of global objects.
+ *
+ * Adds the default set of global objects (imports, GType, Seed, and print)
+ * to a fresh #SeedContext.
+ *
+ */
+void seed_prepare_global_context (JSContextRef ctx)
 {
   JSObjectRef global = JSContextGetGlobalObject (ctx);