gngr
gngr copied to clipboard
Is AbstractScriptableDelegate really required?
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:
- Is this mandated by specification?
- In
gngr, even ifNodeImplandWindowdon't extendAbstractScriptableDelegate, the above code seems to work fine. (Haven't ensured that GC has been run).