Nevow.Athena.PageWidget - events not caught in IE
Hi, I'm using Nevow 0.9.31. Have been struggling with catching the onbeforeunload event for a couple of days. From the JS code in Athena/__init__.js, it looks like the events 'onkeypress' and 'onbeforeunload' are handled pretty automatically; and by adding alerts to their methods, I can verify that both are caught fine on Firefox. However, on Internet Explorer - v 6.0.2800 on W2000, and 7.0.6000 on Vista - neither of these 2 events is trapped. Does anybody know whether this is a known problem with Athena on IE? (A further observation - the Athena test files TestInit.js and TestWidget.js both appear to have tests for onbeforeunload. Now, when I do 'nit --port=9876 nevow' and press "Run Tests" in the browser, these files do not seem to run. I don't understand too much of the interactive unit tests yet, but I get a feeling that file livetest_athena.py would need to have a line like "jsClass = u'Nevow.Test.." for these 2 files to be found and executed, and it doesn't.) Getting an answer to this would really save some time. If not, I'll go on digging throught the sources - it's been educational so far :-) Regards, Harald
On Tue, 29 Apr 2008 12:39:16 +0200, Harald Blåtand
Hi,
I'm using Nevow 0.9.31. Have been struggling with catching the onbeforeunload event for a couple of days. From the JS code in Athena/__init__.js, it looks like the events 'onkeypress' and 'onbeforeunload' are handled pretty automatically; and by adding alerts to their methods, I can verify that both are caught fine on Firefox.
However, on Internet Explorer - v 6.0.2800 on W2000, and 7.0.6000 on Vista - neither of these 2 events is trapped. Does anybody know whether this is a known problem with Athena on IE?
I'm not sure what might be going on here. I can tell you that I've never tested Athena on either of those platforms, though.
(A further observation - the Athena test files TestInit.js and TestWidget.js both appear to have tests for onbeforeunload. Now, when I do 'nit --port=9876 nevow' and press "Run Tests" in the browser, these files do not seem to run. I don't understand too much of the interactive unit tests yet, but I get a feeling that file livetest_athena.py would need to have a line like "jsClass = u'Nevow.Test.." for these 2 files to be found and executed, and it doesn't.)
When I run `nit nevow´ and click the `Run Tests´ button, I see 59 tests run and succeed. This using Firefox 1.5 on Ubuntu 6.06. You might be confusing nits with JavaScript unit tests. nits are defined by livetest_*.py files and whatever JavaScript the `jsClass´ attributes in them point to. Much (perhaps not, there's a bit of mixing) of the code in the Nevow.Test JavaScript package (defined by Nevow/nevow/js/Nevow/Test/) is for JavaScript unit tests. These are run using the stand-alone spider- monkey interpreter; they don't run in a browser. Nevow/nevow/js/Nevow/Athena/Tests/__init__.js has most of the code for the Nevow nits. Jean-Paul
On Tue, Apr 29, 2008 at 1:04 PM, Jean-Paul Calderone
On Tue, 29 Apr 2008 12:39:16 +0200, Harald Blåtand
wrote: Hi,
I'm using Nevow 0.9.31. Have been struggling with catching the onbeforeunload event for a couple of days. From the JS code in Athena/__init__.js, it looks like the events 'onkeypress' and 'onbeforeunload' are handled pretty automatically; and by adding alerts to their methods, I can verify that both are caught fine on Firefox.
However, on Internet Explorer - v 6.0.2800 on W2000, and 7.0.6000 on Vista - neither of these 2 events is trapped. Does anybody know whether this is a known problem with Athena on IE?
I'm not sure what might be going on here. I can tell you that I've never tested Athena on either of those platforms, though.
(A further observation - the Athena test files TestInit.js and
TestWidget.js both appear to have tests for onbeforeunload. Now, when I do 'nit --port=9876 nevow' and press "Run Tests" in the browser, these files do not seem to run. I don't understand too much of the interactive unit tests yet, but I get a feeling that file livetest_athena.py would need to have a line like "jsClass = u'Nevow.Test.." for these 2 files to be found and executed, and it doesn't.)
When I run `nit nevow´ and click the `Run Tests´ button, I see 59 tests run and succeed. This using Firefox 1.5 on Ubuntu 6.06.
You might be confusing nits with JavaScript unit tests. nits are defined by livetest_*.py files and whatever JavaScript the `jsClass´ attributes in them point to. Much (perhaps not, there's a bit of mixing) of the code in the Nevow.Test JavaScript package (defined by Nevow/nevow/js/Nevow/Test/) is for JavaScript unit tests. These are run using the stand-alone spider- monkey interpreter; they don't run in a browser.
Nevow/nevow/js/Nevow/Athena/Tests/__init__.js has most of the code for the Nevow nits.
Thanks for your reply Jean-Paul, Yep, on Firefox I too see 59 tests succeed. With IE on Vista, 58. (Although I don't _think_ it's to do with the current problem - Nevow.Athena.Tests.DynamicWidgetInstantiation.test_nonXHTMLWidgetReturn Failed to discover node with id value athena:52 beneath [object] (programmer error). undefined Nevow.Athena.Tests.DynamicWidgetInstantiation.test_invalidRemoveChildWidget (not sure which one of the tests the err msg relates to) .) Unfortunately, our Corporate Standard is IE, and we're going from W2000 to Vista for 70K users soon :-( Anyway - might IE's failure with 'onbeforeunload' explain why I'm having trouble refreshing an Athena page? (Because the server doesn't get any sendCloseMessage() ?) Hmm.. we can't be alone in the world using IE, or M$ wouldn't be so big... :-) Regards, Harald
* Harald Blåtand
Anyway - might IE's failure with 'onbeforeunload' explain why I'm having trouble refreshing an Athena page? (Because the server doesn't get any sendCloseMessage() ?)
Hmm.. we can't be alone in the world using IE, or M$ wouldn't be so big... :-)
There is definitely a regression in Athena on IE (both 6 and 7) regarding on{before,}unload; I thought this had something to do with the change from onunload to onbeforeunload, but switching that back didn't seem to help when I tried it. I'm currently running in production with r14017 reverted; unfortunately this changeset is an extremely large Athena refactoring, and I haven't had the time to investigate further to narrow this down. The net result of this problem is that the Athena transport connection isn't closed immediately on navigating away from a page, but instead will hang around until the server timeout, which has a default value of about 5 minutes, if I'm not mistaken. Thus, anyone trying to navigate around an Athena-based site in IE will quickly find that they run into the connection limit, and trying to navigate to new links just seems to "hang" as the browser waits for a connection slot to free up. I don't know anything about the onkeypress issue, it may or may not be related. -- mithrandi, i Ainil en-Balandor, a faer Ambar
On 4/29/08, Tristan Seligmann
There is definitely a regression in Athena on IE (both 6 and 7) regarding on{before,}unload;
Tristan, This is _not_ a yell for help; it's more like I'm thinking(?) aloud.. Just thought that since we have IE all over the place, and we can't have an app that freezes if a user refreshes it, I might make a feeble attempt... By - reading up on event handling in IE vs FF (ain't M$ cute! :] ) - trying to understand your code (I'm learning a lot (compliment!)) As far as I understand things, it's at least partly related to IE's vs FF's different meaning of "this" when a window event fires. Haven't got too far yet, but before rambling on - a question: Is there any use that I fiddle on with this, or have you already fixed it?? Best regards, Harald
* Harald Blåtand
Just thought that since we have IE all over the place, and we can't have an app that freezes if a user refreshes it, I might make a feeble attempt... By
Indeed, I'm in the same position with my own application: our userbase is currently 100% IE-using, with the exception of us developers ;)
Is there any use that I fiddle on with this, or have you already fixed it??
I haven't yet had the chance to track this down, so by all means, go ahead :) (my production deployment currently has the particular revision I mentioned reverted so that our users aren't crippled) -- mithrandi, i Ainil en-Balandor, a faer Ambar
Just a thought: We ran into problems with Athena and the releases from nevow after SVN 13786 (was a major upgrade) and IE due to the following policy MS introduced: IE seems to limit the connections allowed to 2max, which blocks IE when for instance running the Athena calculator sample and doing a page refresh or two. It seems that tearing down athena and bringing it up again may in some cases 'hang' IE (socket states is TIME_WAIT) for around 120 secs. The same happens when going from one livepage to another. I am writing this on a hunch and from memory, apologies if the problems are not related. If they are, I am glad to help digging :-) Our solution for this particular problem was to hang back on SVN rev 13786 for nevow until fixed. Server runs ok with several hundred LivePages connected. HTH, Werner Tristan Seligmann wrote:
* Harald Blåtand
[2008-05-07 12:24:18 +0200]: Just thought that since we have IE all over the place, and we can't have an app that freezes if a user refreshes it, I might make a feeble attempt... By
Indeed, I'm in the same position with my own application: our userbase is currently 100% IE-using, with the exception of us developers ;)
Is there any use that I fiddle on with this, or have you already fixed it??
I haven't yet had the chance to track this down, so by all means, go ahead :) (my production deployment currently has the particular revision I mentioned reverted so that our users aren't crippled)
------------------------------------------------------------------------
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
On Wed, May 7, 2008 at 6:23 PM, Werner Thie
Just a thought:
We ran into problems with Athena and the releases from nevow after SVN 13786 (was a major upgrade) and IE due to the following policy MS introduced: IE seems to limit the connections allowed to 2max, which blocks IE when for instance running the Athena calculator sample and doing a page refresh or two.
Hmm, not sure we can blame M$ for that. Think I saw somewhere that some standard talks about _2_ connections, only some browsers improve it a bit...
It seems that tearing down athena and bringing it up again may in some cases 'hang' IE (socket states is TIME_WAIT) for around 120 secs. The same happens when going from one livepage to another.
I am writing this on a hunch and from memory, apologies if the problems are not related.
I think they probably are, because of different event handling in IE vs FF.
Our solution for this particular problem was to hang back on SVN rev 13786 for nevow until fixed. Server runs ok with several hundred LivePages connected.
Good to hear it scales well. Wouldn't expect anything else from Twisted, but we're pretty much Nevow rookies here ... Regards, Harald
Hi Harald Harald Blåtand wrote:
On Wed, May 7, 2008 at 6:23 PM, Werner Thie
wrote: Just a thought:
We ran into problems with Athena and the releases from nevow after SVN 13786 (was a major upgrade) and IE due to the following policy MS introduced: IE seems to limit the connections allowed to 2max, which blocks IE when for instance running the Athena calculator sample and doing a page refresh or two.
Hmm, not sure we can blame M$ for that. Think I saw somewhere that some standard talks about _2_ connections, only some browsers improve it a bit...
Just get me right, I'm not blaming MS, but the behavior of IE is erratic in this particular case. The whole Athena/IE system is also working logically correct, but the user experience is more than disturbed by the seemingly dead IE which springs into action after two minutes or so. IE introduces a hard limit of two connections, whereas FF implements two open sockets and ignores sockets which are in TIME_WAIT, waiting to be teared down completely. AFAIK there is no solution to this problem, because closing a socket brings it into the TIME_WAIT state http://www.developerweb.net/forum/showthread.php?t=2941 and what is left is up to the interpretation of the RFC by the implementor of the browsers TCP/IP code. The easiest way to illustrate this problem is to run examples.tac and go to the calculator (example is broken, I proposed a fix on divmod dev mailing list) Line 27 in calculator.html from getElement('output').innerHTML = expression; to document.getElementById('output').innerHTML = expression; Hit the example/calculator with IE and refresh the page... You will be greeted by a IE which shows the watch cursor and does not refresh the page until the TIME_WAIT time (usually 120 secs) for the socket over. HTH, Werner PS: If you want to have a look my athena site implementing a popular card game in Switzerland called 'Jass' then hit http://www.jass.sf.tv/?uid=gast
On Wed, May 7, 2008 at 12:49 PM, Tristan Seligmann
* Harald Blåtand
[2008-05-07 12:24:18 +0200]: Just thought that since we have IE all over the place, and we can't have an app that freezes if a user refreshes it, I might make a feeble attempt... By
Indeed, I'm in the same position with my own application: our userbase is currently 100% IE-using, with the exception of us developers ;)
I may have something now that keeps IE from hanging on a page refresh. Here's what I've changed in the 0.9.31 JS code: ------------------ Nevow/Athena/__init__.js (2 additions) -------------------------- Nevow.Athena.Widget._initialize = function() { Divmod.debug("widget", "Instantiating live widgets"); Nevow.Athena.Widget._pageLoaded = true; // With the next line, sendCloseMessage will get called in IE. // Harald Divmod.Base.addUnLoadEvent(Nevow.Athena.page.deliveryChannel); // Harald Nevow.Athena.Widget._instantiateWidgets(); Divmod.debug("widget", "Finished instantiating live widgets"); }; Nevow.Athena.bootstrap = function (pageClassName, clientID) { var self = this; var pageClass = Divmod.namedAny(pageClassName); self.page = pageClass(clientID, Nevow.Athena._createMessageDelivery); Nevow.Athena.page = self.page; // Harald self.page.bindEvents(window); ..... ------------------ Divmod/Base.js (1 added function at the end) -------------------------- Divmod.Base.addUnLoadEvent = function(channel) { /*** Harald's desperate try to get IE page refresh to work... ***/ window.attachEvent("onunload", function (e) {channel.sendCloseMessage();}); }; Divmod.Base.jsonRegistry = Divmod.Base.AdapterRegistry(); I'm not used to this coding style, so it's a bit of trial & error. Anyway, before, sendCloseMessage would _not_ be called; now it is, and I can refresh ad lib on IE 6.and 7. Not sure either what this will do to FF. (Since we're stuck with IE, I'm heavily abusing its non-standard extras, so I can't get my full app to run on FF.) Besides, you're better on FF than I am :-) Finally, to fix the onkeypress issue, I think we'd need to go deeper into the "this" dept. For me, the refresh is more important - if the users insist on pressing ESC, they can blame themselves.. ;-) What do you think? Regards, Harald
On Wed, May 7, 2008 at 12:49 PM, Tristan Seligmann
I haven't yet had the chance to track this down, so by all means, go
Tristan, Just a minor cosmetic touch to my previous fix. Shouldn't make any visible difference, but makes the code look slightly less IE-centric. ------------------ Nevow/Athena/__init__.js (2 additions) -------------------------- Nevow.Athena.Widget._initialize = function() { Divmod.debug("widget", "Instantiating live widgets"); Nevow.Athena.Widget._pageLoaded = true; // With the next line, sendCloseMessage will get called in IE. // Harald Divmod.Base.addUnLoadEvent(Nevow.Athena.page.deliveryChannel); // Harald Nevow.Athena.Widget._instantiateWidgets(); Divmod.debug("widget", "Finished instantiating live widgets"); }; Nevow.Athena.bootstrap = function (pageClassName, clientID) { var self = this; var pageClass = Divmod.namedAny(pageClassName); self.page = pageClass(clientID, Nevow.Athena._createMessageDelivery); Nevow.Athena.page = self.page; // Harald self.page.bindEvents(window); ..... ------------------ Divmod/Base.js (1 added function at the end) -------------------------- Divmod.Base.addUnLoadEvent = function(channel) { /*** Harald's desperate try to get IE page refresh to work... ***/ if (window.attachEvent) window.attachEvent("onunload", function (e) {channel.sendCloseMessage();}); }; Divmod.Base.jsonRegistry = Divmod.Base.AdapterRegistry(); Have you had a chance to try it? Harald
participants (4)
-
Harald Blåtand
-
Jean-Paul Calderone
-
Tristan Seligmann
-
Werner Thie