gngr icon indicating copy to clipboard operation
gngr copied to clipboard

Is AbstractScriptableDelegate really required?

Open hrj opened this issue 10 years ago • 0 comments

The idea behind the script delegate seems to be this:

If a Java object is returned from a DOM API and then manipulated in JS, then the manipulations should persist even if the reference to the JS object is GCed.

For example:

 <body>
   <div id="target" />

   <script>
   window.onload = function() {
     document.getElementById("target").myProperty = "xyz";
   }
   </script>
   <script>
     setInterval(function() {
       console.log(document.getElementById("target").myProperty);
     }, 2000);
   </script>

 </body> 

Questions:

  1. Is this mandated by specification?
  2. In gngr, even if NodeImpl and Window don't extend AbstractScriptableDelegate, the above code seems to work fine. (Haven't ensured that GC has been run).

hrj avatar Aug 03 '15 06:08 hrj