[Webkit-unassigned] [Bug 29336] WebInspector.log() function not protected if console not yet created

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 21 14:54:00 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=29336


Timothy Hatcher <timothy at hatcher.name> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #39848|review?                     |review-
               Flag|                            |




--- Comment #3 from Timothy Hatcher <timothy at hatcher.name>  2009-09-21 14:54:00 PDT ---
(From update of attachment 39848)

> +            var func = function() {WebInspector.log(null)};
> +            WebInspector.log.interval = setInterval(func, 1000);

> +    // ignore null messages, specifically the one sent by queued timer
> +    if (!message)
> +        return;

I am not sure passing "null" is the best way to check. What if I want to log
somthing and it happens to be undefined/null, I would like you know that. Just
make the check function do the "WebInspector.ConsoleMessage && this.console"
test and then replay the messages if that passes.

Also just pass the function inline to setInterval or give the variable a better
name than func. Put spaces inside the curly braces too.


> +        WebInspector.log.interval = null;

A better way to write this is:

delete WebInspector.log.interval;


> +        for (var i = 0; i < queued.length; ++i) {
> +            WebInspector.log(queued[i]);
> +        }

No need for the braces.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list