Summary: | Amazon.com product pages: redirect to ad (javascript:location.replace) | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Chase Venters <chase.venters> |
Component: | khtml | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | maksim |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Chase Venters
2006-09-28 17:07:51 UTC
If we do it different from other browsers, it is our problem :-( I think there was some thread on kfm-devel about it, I'll see if there is a way we can fix it quicky... Do you have an example URL of where this happens, BTW? http://www.amazon.com/C++-GUI-Programming-Qt-4/dp/0131872494/sr=8-8/qid=1159478486/ref=pd_bbs_8/002-9181102-7164051?ie=UTF8&s=books That should do it. Yep :-(. Wonder what subset of pages this affects, but sounds like a high-priority bug. Please be advised that I lit a fire under Amazon's ass about using javascript:location.replace() in that way, so our live example may disappear sooner or later. I'll save a copy of the page off so that there is a reference in case I misjudged what the problem is. I have a start on it, but it's a very messy feature.... for example the following are all possible, and behave as following in other browsers: <iframe src='javascript:"Foo"'> --- writes 'Foo' in the new page <iframe src='javascript:"Foo" + document.body.appendChild(document.createTextNode("bar")'> --- in mozilla and opera writes Foo[object Text], error about being unable to find body in IE <iframe src='javascript:"Foo" + document.write('hi')'> --- 'hi' everywhere(!). etc. So I don't yet have a good model of what's going on here... SVN commit 590600 by orlovich: Evaluate scripts in <iframe src=javascript:..> in the right context. Affects amazon and freemail.hu BUG:134791 BUG:106748 M +13 -6 khtml_part.cpp --- branches/KDE/3.5/kdelibs/khtml/khtml_part.cpp #590599:590600 @@ -4314,12 +4314,19 @@ // Support for <frame src="javascript:string"> if ( url.find( QString::fromLatin1( "javascript:" ), 0, false ) == 0 ) { - QVariant res = executeScript( DOM::Node(frame->element()), KURL::decode_string( url.right( url.length() - 11) ) ); - KURL myurl; - myurl.setProtocol("javascript"); - if ( res.type() == QVariant::String ) - myurl.setPath(res.asString()); - return processObjectRequest(*it, myurl, QString("text/html") ); + if ( processObjectRequest(*it, KURL("about:blank"), QString("text/html") ) ) { + KHTMLPart* p = static_cast<KHTMLPart*>(static_cast<KParts::ReadOnlyPart *>((*it)->m_part)); + + // See if we want to replace content with javascript: output.. + QVariant res = p->executeScript( DOM::Node(), KURL::decode_string( url.right( url.length() - 11) ) ); + if ( res.type() == QVariant::String ) { + p->begin(); + p->write( res.asString() ); + p->end(); + } + return true; + } + return false; } KURL u = url.isEmpty() ? KURL() : completeURL( url ); return requestObject( *it, u ); |