Community
Participate
Working Groups
Currently, the protocol supports 6 types of operations: create, set, listen, call, destroy, and executeScript. The latter is a misfit, as unlike all other operations, it doesn't have a target object. The fact that the execution of a script is not related to any target object suggests that this is not an equitable operation type, but should be better represented by a call operation on a dedicated script executor object. To give an example, I suggest to replace { "target": dontCareWhichOne, "action": "executeScript", "scriptType": "text/javascript", "content": "alert( 23 );" } with something like { "target": "jsex", "action": "call", "method": "execute", "properties": { "content": "alert( 23 );" } } with "jsex" being the target id of a script executor object that has been created before. This also leaves us more flexibility for future extensions of the script executor.
+1 I had this in my mind once too.
What about moving it one level higher? I mean we have a meta and a operations object/array on the first level of a protocol message. I think it would be ok to have another oen called "code" or "scrict" ... I thin you get the idea.
Of course, when the order matters and you want to execute operation, script, operation, script ... in this order moving the script a level higher is invalid.
(In reply to comment #3) > Of course, when the order matters and you want to execute operation, script, > operation, script ... in this order moving the script a level higher is > invalid. Yes, that would at least break the compatibility for code that still uses the JSWriter. But apart from that, I'm more and more convinced that the execution of script code is just a method of a remote object, no different than say, text size measurement. From this viewpoint, a protocol for object synchronization should provide a dedicated feature for this case.
executeScript operation has been removed. A dedicated JSExecutor object has been created on the client. As there is *no* current need for getting a client object for the script executor, ClientObjectFactory#getForJSExecutor in *not* introduced.