base2-dom slow to load in Firefox - firebug + javascript.options.strict = true are the culprits

9 views
Skip to first unread message

Alex Robinson

unread,
Aug 26, 2007, 1:56:56 PM8/26/07
to base...@googlegroups.com
Short version
-------------

Problem:
The current version of Base2 (timestamp: Fri, 10 Aug 2007 20:00:50)
will load extremely slowly in Firefox if you have Firebug enabled and
the preference javascript.options.strict set to true.

Solution:
Set javascript.options.strict to false


Long version
------------

I just started using the latest version of Base2 in subversion. And
it's taking 35 seconds plus just to load the Dom part of Base2.

In Firefox (2.0.0.6) with Firebug (1.05) enabled and the preference
javascript.options.strict set to true, that is. Disable Firebug or
set the strict pref to false and it loads up ok, ( ~600ms vs
~36000ms). (All other browsers obviously are unaffected)

To reproduce the problem, toggle the javascript.options.strict
preference and visit the following pages.

Loading Base2 locally
http://www.fu2k.org/alex/javascript/javascriptjunk/base2load

and externally from Google repository (just to check not a local
glitch on my part)
http://www.fu2k.org/alex/javascript/javascriptjunk/base2loadexternal

gives pretty much the same results:
http://www.fu2k.org/alex/javascript/javascriptjunk/base2loadprofile

(just to be clear, the slow loading is happening when the profiling is off)


On the other hand, using a previous version of Base2 loads just fine
and snappy, even if strict mode is on.

http://www.fu2k.org/alex/javascript/javascriptjunk/base2load-jul07
// timestamp: Tue, 03 Jul 2007 20:32:36

You can see why it takes longer if you compare the console output
from the current and the old versions.
http://www.fu2k.org/alex/javascript/javascriptjunk/base2load-warnings
http://www.fu2k.org/alex/javascript/javascriptjunk/base2load-jul07-warnings


Patching base2.js as suggested below...

999c999
< if (object.extend == extend && /^(base|extend)$/.test(key)) {
---
> if (object.extend && object.extend == extend &&
>/^(base|extend)$/.test(key)) {
1051c1051
< while (fn && fn.ancestor != ancestor) fn = fn.ancestor;
---
> while (fn && (!fn.ancestor || fn.ancestor != ancestor)) fn =
>fn.ancestor ? fn.ancestor : undefined;

http://www.fu2k.org/alex/javascript/javascriptjunk/base2load-patched

... makes the glacial speed issues go away, but seeing as my
javascript foo is not so great, I assume that breaks stuff left,
right and centre. It certainly opens up a new wave of warnings from
functions not always returning a value and hiding of arguments and
this:

Warning: reference to undefined property Native.prototype[name]
Source File: http://www.fu2k.org/alex/javascript/base2/base2-patched.js
Line: 959

--> INative[name] = unbind(Native.prototype[name]);


Not knowing what the project's position is on strictness, and given
my foo, it seems a good point at which to stop my amateur sleuthing,
though I hope it has been of some help.

In the meantime, the trivial solution is just to make sure that
javascript.option.strict is set to false. Or alternatively use
Console2 to filter the error console messages


https://addons.mozilla.org/en-US/firefox/discussions/comments.php?DiscussionID=21

Alex Robinson

unread,
Aug 28, 2007, 12:25:01 PM8/28/07
to base2-js
> Solution:
> Set javascript.options.strict to false


Just to be painstakingly clear, I meant that is the short term
solution so that you can actually keep working until Dean fixes things
up. Not that you should set javascript.option.strict to false forever
and ever.

Dean Edwards

unread,
Aug 28, 2007, 1:13:49 PM8/28/07
to base...@googlegroups.com

I am fixing this in the base2 core as Alex mentioned:

http://dean.edwards.name/weblog/2007/08/firebug-slow/

-dean

Reply all
Reply to author
Forward
0 new messages