>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Разработка http://forum.mozilla-russia.org/viewforum.php?id=18 >out of memory http://forum.mozilla-russia.org/viewtopic.php?id=6794 |
olegs2 > 08-12-2005 13:14:58 |
Вот такой немудреный код приводит к краху Fx, если понажимать кнопку. Выделить код Код:<?xml version="1.0" encoding="Windows-1251"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <!DOCTYPE window SYSTEM "chrome://global/locale/config.dtd"> <window id="main" align="left" valign="top" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="recordListBox = document.getElementById('recordList');" > <script type="text/javascript; e4x=1"> <![CDATA[ XML.prettyPrinting = false; var recordListBox, xmlsrc; var req = new XMLHttpRequest(); function loadRecords() { if (recordListBox.hasChildNodes()) {recordListBox.removeChild(recordListBox.childNodes[0]);} req.open("GET", "records.xml", false); req.overrideMimeType('text/xml; charset=windows-1251'); req.send(null); if(req.status != 200) {alert('Error loading xml file \n'); return;} xmlsrc = new XML(req.responseText); var recordListXML = <listbox rows="20" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <listcols> <listcol style="width: 10em"/> <listcol style="width: 10em"/> <listcol style="width: 10em"/> </listcols> <listhead> <listheader label="head1"/> <listheader label="head2"/> <listheader label="head2"/> </listhead> </listbox>; for each (var f in xmlsrc['fs'].f) { recordListXML.appendChild(makeRecordRows(f)); } var recordListDOM = (new DOMParser()).parseFromString(recordListXML.toXMLString(), 'text/xml'); recordListBox.appendChild(recordListDOM.documentElement); } function makeRecordRows(f) { var recordFields = f.text().toString().split("•"); var record = <listitem value={f.@v}/>; for (var i = 0; i < recordFields.length; i++) { record.appendChild(<listcell label={recordFields[i]}/>); } return record; } ]]> </script> <box id="recordList" width="300px" height="400px"/> <button label="Load records" oncommand="loadRecords();"/> </window> файл records.xml: <l> <fs> <f v="0"><![CDATA[1000•bbb1•ccc1]]></f> ... 1000 штук ... </fs> </l> |
olegs2 > 12-12-2005 09:42:45 |
Все дело в функции makeRecordRows. |