Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368421 - Protocol: Abandon executeScript operation type
Summary: Protocol: Abandon executeScript operation type
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.5 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-12 03:58 EST by Ralf Sternberg CLA
Modified: 2012-01-17 05:00 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Sternberg CLA 2012-01-12 03:58:34 EST
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.
Comment 1 Ivan Furnadjiev CLA 2012-01-12 04:08:41 EST
+1 I had this in my mind once too.
Comment 2 Holger Staudacher CLA 2012-01-12 04:18:57 EST
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.
Comment 3 Holger Staudacher CLA 2012-01-12 04:20:35 EST
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.
Comment 4 Ralf Sternberg CLA 2012-01-12 04:33:20 EST
(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.
Comment 5 Ivan Furnadjiev CLA 2012-01-17 05:00:45 EST
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.