From kfm-devel Thu Aug 17 06:26:29 2000 From: Lars Knoll Date: Thu, 17 Aug 2000 06:26:29 +0000 To: kfm-devel Subject: Re: assert(executingScript) in HTMLTokenizer X-MARC-Message: https://marc.info/?l=kfm-devel&m=96649358911981 On Thu, 17 Aug 2000, Waldo Bastian wrote: > On Wed, 16 Aug 2000, Harri Porten wrote: > > Waldo Bastian wrote: > > > So the assert is there to catch a problem with javascript doing > > > something that it shouldn't do :-] > > > > I'm just afraid that it *has* to do it. I haven't followed the path of > > execution in this case but it might be that we have to prepare > > everything for reentrancy. JS in events can cause other events .... > > Before I think how to make the interpreter reentrant I hacked in a check > > that simply returns to prevent any damage. > > > > > Please post the rest of the backtrace to see what it tries to do. > > > > Attached. The debug output is further below. > > > > Thanks for looking into that. > > Ok. What you see happening is that the javascript code is calling openURL, > which closes the current document, which destructs the tokenizer which > resets the tokenizer first, which hits the assert. > > If you compare #36 with #9 you see the problem. > > So to make this happen there must be a way to gracefully handle detaching > the current document while it is being used, to be able to replace it with > something new. I think the DOM::HTMLDocumentImpl is a good place for that. > We must have some of ref-counter that says that the document is in use, > cause it is handling a "write()". In closeURL() the KHTMLPart can > dereference the document, but it will not destruct until the write() is > finished. It will dereference itself and find out that it has to > self-destruct. Sounds reasonable. Lars > > Cheers, > Waldo > > > Harri. > > > > #7 0x2ba01998 in __assert_fail () from /lib/libc.so.6 > > #8 0x2abcac70 in HTMLTokenizer::reset (this=0x80c2678) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:81 > > #9 0x2abced58 in HTMLTokenizer::~HTMLTokenizer (this=0x80c2678, > > __in_chrg=3) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:1380 > > #10 0x2abd8755 in DOM::HTMLDocumentImpl::close (this=0x80ae6a0) > > at /home/harri/cvs/kdelibs/khtml/html/html_documentimpl.cpp:171 > > #11 0x2ab910b6 in KHTMLPart::slotFinishedParsing (this=0x8093548) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:904 > > #12 0x2ab8ef79 in KHTMLPart::closeURL (this=0x8093548) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:511 > > #13 0x2ab8e8cf in KHTMLPart::openURL (this=0x8093548, url=@0x7fffed00) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:459 > > #14 0x804a102 in Dummy::slotOpenURL (this=0x80a8ee0, url=@0x7fffed00, > > args=@0x7fffecac) at /home/harri/cvs/kdelibs/khtml/testkhtml.h:17 > > #15 0x2ad35047 in KParts::BrowserExtension::openURLRequest > > (this=0x809e9c8, > > t0=@0x7fffed00, t1=@0x7fffecac) at browserextension.moc:219 > > #16 0x2ab97f32 in KHTMLPart::submitForm (this=0x8093548, > > action=0x2ac7ce58 "post", url=@0x7fffed90, formData=@0x7fffeda8, > > _target=@0x7fffed94, contentType=@0x7fffedbc, boundary=@0x7fffedb8) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:1890 > > #17 0x2abe5e7f in DOM::HTMLFormElementImpl::submit (this=0x80bc668) > > at /home/harri/cvs/kdelibs/khtml/html/html_formimpl.cpp:245 > > #18 0x2ac55031 in DOM::HTMLFormElement::submit (this=0x7fffef10) > > at /home/harri/cvs/kdelibs/khtml/dom/html_form.cpp:294 > > #19 0x2bb664e7 in KJS::HTMLElementFunction::tryExecute (this=0x80be7d0, > > args=@0x80b9448) at > > /home/harri/cvs/kdelibs/khtml/ecma/kjs_html.cpp:797 > > #20 0x2bb87ea4 in KJS::DOMFunction::execute (this=0x80be7d0, > > args=@0x80b9448) > > at /home/harri/cvs/kdelibs/khtml/ecma/kjs_binding.cpp:80 > > #21 0x2bbc8506 in KJS::FunctionImp::executeCall (this=0x80be7d0, > > thisV=0x80b9460, args=0x80b9448) > > at /home/harri/cvs/kdelibs/kjs/function.cpp:116 > > #22 0x2bbc312c in KJS::KJSO::executeCall (this=0x7ffff024, > > thisV=@0x7ffff01c, > > args=0x80b9448) at /home/harri/cvs/kdelibs/kjs/object.cpp:260 > > #23 0x2bbbaca7 in KJS::FunctionCallNode::evaluate (this=0x80b92e0) > > at /home/harri/cvs/kdelibs/kjs/nodes.cpp:317 > > #24 0x2bbbd2ce in KJS::ExprStatementNode::execute (this=0x80b9300) > > at /home/harri/cvs/kdelibs/kjs/nodes.cpp:822 > > #25 0x2bbbed9c in KJS::SourceElementNode::evaluate (this=0x80b9318) > > at /home/harri/cvs/kdelibs/kjs/nodes.cpp:1203 > > #26 0x2bbbebc1 in KJS::SourceElementsNode::evaluate (this=0x80b9338) > > at /home/harri/cvs/kdelibs/kjs/nodes.cpp:1172 > > #27 0x2bbbe9f1 in KJS::ProgramNode::evaluate (this=0x80b9358) > > at /home/harri/cvs/kdelibs/kjs/nodes.cpp:1149 > > #28 0x2bbcbcc1 in KJS::KJScriptImp::evaluate (this=0x80b1e90, > > code=0x80bd720, > > length=33, thisV=0x80b9178) at > > /home/harri/cvs/kdelibs/kjs/internal.cpp:478 > > #29 0x2bbb4c2f in KJScript::evaluate (this=0x80be050, thisV=@0x7ffff198, > > code=0x80bd720, length=33) at /home/harri/cvs/kdelibs/kjs/kjs.cpp:61 > > #30 0x2bb88d47 in kjs_eval (script=0x80be050, c=0x80bd720, len=33, > > n=@0x7ffff1ec) at > > /home/harri/cvs/kdelibs/khtml/ecma/kjs_proxy.cpp:74 > > #31 0x2ac65656 in KJSProxy::evaluate (this=0x80b9150, c=0x80bd720, l=33, > > n=@0x7ffff1ec) at /home/harri/cvs/kdelibs/khtml/ecma/kjs_proxy.h:83 > > #32 0x2ab8f419 in KHTMLPart::executeScript (this=0x8093548, > > script=@0x7ffff28c) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:589 > > #33 0x2abcb78c in HTMLTokenizer::parseListing (this=0x80c2678, > > src=@0x80c2738) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:295 > > #34 0x2abcbc32 in HTMLTokenizer::parseScript (this=0x80c2678, > > src=@0x80c2738) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:350 > > #35 0x2abcda7d in HTMLTokenizer::parseTag (this=0x80c2678, > > src=@0x80c2738) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:955 > > #36 0x2abce630 in HTMLTokenizer::write (this=0x80c2678, str=@0x7ffff45c) > > at /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:1184 > > #37 0x2abd8845 in DOM::HTMLDocumentImpl::write (this=0x80ae6a0, > > text=@0x7ffff45c) > > at /home/harri/cvs/kdelibs/khtml/html/html_documentimpl.cpp:184 > > #38 0x2ab90e9b in KHTMLPart::write (this=0x8093548, > > str=0x80ac9e8 "\r\n\r\n\t
> action=\"abc\" > > method=\"post\">\r\n\t
\r\n\t\r\n\r\n\r\n", len=149) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:878 > > #39 0x2ab902fc in KHTMLPart::slotData (this=0x8093548, data=@0x7ffff684) > > at /home/harri/cvs/kdelibs/khtml/khtml_part.cpp:774 > > #40 0x2ae7dc17 in KIO::TransferJob::data (this=0x80a9490, t0=0x80a9490, > > t1=@0x7ffff684) at jobclasses.moc:674 > > #41 0x2ae7178b in KIO::TransferJob::slotData (this=0x80a9490, > > _data=@0x7ffff684) at /home/harri/cvs/kdelibs/kio/job.cpp:492 > > #42 0x2ae6dac3 in KIO::SlaveInterface::data (this=0x80ac5c8, > > t0=@0x7ffff684) > > at slaveinterface.moc:194 > > #43 0x2ae6c18a in KIO::SlaveInterface::dispatch (this=0x80ac5c8, > > _cmd=100, > > rawdata=@0x7ffff684) at > > /home/harri/cvs/kdelibs/kio/slaveinterface.cpp:65 > > #44 0x2ae6bf53 in KIO::SlaveInterface::dispatch (this=0x80ac5c8) > > at /home/harri/cvs/kdelibs/kio/slaveinterface.cpp:48 > > #45 0x2ae8823b in KIO::Slave::gotInput (this=0x80ac5c8) > > at /home/harri/cvs/kdelibs/kio/slave.cpp:125 > > #46 0x2b437d1f in QObject::activate_signal (this=0x80acf40, > > signal=0x2b77991c "activated(int)", param=10) at > > kernel/qobject.cpp:2044 > > #47 0x2b63db6f in QSocketNotifier::activated (this=0x80acf40, t0=10) > > at kernel/moc_qsocketnotifier.cpp:89 > > #48 0x2b474d36 in QSocketNotifier::event (this=0x80acf40, e=0x7ffff7cc) > > at kernel/qsocketnotifier.cpp:243 > > #49 0x2b3ec7c7 in QApplication::notify (this=0x7ffff96c, > > receiver=0x80acf40, > > event=0x7ffff7cc) at kernel/qapplication.cpp:1643 > > #50 0x2b63731c in QApplication::sendEvent (receiver=0x80acf40, > > event=0x7ffff7cc) at kernel/qapplication.h:379 > > #51 0x2b373cf5 in sn_activate () at kernel/qapplication_x11.cpp:2289 > > #52 0x2b374367 in QApplication::processNextEvent (this=0x7ffff96c, > > canWait=true) at kernel/qapplication_x11.cpp:2482 > > #53 0x2b3ee8ec in QApplication::enter_loop (this=0x7ffff96c) > > at kernel/qapplication.cpp:2513 > > #54 0x2b373db5 in QApplication::exec (this=0x7ffff96c) > > at kernel/qapplication_x11.cpp:2333 > > #55 0x8049f10 in main (argc=2, argv=0x7ffffa84) > > at /home/harri/cvs/kdelibs/khtml/testkhtml.cpp:67 > > #56 0x2ba01736 in __libc_start_main () from /lib/libc.so.6 > > > > testkhtml: KHTMLPart::init this=0x8093548 d=0x809cbe0 > > khtml (part): KHTMLPart::openURL file:/tmp/crash.html > > khtml (part): closing old URL > > khtml (part): KHTMLPart::openURL now (before started) m_url = > > kio (Slave): createSlave for file:/tmp/crash.html > > kio (Slave): PID of slave = 8010 > > kio (Slave): slave has connected to application > > kio (Slave): got answer 10 > > khtml (part): slotData: 149 > > khtml (part): begin! > > khtml (memory): KHTMLPart::clear() > > khtml (encoding): INIT HTML Codec name= ISO 8859-1 > > testkhtml: list for iso 8859-1 is: iso8859-1 > > testkhtml: iso8859-1 available > > khtml (encoding): setting up charset to 0 > > testkhtml: list for iso 8859-1 is: iso8859-1 > > testkhtml: iso8859-1 available > > khtml (encoding): charset is 0 > > kdecore (KLibLoader): add loaded lib 0x80be060 > > khtml (html): submit pressed! > > khtml (html): form: formData() > > khtml (part): KHTMLPart::openURL file:/tmp/abc > > khtml (part): closing old URL > > kio (Slave): killing slave (file://) > > kio (KIOJob): Job::kill this=0x80a9490 > > khtml (part): was still parsing... calling end > > lt-testkhtml: /home/harri/cvs/kdelibs/khtml/html/htmltokenizer.cpp:81: > > void HTMLTokenizer::reset(): Assertion `executingScript == false' > > failed. > > KCrash: crashing.... crashRecursionCounter = 2 > > KCrash: Application Name = lt-testkhtml path =