Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SC.hasFirebug() bug?

    SC.hasFirebug() is returning true when Firebug is disabled.
    It seems to me that the SC.hasFirebug () method is named in a way that indicates whether Firebug is installed and not whether it is enabled.
    On the other hand, the documentation says it returns true if Firebug is enabled.

    I am using:
    SmartGWT: 2.5
    FireFox: 6.0.2
    Firebug: 1.8.4

    Original code:
    Code:
        /**
         * Return true if Firebug is enabled.
         *
         * @return true if firebug is enabled
         */
        public static native boolean hasFirebug() /*-{
    		 return $wnd.isc.Browser.isMoz && window.console != null && window.console.trace != null;
        }-*/;
    So I tried using this to get the Firebug version, and if it is != null, then Firebug is running and enabled...
    Code:
    public static native String getFirebugVersion () /*-{
        if (
          typeof $wnd.console !== 'undefined' &&
          typeof $wnd.console.firebug !== 'undefined') {
          return "" + $wnd.console.firebug;
        }
        else {
          return null;
        }
      }-*/;
    Notes:
    So I am using this to get the firebug version.
    The first 'undefined' check is needed because otherwise the "$wnd.console.firebug" check fails in IE.
    I had to concat the firebug version to "" otherwise I would get a JS error that the returned object is not a String.

    So I am looking for comments on this.
    Is it right, is it wrong, or is there something else I am missing here?
    Last edited by shortpasta; 7 Nov 2011, 14:07.
Working...
X