[seed] Importer : prevent print(imports.somefile) running "somefile/toString.js



commit bbbc6f9d79d62fb0c220d155dec98a823830299c
Author: Jonatan Liljedahl <lijon kymatica com>
Date:   Mon Jul 5 13:15:47 2010 +0800

    Importer : prevent print(imports.somefile) running "somefile/toString.js
    
    also fixes toValue.js as well.

 libseed/seed-importer.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 421f71e..7c85a59 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -849,6 +849,14 @@ seed_importer_dir_get_property (JSContextRef ctx,
     len = JSStringGetMaximumUTF8CStringSize (property_name);
     prop = g_alloca (len * sizeof (gchar));
     JSStringGetUTF8CString (property_name, prop, len);
+
+    /* These prevent print(imports.somefile) running "somefile/toString.js" 
+       Which is more than a little unexpected.. */
+
+    if (!g_strcmp0 (prop, "toString"))
+        return NULL;
+    if (!g_strcmp0 (prop, "valueOf"))
+        return NULL;
     
     return seed_importer_search_dirs(ctx, &path, prop, exception);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]