Firebug 1.2 will require users of the 'console' object, as in
console.log() etc, to issue
loadFirebugConsole()
before the first use of the 'console' object. Since you are going to
hate this anyway, what do you think about also changing the name of
the 'console' object, eg 'fbConsole' or firebug.console or other ways
to reduce potential collisions?
On Thu, Apr 3, 2008 at 1:03 AM, John J Barton <johnjbar...@johnjbarton.com> wrote:
> Firebug 1.2 will require users of the 'console' object, as in > console.log() etc, to issue > loadFirebugConsole() > before the first use of the 'console' object. Since you are going to > hate this anyway, what do you think about also changing the name of > the 'console' object, eg 'fbConsole' or firebug.console or other ways > to reduce potential collisions?
I definitely like the idea of having single namespace with all
Firebug's services attached. Even if this breaks backward
compatibility I would do it rather sooner than later (I think
it's actually a must).
I don't have strong opinion on this, but I would prefer "firebug" as
the name so, e.g. firebug.console
Honza
On Apr 2, 7:03 pm, John J Barton <johnjbar...@johnjbarton.com> wrote:
> Firebug 1.2 will require users of the 'console' object, as in
> console.log() etc, to issue
> loadFirebugConsole()
> before the first use of the 'console' object. Since you are going to
> hate this anyway, what do you think about also changing the name of
> the 'console' object, eg 'fbConsole' or firebug.console or other ways
> to reduce potential collisions?
I think that if this is going to be done I'd prefer "firebug", "fireBug" or "Firebug" to be the namespace, preferably the first one. Why does loadFirebugConsole() need to be called? Couldn't you do something like:
Adding a namespace is one thing, requiring another call is another. One of the great things about firebug is that I can just type "console.log" anywhere :-)
As for the bug that was filed, arguing that Safari has its own console object is just rediculous. Firebug is a firefox-specific extension and any calls to firebug in code NEED to be removed before the code is made live. The argument boils down to "Well I need to remove console for IE, Opera and any other browser, but I don't want to remove it for safari"...???
I wonder how many people, besides myself, are going to be forced to write:
> Firebug 1.2 will require users of the 'console' object, as in > console.log() etc, to issue > loadFirebugConsole() > before the first use of the 'console' object. Since you are going to > hate this anyway, what do you think about also changing the name of > the 'console' object, eg 'fbConsole' or firebug.console or other ways > to reduce potential collisions?
On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> I think that if this is going to be done I'd prefer "firebug", "fireBug" or
> "Firebug" to be the namespace, preferably the first one. Why does
> loadFirebugConsole() need to be called? Couldn't you do something like:
The line
firebug.console = firebug._console;
will cause infinite recursion, calling your function again (assuming
you meant to define a getter rather than a function).
On Apr 2, 11:49 am, John J Barton <johnjbar...@johnjbarton.com> wrote:
> On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> > I think that if this is going to be done I'd prefer "firebug", "fireBug" or
> > "Firebug" to be the namespace, preferably the first one. Why does
> > loadFirebugConsole() need to be called? Couldn't you do something like:
> The line
> firebug.console = firebug._console;
> will cause infinite recursion, calling your function again (assuming
> you meant to define a getter rather than a function).
> On Apr 2, 11:49 am, John J Barton <johnjbar...@johnjbarton.com> wrote: > > On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> > > I think that if this is going to be done I'd prefer "firebug", > "fireBug" or > > > "Firebug" to be the namespace, preferably the first one. Why does > > > loadFirebugConsole() need to be called? Couldn't you do something > like:
> Sorry I should say...I tried that so I know that: > > The line > > firebug.console = firebug._console; > > will cause infinite recursion, calling your function again (assuming > > you meant to define a getter rather than a function).
Yes, but you can't add the script to the page because you can't get
control after the document is valid but before any javascript (which
could use the console) can run. For example, if the first tag in the
page is <script> console.log('ff'): ...
You can eval an object or function, but the environment will be
evalInSandbox, so you won't have the same Javascript world as the
page. So you can't load the whole console, just a loader to do it
later.
So that leaves you with needing a function call to trigger the "do it
later" bit.
It could be "loadFirebugConsole()" as I propose. Or it could be
window.console using a getter method. I guess it could be
firebug.__defineGetter__("console", function() {
}
On Apr 2, 12:44 pm, "Mark Kahn" <cwol...@gmail.com> wrote:
> firebug._console = {
> log: function(){
> alert('real console.log called with '+arguments.length+' arguments:
> 1:'+arguments[0]);
> }
> };
> firebug.console.log('this is a test');
> </script>
> -Mark
> On Wed, Apr 2, 2008 at 12:12 PM, John J Barton <johnjbar...@johnjbarton.com>
> wrote:
> > On Apr 2, 11:49 am, John J Barton <johnjbar...@johnjbarton.com> wrote:
> > > On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> > > > I think that if this is going to be done I'd prefer "firebug",
> > "fireBug" or
> > > > "Firebug" to be the namespace, preferably the first one. Why does
> > > > loadFirebugConsole() need to be called? Couldn't you do something
> > like:
> > Sorry I should say...I tried that so I know that:
> > > The line
> > > firebug.console = firebug._console;
> > > will cause infinite recursion, calling your function again (assuming
> > > you meant to define a getter rather than a function).
> Yes, but you can't add the script to the page because you can't get > control after the document is valid but before any javascript (which > could use the console) can run. For example, if the first tag in the > page is <script> console.log('ff'): ...
> You can eval an object or function, but the environment will be > evalInSandbox, so you won't have the same Javascript world as the > page. So you can't load the whole console, just a loader to do it > later.
> So that leaves you with needing a function call to trigger the "do it > later" bit.
> It could be "loadFirebugConsole()" as I propose. Or it could be > window.console using a getter method. I guess it could be > firebug.__defineGetter__("console", function() {
> }
> On Apr 2, 12:44 pm, "Mark Kahn" <cwol...@gmail.com> wrote: > > Unless running it via a plugin changes the functionality:
> > <script> > > function loadFirebugConsole(){ > > alert('loadFirebugConsole'); > > // do stuff here
> > firebug.console.log('this is a test'); > > </script>
> > -Mark
> > On Wed, Apr 2, 2008 at 12:12 PM, John J Barton < > johnjbar...@johnjbarton.com> > > wrote:
> > > On Apr 2, 11:49 am, John J Barton <johnjbar...@johnjbarton.com> wrote: > > > > On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> > > > > I think that if this is going to be done I'd prefer "firebug", > > > "fireBug" or > > > > > "Firebug" to be the namespace, preferably the first one. Why does > > > > > loadFirebugConsole() need to be called? Couldn't you do something > > > like:
> > > Sorry I should say...I tried that so I know that: > > > > The line > > > > firebug.console = firebug._console; > > > > will cause infinite recursion, calling your function again (assuming > > > > you meant to define a getter rather than a function).
> Yes, but you can't add the script to the page because you can't get
> control after the document is valid but before any javascript (which
> could use the console) can run. For example, if the first tag in the
> page is <script> console.log('ff'): ...
> You can eval an object or function, but the environment will be
> evalInSandbox, so you won't have the same Javascript world as the
> page. So you can't load the whole console, just a loader to do it
> later.
> So that leaves you with needing a function call to trigger the "do it
> later" bit.
> It could be "loadFirebugConsole()" as I propose. Or it could be
> window.console using a getter method. I guess it could be
> firebug.__defineGetter__("console", function() {
if (firebug._console) return firebug._console;
firebug._console = loadFirebugConsole();
> I guess I'm confused as to why the loadFirebugConsole function is suddenly
> needed when it never has been before?
> -Mark
> On Wed, Apr 2, 2008 at 1:11 PM, John J Barton <johnjbar...@johnjbarton.com>
> wrote:
> > Yes, but you can't add the script to the page because you can't get
> > control after the document is valid but before any javascript (which
> > could use the console) can run. For example, if the first tag in the
> > page is <script> console.log('ff'): ...
> > You can eval an object or function, but the environment will be
> > evalInSandbox, so you won't have the same Javascript world as the
> > page. So you can't load the whole console, just a loader to do it
> > later.
> > So that leaves you with needing a function call to trigger the "do it
> > later" bit.
> > It could be "loadFirebugConsole()" as I propose. Or it could be
> > window.console using a getter method. I guess it could be
> > firebug.__defineGetter__("console", function() {
> > }
> > On Apr 2, 12:44 pm, "Mark Kahn" <cwol...@gmail.com> wrote:
> > > Unless running it via a plugin changes the functionality:
> > > <script>
> > > function loadFirebugConsole(){
> > > alert('loadFirebugConsole');
> > > // do stuff here
> > > firebug.console.log('this is a test');
> > > </script>
> > > -Mark
> > > On Wed, Apr 2, 2008 at 12:12 PM, John J Barton <
> > johnjbar...@johnjbarton.com>
> > > wrote:
> > > > On Apr 2, 11:49 am, John J Barton <johnjbar...@johnjbarton.com> wrote:
> > > > > On Apr 2, 10:45 am, "Mark Kahn" <cwol...@gmail.com> wrote:
> > > > > > I think that if this is going to be done I'd prefer "firebug",
> > > > "fireBug" or
> > > > > > "Firebug" to be the namespace, preferably the first one. Why does
> > > > > > loadFirebugConsole() need to be called? Couldn't you do something
> > > > like:
> > > > Sorry I should say...I tried that so I know that:
> > > > > The line
> > > > > firebug.console = firebug._console;
> > > > > will cause infinite recursion, calling your function again (assuming
> > > > > you meant to define a getter rather than a function).