Version: 3.5.5 (using KDE 3.5.5, Debian Package 4:3.5.5a.dfsg.1-6 (4.0)) Compiler: Target: i486-linux-gnu OS: Linux (i686) release 2.6.18p4s I go to www.at91.com with konqueror (3.5.5 or .6) and I see a blank page. Using Firefox or Explorer emulation doesn't work as well, but browsing with Firefox does work. On the javascript error console I have: Error: http://www.at91.com/: TypeError: Value undefined (result of expression objetAjax.overrideMimeType) is not an object. Cannot be called. So I think the conflicting code is with this file: http://www.at91.com/Scripts/sAjax.js I reproduce the concerning part for convenience: function creationObjetAjax() { var objetAjax; objetAjax = new XMLHttpRequest(); objetAjax.overrideMimeType('text/html'); return objetAjax; }
Seems like we need to support this (Mozilla-specific) method...
*** Bug 143489 has been marked as a duplicate of this bug. ***
SVN commit 656602 by porten: implemented overrideMimeType() extension BUG: 142265 M +21 -3 xmlhttprequest.cpp M +4 -1 xmlhttprequest.h --- trunk/KDE/kdelibs/khtml/ecma/xmlhttprequest.cpp #656601:656602 @@ -58,6 +58,7 @@ getAllResponseHeaders XMLHttpRequest::GetAllResponseHeaders DontDelete|Function 0 getResponseHeader XMLHttpRequest::GetResponseHeader DontDelete|Function 1 open XMLHttpRequest::Open DontDelete|Function 5 + overrideMimeType XMLHttpRequest::OverrideMIMEType DontDelete|Function 1 send XMLHttpRequest::Send DontDelete|Function 1 setRequestHeader XMLHttpRequest::SetRequestHeader DontDelete|Function 2 @end @@ -146,9 +147,12 @@ if (!createdDocument) { QString mimeType = "text/xml"; - ValueImp *header = getResponseHeader("Content-Type"); - if (header->type() != UndefinedType) { - mimeType = header->toString(exec).qstring().split(";")[0].trimmed(); + if (!m_mimeTypeOverride.isEmpty()) { + mimeType = m_mimeTypeOverride; + } else { + ValueImp *header = getResponseHeader("Content-Type"); + if (header->type() != UndefinedType) + mimeType = header->toString(exec).qstring().split(";")[0].trimmed(); } if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "application/xhtml+xml") { @@ -464,6 +468,11 @@ changeState(XHRS_Uninitialized); } +void XMLHttpRequest::overrideMIMEType(const QString& override) +{ + m_mimeTypeOverride = override; +} + void XMLHttpRequest::setRequestHeader(const QString& _name, const QString& _value, int& ec) { if (m_state != XHRS_Open) { @@ -792,6 +801,7 @@ return jsUndefined(); } case XMLHttpRequest::SetRequestHeader: + { if (args.size() < 2) return throwError(exec, SyntaxError, "Not enough arguments"); JSValue* keyArgument = args[0]; @@ -804,6 +814,14 @@ request->setRequestHeader(key, val, ec); setDOMException(exec, ec); return jsUndefined(); + } + + case XMLHttpRequest::OverrideMIMEType: + if (args.size() < 1) + return throwError(exec, SyntaxError, "Not enough arguments"); + + request->overrideMIMEType(args[0]->toString(exec).qstring()); + return jsUndefined(); } return Undefined(); --- trunk/KDE/kdelibs/khtml/ecma/xmlhttprequest.h #656601:656602 @@ -90,7 +90,8 @@ virtual const ClassInfo* classInfo() const { return &info; } static const ClassInfo info; enum { Onload, Onreadystatechange, ReadyState, ResponseText, ResponseXML, Status, StatusText, Abort, - GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader }; + GetAllResponseHeaders, GetResponseHeader, Open, Send, SetRequestHeader, + OverrideMIMEType }; private: friend class XMLHttpRequestProtoFunc; @@ -116,6 +117,7 @@ void send(const QString& _body, int& ec); void abort(); void setRequestHeader(const QString& name, const QString& value, int& ec); + void overrideMIMEType(const QString& override); ValueImp *getAllResponseHeaders() const; ValueImp *getResponseHeader(const QString& name) const; @@ -127,6 +129,7 @@ QString method; bool async; HTTPHeaderMap m_requestHeaders; + QString m_mimeTypeOverride; QString contentType; KIO::TransferJob * job;
Thanks a lot for solving this bug. I don't know if this is a very common method, but having such a quick response is nice to know, and most important makes konqueror and even better piece of software.