Re: LiveConnect and (Re: func.apply() throws Error -2147467259)
Hi Jorge,
Thanks for the reply and taking the time to attempt a Java-free reproducer.
.. .
"Jorge" <jorge@jorgechamorro.com> wrote in message
news:c68468b5-3b99-44e6-9654-2a620f355683@e37g2000yqn.googlegroups.com...
****FROM HERE****
On Jan 30, 11:01 am, "Richard Maher" <maher...@hotspamnotmail.com>
wrote:
(...)
Removing the applet and the back-and-forth between Java-JS the
resulting java-less version seems to run fine:
http://jorgechamorro.com/cljs/095/
<script type="text/javascript">
function Tier3Client () {
(this.chan= {}).rendezvous= function () {
console.log("this.chan.rendezvous(), "+ (+new Date()));
};
this.chan.send= function (msgCandidate, msgBody, async) {
var r=
"31abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu
vwxyz";
if (async) {
setTimeout(function () {
console.log("this.chan.send(async===true)");
msgCandidate.dispatcher(r, 0, 0);
}, (2e3*Math.random())|0);
} else {
console.log("this.chan.send(async===false)");
msgCandidate.dispatcher(r, 0, 0);
}
};
this.chan.appendConsoleMsg= function (p) {
console.log("appendConsoleMsg: "+ p);
};
}
(Tier3Client.prototype = {}).send= function (msgBody, callback,
async) {
var chan = this.chan;
var callbackArgs = [];
var i = 0;
var msgCandidate = {
dispatcher : function (responseMsg, msgSlotId, msgSeqNum) {
callbackArgs[0] = responseMsg;
callback.apply(this, callbackArgs);
},
rendezvous : function () {
console.log("msgCandidate.rendezvous(), "+ (+new Date()));
return chan.rendezvous();
}
};
for (i=3; i<arguments.length; i++) {
callbackArgs[i - 2] = arguments[i];
}
return chan.send(msgCandidate, msgBody, async);
};
Tier3Client.prototype.appendConsoleMsg= function (msg) {
console.log("Tier3Client.prototype.appendConsoleMsg(), "+ (+new
Date()));
this.chan.appendConsoleMsg(msg);
};
</script>
--
Jorge.
****TO HERE****
Sadly, I'm not much further down the track (away last week) but I have
narrowed the offending line down to be in the Randomator.html file and the
positionDiv function in the EmpPicker object. Specifically it is where I
reset the innerHTML of the DIV to the new employee details: -
case "31" :
targetDiv.innerHTML =
'<table border="0" cellpadding="1px" '+
' align="center" id="empDetails"> '+
' <caption>Totally Random Employee</caption>'+
' <tr><td class="promptItem">Employee Id: </td>'
[and so on. . .]
'</table><br>';
break;
Before I start clutching at straws, and doing things like instantiating a
whole new DIV each time the timer expires, can anyone offer any
half-educated guesses here as to what might be causing the problem? Look, I
know it'd be a lot easier if I could show th JAVA code or at least a
web-link but I can't. On the useful side of the ledger though let me say
that the DOM-collision theory is backed-up by the failures appearing to
occur in pairs, i.e.: Mesages 19/20 failing followed later by 31/32.
To me it screams out "attempted multi-threaded manipulation of the DOM" but
all available evidence (inclusing anecdotal :-) says otherwise. They
are/should-be exclusive updates to distinct objects.
I believe there are some quite useful LiveConnect debugging/logging options
out there that someone told me about and I've subsequently forgotten. Can
anyone help me with that? (I've set the JAVA console to "5" but that didn't
up the verbosity much)
Is there a sleep(3) function in Javascript so that I can introduce the
same/similar delay to Jorge's JAVA-free t3client.send() method as I have
with my Applet<->Server version? IOW, setTimeout(myCallback,
somethingLessThanWhatImAbout to SleepFor)?
Cheers Richard Maher