I want the code to:
use modules in Pengines. The module uses persistency lib and works fine. Maybe using ajax is a better way?
But what I’m getting is:
No permission to call sandboxed `source_location(_3044,_3046)’
My code looks like this:
<script type="text/x-prolog">
main :-
use_module(data_db),
data_db:attach_data_db("data_db"),
data_db:add_user(bik, user).
</script>
var pengine = new Pengine({
ask: 'main',
server: 'https://pengines.swi-prolog.org/pengine',
onsuccess: handleSuccess
});
function handleSuccess() {
$('#out').html('success');
if (!this.more) {
$('#next').prop("disabled", true);
}
}
You’re surely not going to get access to the persistency stuff in a sandboxed pengine environment. To some extend you can load libraries, but typically only rather simple libraries loading pure Prolog code. Anything that tries to do fancy stuff is typically blocked by the sandbox. Cross module calls are generally not allowed either.
You can do anything with a self-hosted pengine environment by pre-loading the libraries you need and define interfaces that you declare as sandbox-safe to code that is not by default considered safe. By default, only side-effect free code and code that affects the temporary module in which the pengines lives is considered safe. This with the limitation that the pengine must be able to proof the code cannot call anything that is white listed.