Index: kioslave/http/http.cc =================================================================== --- kioslave/http/http.cc (revision 607008) +++ kioslave/http/http.cc (working copy) @@ -2491,7 +2491,7 @@ header += "\r\n"; } - if (m_request.method == HTTP_POST) + if (m_request.method == HTTP_POST || m_request.method == HTTP_PUT) { header += metaData("content-type"); header += "\r\n"; @@ -2588,7 +2588,7 @@ } } - kdDebug(7103) << "(" << m_pid << ") ============ Sending Header:" << endl; + kdDebug(7103) << "(" << m_pid << ") ============ NKS Sending Header:" << endl; QStringList headerOutput = QStringList::split("\r\n", header); QStringList::Iterator it = headerOutput.begin(); Index: khtml/khtml_part.h =================================================================== --- khtml/khtml_part.h (revision 607008) +++ khtml/khtml_part.h (working copy) @@ -1616,6 +1616,7 @@ bool requestObject( khtml::ChildFrame *child, const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() ); DOM::EventListener *createHTMLEventListener( QString code, QString name, DOM::NodeImpl *node ); + DOM::EventListener *createHTMLEventListenerNoHook( QString code, QString name, DOM::NodeImpl *node ); DOM::HTMLDocumentImpl *docImpl() const; DOM::DocumentImpl *xmlDocImpl() const; @@ -1624,7 +1625,8 @@ khtml::ChildFrame *recursiveFrameRequest( KHTMLPart *callingHtmlPart, const KURL &url, const KParts::URLArgs &args, bool callParent = true ); bool checkLinkSecurity( const KURL &linkURL,const QString &message = QString::null, const QString &button = QString::null ); - QVariant executeScript( const QString& filename, int baseLine, const DOM::Node &n, const QString& script ); + QVariant executeScript( const QString& filename, int baseLine, const DOM::Node &n, + const QString& script, DOM::NodeImpl* curnode); KJSProxy *jScript(); Index: khtml/misc/loader.h =================================================================== --- khtml/misc/loader.h (revision 607008) +++ khtml/misc/loader.h (working copy) @@ -53,6 +53,7 @@ #include #include +#include class QMovie; class KHTMLPart; @@ -241,11 +242,14 @@ void checkNotify(); bool isLoaded() const { return !m_loading; } - void setCharset( const QString& charset ) { m_charset = charset; } - + void setCharset( const QString& charset ) { m_charset = charset; } + void setScriptElementNode(DOM::NodeImpl *n) { scriptElementNode = n; scriptElementNode->ref();} + DOM::NodeImpl* getScriptElementNode() { return scriptElementNode; } + protected: - QString m_charset; - DOM::DOMString m_script; + QString m_charset; + DOM::DOMString m_script; + DOM::NodeImpl *scriptElementNode; }; class ImageSource; Index: khtml/khtml_part.cpp =================================================================== --- khtml/khtml_part.cpp (revision 607008) +++ khtml/khtml_part.cpp (working copy) @@ -186,7 +186,7 @@ if (m_jscript) { // we have a jscript => a part in an iframe KJS::Completion cmp; - m_jscript->evaluate(QString::null, 1, script, 0L, &cmp); + m_jscript->evaluate(QString::null, 1, script, 0L, &cmp, 0); } else part->executeScript(m_frame->element(), script); } @@ -1139,8 +1139,10 @@ KApplication::kdeinitExec( "kcmshell", args ); } -QVariant KHTMLPart::executeScript(const QString& filename, int baseLine, const DOM::Node& n, const QString& script) -{ +QVariant KHTMLPart::executeScript(const QString& filename, int baseLine, + const DOM::Node& n, const QString& script, + DOM::NodeImpl *enclosingNode) + { #ifdef KJS_VERBOSE // The script is now printed by KJS's Parser::parse kdDebug(6070) << "executeScript: caller='" << name() << "' filename=" << filename << " baseLine=" << baseLine /*<< " script=" << script*/ << endl; @@ -1152,7 +1154,7 @@ KJS::Completion comp; - QVariant ret = proxy->evaluate(filename, baseLine, script, n, &comp); + QVariant ret = proxy->evaluate(filename, baseLine, script, n, &comp, enclosingNode); /* * Error handling @@ -1175,9 +1177,9 @@ t->abort(); d->m_redirectionTimer.start( 0, true ); } - + return ret; -} + } QVariant KHTMLPart::executeScript( const QString &script ) { @@ -1190,12 +1192,12 @@ kdDebug(6070) << "KHTMLPart::executeScript caller='" << name() << "' node=" << n.nodeName().string().latin1() << "(" << (n.isNull() ? 0 : n.nodeType()) << ") " /* << script */ << endl; #endif KJSProxy *proxy = jScript(); - + if (!proxy || proxy->paused()) return QVariant(); ++(d->m_runningScripts); KJS::Completion comp; - const QVariant ret = proxy->evaluate( QString::null, 1, script, n, &comp ); + const QVariant ret = proxy->evaluate( QString::null, 1, script, n, &comp, 0); --(d->m_runningScripts); /* @@ -6926,8 +6928,17 @@ if (!proxy) return 0; + return proxy->createHTMLEventHandler( m_url.url(), name, code, node, true); +} - return proxy->createHTMLEventHandler( m_url.url(), name, code, node ); +//event listener set through the DOM interface -- i.e. via javascript; so don't run the hook +DOM::EventListener *KHTMLPart::createHTMLEventListenerNoHook( QString code, QString name, NodeImpl* node ) +{ + KJSProxy *proxy = jScript(); + + if (!proxy) + return 0; + return proxy->createHTMLEventHandler( m_url.url(), name, code, node, false); } KHTMLPart *KHTMLPart::opener() Index: khtml/html/htmltokenizer.cpp =================================================================== --- khtml/html/htmltokenizer.cpp (revision 607008) +++ khtml/html/htmltokenizer.cpp (working copy) @@ -134,6 +134,7 @@ m_executingScript = 0; m_autoCloseTimer = 0; onHold = false; + currTokenNode = 0; reset(); } @@ -149,6 +150,7 @@ m_executingScript = 0; m_autoCloseTimer = 0; onHold = false; + currTokenNode = 0; reset(); } @@ -176,7 +178,7 @@ killTimer(m_autoCloseTimer); m_autoCloseTimer = 0; } - + currTokenNode = 0; currToken.reset(); } @@ -381,7 +383,8 @@ processListing(TokenizerString(scriptCode, scriptCodeSize)); QString exScript( buffer, dest-buffer ); - + + NodeImpl *scriptElementNode = this->currTokenNode; processToken(); currToken.tid = ID_SCRIPT + ID_CLOSE_TAG; processToken(); @@ -397,7 +400,8 @@ // forget what we just got, load from src url instead if ( !currentScriptSrc.isEmpty() && (cs = parser->doc()->docLoader()->requestScript(currentScriptSrc, scriptSrcCharset) )) { - cachedScript.enqueue(cs); + cachedScript.enqueue(cs); //should also enqueue the scriptElementNode ... so that when it runs eventually we can pass in the context + cs->setScriptElementNode(scriptElementNode); } if (cs) { @@ -413,7 +417,7 @@ pendingQueue.push(src); setSrc(TokenizerString()); scriptCodeSize = scriptCodeResync = 0; - scriptExecution( exScript, QString::null, tagStartLineno /*scriptStartLineno*/ ); + scriptExecution( exScript, QString::null, tagStartLineno, scriptElementNode /*scriptStartLineno*/ ); } else { // script was filtered or disallowed effectiveScript = false; @@ -436,8 +440,11 @@ } } +//This should be called on the contents of a