wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Log4js. 'log' called on an object that does not implement interface Console #148

Closed denisov closed 10 years ago

denisov commented 10 years ago

Threre is an issue with Log4js in pushstream.js. It appears in Firefox (30) with Firebug extension.

The LOG_LEVEL set to 'debug': PushStream.LOG_LEVEL = 'debug';

  1. Firefox browser is opened. Firebug is closed
  2. Open Firebug console
  3. Firefox receives a pushstream message
  4. Firebug reports an error

TypeError: 'log' called on an object that does not implement interface Console. Log4js.logger.apply(window.console, arguments);

I guess the reason is in saving window.console.log variable https://github.com/wandenberg/nginx-push-stream-module/blob/master/misc/js/pushstream.js#L160

When firebug is closed, the window.console.log contains kind of dummy. And when you call it via Log4js.logger.apply(window.console, arguments); you got an error.

I have made a simple test: The html page has

X = window.console;

I open Firefox browser with Firebug console closed, open this page, open Firebug and tried to execute X.log.apply(window.console, ['a']);, I got an error same as above. Second case: I open Firefox with Firebug OPENED, open test page and then tried to execute X.log.apply(window.console, ['a']);, and it works as expected