[seed] [docs] Add a bit of SeedContext documentation
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed] [docs] Add a bit of SeedContext documentation
- Date: Wed, 8 Jul 2009 21:49:49 +0000 (UTC)
commit aa2c73c6f6afeb3631ee1f01aa2f9c51a002aa21
Author: Tim Horton <hortont424 gmail com>
Date: Wed Jul 8 17:49:29 2009 -0400
[docs] Add a bit of SeedContext documentation
doc/reference/tmpl/seed-context.sgml | 6 +++++-
libseed/seed-api.c | 4 ++++
libseed/seed-engine.c | 11 +++++++++--
3 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/doc/reference/tmpl/seed-context.sgml b/doc/reference/tmpl/seed-context.sgml
index 6dde241..41ab611 100644
--- a/doc/reference/tmpl/seed-context.sgml
+++ b/doc/reference/tmpl/seed-context.sgml
@@ -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 ##### -->
diff --git a/libseed/seed-api.c b/libseed/seed-api.c
index 3b8c646..336314d 100644
--- a/libseed/seed-api.c
+++ b/libseed/seed-api.c
@@ -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.
*
*/
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index c8cb189..6a91a68 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]