After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771520 - Write a very documented test for the seed_init_constrained scenario.
Write a very documented test for the seed_init_constrained scenario.
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
git master
Other All
: Normal normal
: ---
Assigned To: seed-maint
seed-maint
Depends on:
Blocks:
 
 
Reported: 2016-09-16 09:40 UTC by Mathieu Duponchelle
Modified: 2016-09-16 12:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
seed-importer: set empty search path on init. (1.55 KB, patch)
2016-09-16 09:40 UTC, Mathieu Duponchelle
committed Details | Review
seed.h: fix exposed prototypes (1.13 KB, patch)
2016-09-16 09:40 UTC, Mathieu Duponchelle
committed Details | Review
seed-engine: expose API to initialize the importer. (2.56 KB, patch)
2016-09-16 09:40 UTC, Mathieu Duponchelle
committed Details | Review
seed-builtins: expose API to init builtins (842 bytes, patch)
2016-09-16 09:40 UTC, Mathieu Duponchelle
committed Details | Review
Add a very documented test to demonstrate sandboxing (7.19 KB, patch)
2016-09-16 09:40 UTC, Mathieu Duponchelle
committed Details | Review

Description Mathieu Duponchelle 2016-09-16 09:40:17 UTC
And slightly update some API in order to really expose the sandboxing
granularity that this engine initialization method offers.
Comment 1 Mathieu Duponchelle 2016-09-16 09:40:21 UTC
Created attachment 335685 [details] [review]
seed-importer: set empty search path on init.

If imports is available, there's no reason to error out with
a cryptic message (searchPath is not an array), it's better to
just let the import attempt happen, with the user obtaining
and undefined object instead of an exception.
Comment 2 Mathieu Duponchelle 2016-09-16 09:40:25 UTC
Created attachment 335686 [details] [review]
seed.h: fix exposed prototypes
Comment 3 Mathieu Duponchelle 2016-09-16 09:40:30 UTC
Created attachment 335687 [details] [review]
seed-engine: expose API to initialize the importer.
Comment 4 Mathieu Duponchelle 2016-09-16 09:40:34 UTC
Created attachment 335688 [details] [review]
seed-builtins: expose API to init builtins

Examples of builtins are "print" or "quit".
Comment 5 Mathieu Duponchelle 2016-09-16 09:40:39 UTC
Created attachment 335689 [details] [review]
Add a very documented test to demonstrate sandboxing

.. of the engine using mostly existing API.
Comment 6 Emanuele Aina 2016-09-16 10:31:17 UTC
Review of attachment 335685 [details] [review]:

Looks good to me, just a typo in the commit message "and undefined object" → "an undefined object".

I'd also put "imports" (and "searchPath", even if it's less relevant there) in some kind of quotes/backticks/whatever to make it clear that they are identifiers.
Comment 7 Emanuele Aina 2016-09-16 10:38:28 UTC
Review of attachment 335686 [details] [review]:

This is a bit weird because it would be an API break, but it's just the prototype to be wrong and the actual function already takes a pointer so it's not an ABI break.

Looks good. :)
Comment 8 Emanuele Aina 2016-09-16 10:48:39 UTC
Review of attachment 335687 [details] [review]:

Looks good, taking in consideration some pre-existing weirdness. :D

::: libseed/seed-private.h
@@ +43,3 @@
     JSContextGroupRef group;
     gchar* program_name;
+    gboolean importer_initialized;

This is a private re-definition of the publicly exported struct. I don't understand its purpose, but as things stands it seems right to update it in both places.

::: libseed/seed.h
@@ +68,3 @@
     SeedContextGroup group;
     gchar* program_name;
+    gboolean importer_initialized;

This would be an ABI break, but I guess it's safe to assume people don't allocate this by hand but only through seed_init() so it's not an issue.

I wonder why these are public though, but it has nothing to do with this commit. :)
Comment 9 Emanuele Aina 2016-09-16 10:50:27 UTC
Review of attachment 335688 [details] [review]:

Looks good to me.
Comment 10 Emanuele Aina 2016-09-16 10:55:48 UTC
Review of attachment 335689 [details] [review]:

Looks good to me, just the wrong year on a copyright header. :)

::: tests/c/test-module-whitelist.c
@@ +15,3 @@
+ * along with Seed.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright © 2015 Robert Bosch Car Multimedia GmbH

© 2016 I suppose. :)
Comment 11 Mathieu Duponchelle 2016-09-16 12:57:35 UTC
Attachment 335685 [details] pushed as 692b87b - seed-importer: set empty search path on init.
Attachment 335686 [details] pushed as b168f28 - seed.h: fix exposed prototypes
Attachment 335687 [details] pushed as 82e6e90 - seed-engine: expose API to initialize the importer.
Attachment 335688 [details] pushed as 1a4f19e - seed-builtins: expose API to init builtins
Attachment 335689 [details] pushed as 941a8c5 - Add a very documented test to demonstrate sandboxing