[x3d-public] script security

John Carlson yottzumm at gmail.com
Thu Oct 15 19:31:15 PDT 2020


On Thu, Oct 15, 2020 at 9:25 PM John Carlson <yottzumm at gmail.com> wrote:

> What I am searching for is:
>
> 1. How to add Script related routes to X3DOM
>

Once I set up Script and fields, this is done automatically with setupTree?


> 2. How to hook in Proto IS statements found in Scripts.
>

Not sure how to do that yet.

> 3. How to modify any Script code to support parsing and the above.
>

adding any functions, declaring variables, etc.

>
> On Thu, Oct 15, 2020 at 9:15 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> Something like
>>
>> fromNode.setupRoute(fromField, toNode, toField);
>>
>> ? That's only for routes?  What about events?
>>
>> John
>>
>>
>> On Thu, Oct 15, 2020 at 8:42 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>>
>>> Use the set_xfield functions on field_changed (xfield).
>>>>
>>>>
>>>> Not implemented.  Is this new code?   Where would I put it under
>>>> Scripting/?   Can you provide a short example?
>>>>
>>>>>
>>>>> Post messages for all _changed fields as given in the field def.
>>>>> Somehow deal with SFNode fields.
>>>>
>>>>
>>>>>
>>> There is sample code under Script.js:
>>>
>>> https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/Script.js#L346
>>>
>>> Below:
>>> ====================================================================
>>>         doRoute(mypackage, fromNode, fromField, toNode, toField, log,
>>> set, changed, selector, url) {
>>>                 var fromScript = mypackage.find(fromNode);
>>>                 var toScript = mypackage.find(toNode);
>>>                 // only add routes with scripts involved
>>>                 if (typeof fromScript !== 'undefined' || typeof toScript
>>> !== 'undefined') {
>>>                         var from =
>>> this.nodeUtil(selector)+fromNode+"','"+fromField+"')";
>>>                         if (typeof fromScript !== 'undefined') {
>>>                                 from = 'typeof '+this.useX3DJSON('Obj',
>>> selector, url, fromScript.name)+'.'+fromField+changed+' === "function" ?
>>> '+this.useX3DJSON('Obj', selector, url, fromScript.name) +
>>> '.'+fromField+changed+'() : '+this.useX3DJSON('Obj', selector, url,
>>> fromScript.name) + '.'+fromField;
>>>                         }
>>>                         var to =
>>>  this.nodeUtil(selector)+toNode+"','"+toField+"',";
>>>                         if (typeof toScript !== 'undefined') {
>>>                                 to = this.useX3DJSON('Obj', selector,
>>> url, toScript.name) + '.'+set+toField+'(';
>>>                         }
>>>                         if (typeof fromScript !== 'undefined' && typeof
>>> toScript !== 'undefined') {
>>>                                 log.log("               if
>>> ("+this.useX3DJSON('Obj', selector, url, toScript.name)+" && "+from+") {");
>>>                         }
>>>                         log.log("                       "+to+from+",
>>> __eventTime);");
>>>                         if (typeof fromScript !== 'undefined' && typeof
>>> toScript !== 'undefined') {
>>>                                 log.log("               }");
>>>                         }
>>>                 }
>>>         }
>>>
>>>  ====================================================================
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20201015/4803b03e/attachment-0001.html>


More information about the x3d-public mailing list