OpenLayers OpenLayers

Ticket #1594 (closed feature: fixed)

Opened 2 years ago

Last modified 1 year ago

FireBug detection

Reported by: openlayers Assigned to:
Priority: major Milestone: 2.7 Release
Component: general Version: 2.6
Keywords: Cc:
State: Complete

Description

In OpenLayers/Console.js detection of firebug isn't right.

After loading a page if 'console' or expression '4+4' written in FBug console I'll get error:

context.consoleHandler is undefined
chrome://firebug/content/commandLine.js
Line 78

FF 3.0, Firebug from svn firebug-1.2XJ.0b3 Code:

        var consoleHandler;
        for (var i=0; i<context.consoleHandler.length; i++) // here is the problem line
        {
            if (context.consoleHandler[i].window == win)
            {
                consoleHandler = context.consoleHandler[i].handler;
                break;
            }
        }

As a solution I added a return into Console.js:

(function() {
    /**
     * If Firebug Lite is included (before this script), re-route all
     * OpenLayers.Console calls to the console object.
     */
    return;
    if(window.console) {
        var scripts = document.getElementsByTagName("script");
        for(var i=0; i<scripts.length; ++i) {
            if(scripts[i].src.indexOf("firebug.js") != -1) {
                OpenLayers.Util.extend(OpenLayers.Console, console);
                break;
            }
        }
    }
})();

Now all works fine.

Attachments

console.patch (0.8 kB) - added by tschaub on 09/12/08 16:56:02.
don't break the console in ff3

Change History

07/28/08 10:09:56 changed by crschmidt

  • status changed from new to closed.
  • resolution set to invalid.

I can't reproduce this at all. I don't understand what this problem is. It doesn't seem to make sense to me.

09/12/08 16:55:18 changed by tschaub

  • status changed from closed to reopened.
  • resolution deleted.

I agree that we break the firebug console in FF3.

If I open any example from the trunk and type 'map' in the console, I get nothing (from FF3, Firebug 1.2, Mac).

I also think this is a big enough deal to make it in to 2.7. Without the attached patch, the firebug console is completely useless for me. Can anyone else confirm this?

09/12/08 16:56:02 changed by tschaub

  • attachment console.patch added.

don't break the console in ff3

09/12/08 16:56:23 changed by tschaub

  • state set to Review.

09/12/08 17:39:21 changed by crschmidt

>>> map
Object tileSize=w=256,h=256

Help me understand what I'm missing?

09/12/08 17:44:19 changed by euzuro

ditto

09/12/08 20:00:52 changed by euzuro

...ok, i'm un-dittoing my ditto. cr5 showed me how to make this [not] work.

if no one else does, i can review this patch next week.

09/16/08 12:10:01 changed by euzuro

  • state changed from Review to Commit.

with this patch in:

  • console test passes in ie7, ff2, ff3.
  • running examples/lite.html, i can use firebug

can't say i understand why you move the conditional to the inside of the loop, but hey... at this poing "works for me" is more than good enough.

thanks for tracking this down and fixing.

09/17/08 18:39:24 changed by tschaub

(In [8031]) We were breaking the firebug console in Firefox 3. This change makes things less efficient for browsers without Firebug (we loop through every script checking for firebug lite), but it fixes the console with OL and Firefox 3. If you open up the console in Firefox 3 and type 'window.console' you get an error about too much recursion (nothing to do with OL). So, we avoid touching window.console unless firebug lite has defined it. r=euzuro (see #1594)

09/17/08 18:40:13 changed by tschaub

  • state changed from Commit to Pullup.

09/19/08 11:44:44 changed by euzuro

  • keywords deleted.
  • status changed from reopened to closed.
  • state changed from Pullup to Complete.
  • resolution set to fixed.

(In [8038]) Bringing up patches from trunk to branch for RC3. -r8012:HEAD. (Closes #1594) (Closes #1730) (Closes #1735) (Closes #1738) (Closes #1740)