Memory leak and corrupted bookmarks due to javascript bookmarklets

VERIFIED DUPLICATE of bug 54866

Status

SeaMonkey
Bookmarks & History
--
critical
VERIFIED DUPLICATE of bug 54866
17 years ago
13 years ago

People

(Reporter: Koranteng Ofosu-Amaah, Assigned: Ben Goodger (use ben at mozilla dot org for email))

Tracking

Trunk
x86
Windows ME

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

17 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; 0.8) Gecko/20010215
BuildID:    2001021508

11 KB bookmarks file grows to 32 MB as memory leaks and garbage data is inserted
in a javascript bookmark url.

Reproducible: Always
Steps to Reproduce:
Memory leak and corrupted bookmarks due to javascript bookmarklets.

I have 3 javascript bookmarklets that I used to debug the DOM of a given page in
various browsers. They are part of the attached bookmarks file. (the relevant
bookmarks are in the HTML/Javascript - Tutorial/Tools folder and labeled DOM -
Nav 4, DOM - Nav 6, DOM - IE 5)

1. Import the bookmarks into Mozilla (For me this was done automatically at
install when my Netscape 4 profile was converted). Alternatively, install
Mozilla and import the attached bookmark file. Add the bookmarks button to the
toolbar.
2. Navigate to any site, Select Bookmarks - Add current page
3. Select bookmarks - Manage bookmarks
4. Create and name a new folder underneath the HTML/Javascript folder.
5. Drag the newly created bookmark to the new folder
6. Expand the HTML/Javascript folder
7. Expand the Tutorial/Tools folder (the browser begins to slow to a crawl)
8. If you wait patiently, you might be able to collapse the Tutorial/Tools folder
9. If you aren't completely hung, close the Manage Bookmarks dialog and close
Mozilla

Open the mozilla bookmarks file C:\WINDOWS\Application
Data\Mozilla\Users50\username\blah-blah\bookmarks.html (or equivalent on your
operating system)

The original 11 KB bookmark file has grown to sometimes as much as 32 MB as
garbage data is inserted in the middle of of one of the javascript bookmarks.
Sometimes it is the "DOM Nav 6" bookmark, other times it is the "DOM - IE 5"
bookmark. There seems to be a huge buffer overrun which would account for the
slowdown of the browser. The more things you do with bookmarks, the more garbage
data seems to be written to the bookmark. 

Sample of the corrupted bookmark text: (notice the garbage characters at the end)

<span id='+n.replace(/[\.\[\]]/g,'_')+'><a
href=javascript:opener.k7J2(\''+n+'\')>'+(n+'').replace(/</g,'<')+'</a>='+v+'</span>'
}}catch(e){Y7J2=n+'=[ERROR]'}i7J2='';if((''+n).match(/[\.\[]/g));
for(varj=0;j<(''+n).match(/[\.\[]/g).length;j++)i7J2+='Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?
Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?
Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã
?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?Ã?Â?

.... etc ... 

I have been able to reproduce this on 5 different machines with different
operating systems (Windows 95, Windows 98, Windows ME, Windows 2000, Windows NT
4.0) with Mozilla 0.7 and 0.8.

I narrowed it down to the presence of these javascript bookmarks. It is
interesting that you don't need to actually click on them, simply causing the
folder they are in to expand is enough for the leak to begin.

The basic steps seem to be to have these bookmarklets as part of your bookmarks,
to add a new bookmark and to navigate through the bookmarks folders. You don't
necessarily have to manage the bookmarks, but managing bookmarks does seem to to
accelerate the process of garbage being written.

The browser slows down to a crawl as memory leaks whenever you use the bookmarks.

For completeness these are the bookmarklets in question:

            <DT><A HREF="javascript:Array.prototype.push7J2=function(el){var
l=0;for(var k=0;k<this.length;k++){if(this[k]==el)l=k;if(l &&
k<this.length-1)this[k]=this[k+1]}if(l)this.pop();else this.push(el)};A7J2=new
Array('window');w7J2=open('','w7J2','height=400,width=560,screenX=80,screenY=80,scrollbars=yes,resizable=yes');function
d7J2(n){p7J2=w7J2.pageYOffset;A27J2=new
Array();w7J2.document.write('<form>poperties of <input type=text
value='+A7J2[0]+'></form>\n<pre>');for(var
i=0;i<A7J2.length;i++){A27J2.push7J2(A7J2[i]);if(i==n){if(A7J2[i].match(/.document$/))A27J2.push7J2(A7J2[i]+'.layers');for(var
x in
eval(A7J2[i]))if((''+x).indexOf('7J2')==-1)A27J2.push7J2(isNaN(x)?A7J2[i]+'.'+x:A7J2[i]+'['+x+']');}}for(var
i=0;i<A27J2.length;i++){Y7J2=A27J2[i]+'='+(''+eval(A27J2[i]))+'\n';for(var y in
eval(A27J2[i])){Y7J2='<a
href=\'javascript:opener.d7J2('+i+')\'>'+A27J2[i]+'</a>='+(''+eval(A27J2[i]))+'\n';if(i==n)Y7J2='<b>'+Y7J2+'</b>';break;}i7J2='';if(A27J2[i].match(/[\.\[]/g))
for (var j=0;j<A27J2[i].match(/[\.\[]/g).length;j++) i7J2+=' .
';w7J2.document.write(i7J2+Y7J2);}w7J2.document.write('</pre>');w7J2.document.close();w7J2.document.forms[0].onsubmit=function(){A7J2=[this.elements[0].value];setTimeout('d7J2(0)',100);return
false};w7J2.scrollTo(0,p7J2);A7J2=A27J2};d7J2(0)" ADD_DATE="976998059"
LAST_VISIT="0" LAST_MODIFIED="0">DOM - Nav 4</A>
            <DT><A HREF="javascript:pp7J2=prompt('show properties
of','window');w7J2=window.open('','w7J2','height=400,width=560,screenX=80,screenY=80,scrollbars=yes,resizable=yes');function
d7J2(o){try{w7J2.document.write('<pre><b>'+o+'='+eval(o)+'</b>');for(var x in
eval(o))w7J2.document.write(s7J2(x,o));for(i=0;(eval(o+'[i]'));i++)w7J2.document.write(s7J2(i,o))}catch(e){w7J2.document.write('no
such Object')}w7J2.document.write('</pre>');w7J2.document.close()}function
k7J2(o){var
a=w7J2.document.getElementById(o.replace(/[\.\[\]]/g,'_'));if(a.firstChild.style.fontWeight!='bold'){a.firstChild.style.fontWeight='bold';for(var
x in eval(o)){var
r=w7J2.document.createRange();r.setStartAfter(a);a.appendChild(r.createContextualFragment(s7J2(x,o)))}for(var
i=0;(eval(o+'[i]'));i++){var
r=w7J2.document.createRange();r.setStartAfter(a);a.appendChild(r.createContextualFragment(s7J2(i,o)))}}else{a.firstChild.style.fontWeight='normal';while(a.lastChild!=a.firstChild.nextSibling)a.removeChild(a.lastChild)}}function
h7J2(n){var
g=open('','','height=400,width=560,screenX=90,screenY=90,scrollbars=yes,resizable=yes');g.document.write('<pre>'+n.replace(/</g,'<')+'</pre>');g.document.close()}function
s7J2(x,o){if((''+x).indexOf('7J2')>0)return '';var
n=isNaN(x)?o+'.'+x:o+'['+x+']';try{var w=eval(n);var
v=((w+'').length<50)?eval(n):'<a href=javascript:opener.h7J2(opener.'+n+')>[show
in new window]</a>';Y7J2=n+'='+v;if(w && typeof w=='object'){Y7J2='<span
id='+n.replace(/[\.\[\]]/g,'_')+'><a
href=javascript:opener.k7J2(\''+n+'\')>'+(n+'').replace(/</g,'<')+'</a>='+v+'</span>'}}catch(e){Y7J2=n+'=[ERROR]'}i7J2='';if((''+n).match(/[\.\[]/g))for
(var j=0;j<(''+n).match(/[\.\[]/g).length;j++)i7J2+=' .
';return('\n'+i7J2+Y7J2)}d7J2(pp7J2)" ADD_DATE="976998087" LAST_VISIT="0"
LAST_MODIFIED="0">DOM - Nav 6</A>
            <DT><A
HREF="javascript:w7J2=window.open('','w7J2','height=400,width=560,screenX=80,screenY=80,scrollbars=yes,resizable=yes');function
d7J2(o){w7J2.document.write('<form>poperties of <input type=text
value='+o+'></form>\n<pre>');try{w7J2.document.write('<b>'+o+'='+eval(o)+'</b>');for(var
x in eval(o))
w7J2.document.write(s7J2(x,o));for(i=0;(eval(o+'['+i+']'));i++){}}catch(e){w7J2.document.write('[no
such
Object]')}w7J2.document.write('</pre>');w7J2.document.close();w7J2.document.forms[0].onsubmit=function(){setTimeout('d7J2(\''+this.elements[0].value+'\')',100);return
false}}function k7J2(o){var
a=w7J2.document.getElementById(o.replace(/[\.\[\]]/g,'_'));if(a.firstChild.style.fontWeight!='bold'){a.firstChild.style.fontWeight='bold';try{for
(var x in eval(o)){a.innerHTML+=s7J2(x,o)}for(var
i=0;(eval(o+'['+i+']'));i++){}}catch(e){a.innerHTML+=' .
[ERROR]'}}else{a.firstChild.style.fontWeight='normal';while(a.lastChild!=a.firstChild.nextSibling)a.removeChild(a.lastChild)}}function
h7J2(n){var
g=open('','','height=400,width=560,screenX=90,screenY=90,scrollbars=yes,resizable=yes');g.document.write('<pre>'+(''+n).replace(/</g,'<')+'</pre>');g.document.close()}function
s7J2(x,o){if((''+x).indexOf('7J2')>0)return '';var
n=isNaN(x)?o+'.'+x:o+'['+x+']';try{var w=eval(n);var v=((''+w).length<50)?w:'<a
href=javascript:opener.h7J2(opener.'+n+')>[show in new
window]</a>';Y7J2=n+'='+v;if(w && typeof w=='object'){Y7J2='<span
id='+n.replace(/[\.\[\]]/g,'_')+'><a
href=javascript:opener.k7J2(\''+n+'\')>'+(n+'').replace(/</g,'<')+'</a>='+v+'</span>'}}catch(e){Y7J2=n+'=[ERROR]'}i7J2='';if((''+n).match(/[\.\[]/g));for(var
j=0;j<(''+n).match(/[\.\[]/g).length;j++)i7J2+=' .
';return('<br>'+i7J2+Y7J2)}d7J2('window')" ADD_DATE="976998106" LAST_VISIT="0"
LAST_MODIFIED="0">DOM - IE 5</A>
        </DL><p>
(Reporter)

Comment 1

17 years ago
Created attachment 25628 [details]
original bookmark file Communicator 4.76
This should be a dupe of bug 54866.
Reporter: Please reopen this bug if you don't agree


*** This bug has been marked as a duplicate of 54866 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → DUPLICATE

Comment 3

17 years ago
I agree. Reopen if you don't. VERIFIED Dupe
Status: RESOLVED → VERIFIED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.