How to make dump() unbuffered?
BSZ Tim <[email protected]> Mon, 17 May 2010 15:35:26 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
In short: Is window.dump() 's output buffered? If so, is there an easy way to avoid this buffering? The longer version, in case you want to ask "why would you do this" or recommend a better way to approach the problem: I access through Firefox a webpage that communicates with its server via AJAX: it receives some update messages every few seconds. I want to (1) log these messages, and (2) on receiving some particular messages, take an action outside FF. Given that my knowledge on javascript and mozilla architecture is rather minimal, I went the following way about this: using Greasemonkey I hijacked the 'processMessages' function in the page's javascript source. The new version simply does a dump() on each message and then calls the old version, so the updates from the messages are rendered. The console output is finally piped to a perl script (where I am on a much firmer ground), which in turn does all the logging and calling external programs. This almost works, with the only problem being that my perl script, rather than recieving the messages one-by-one, once every few seconds, gets a batch of them every minute or so. It seems that someone is buffering on the way and I suspect dump(). Or is it the OS (Windows XP) console? How can this buffering be disabled so the received messages are passed to the perl script without delay? Thanks, BSZ