[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 242886] Javascript parsing incomplete
From:       Andrea Diamantini <adjam7 () gmail ! com>
Date:       2010-08-31 23:40:16
Message-ID: 20100831234016.1AFD163B36 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=242886


Andrea Diamantini <adjam7@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Andrea Diamantini <adjam7 gmail com>  2010-09-01 01:40:13 ---
commit b08c67eb1e45cb94dc6250fe555d84f0c0e7debe
Author: Andrea Diamantini <adjam7@gmail.com>
Date:   Wed Sep 1 01:39:43 2010 +0200

    This hacks should fix (a lot of) javascript handling.
    Hope this will be properly fixed upstream in KIO...

    Please, Jurian & Pano. Let me know if this has been really fixed.

    BUG: 242886

diff --git a/src/analyzer/networkanalyzer.cpp
b/src/analyzer/networkanalyzer.cpp
index c5b0883..d0044f4 100644
--- a/src/analyzer/networkanalyzer.cpp
+++ b/src/analyzer/networkanalyzer.cpp
@@ -162,7 +162,8 @@ void NetworkAnalyzer::requestFinished( QObject *replyObject
)
     QString contentType = reply->header( QNetworkRequest::ContentTypeHeader
).toString();
     item->setText( 4, contentType );

-    if ( status == 302 ) {
+    if ( status == 302 ) 
+    {
         QUrl target = reply->attribute(
QNetworkRequest::RedirectionTargetAttribute ).toUrl();
         item->setText( 5, i18n("Redirect: %1", target.toString() ) );
     }
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index f746087..73c8b59 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -65,7 +65,7 @@ QNetworkReply
*NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
     QNetworkRequest req = request;
     req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
     req.setRawHeader("Accept-Language", _acceptLanguage);
-
+    
     KIO::CacheControl cc = KProtocolManager::cacheControl();
     switch (cc)
     {
@@ -88,6 +88,20 @@ QNetworkReply
*NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
         break;
     }

+    // WARNING 
+    // There are actually 3 exceptions here handled with QNAM 
+    // instead of KIO that need fixes upstream before removing. They are:
+    // 1) AJAX requests handling
+    // 2) DeleteOperation
+    // 3) CustomOperation
+    
+    // this is used to handle "AJAX" requests
+    QByteArray header = req.rawHeader("x-requested-with");
+    if(!header.isNull())
+    {
+        return QNetworkAccessManager::createRequest(op, req, outgoingData);
+    }
+    
     switch(op)
     {
     case QNetworkAccessManager::HeadOperation:
@@ -107,14 +121,14 @@ QNetworkReply
*NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
         kDebug() << "DELETE OPERATION...";
         reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
         if(!reply)
-            kDebug() << "OOOOOOOOOOOOOOOOOOO DELETE REPLY NULL";
+            kDebug() << "oh oh... DELETE REPLY NULL";
         break;

     case QNetworkAccessManager::CustomOperation:
         kDebug() << "CUSTOM OPERATION...";
         reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
         if(!reply)
-            kDebug() << "OOOOOOOOOOOOOOOOOOO CUSTOM REPLY NULL";
+            kDebug() << "oh oh... CUSTOM REPLY NULL";
         break;

     default:
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index d52433b..a260ad0 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -94,6 +94,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest
&request, QWebFrame *fra
     // javascript handling
     if (_url.protocol() == QL1S("javascript"))
     {
+        kDebug() << "JAVASCRIPT URL: " << _url;
         QString scriptSource = _url.authority();
         if(scriptSource.isEmpty()) {
             // if javascript:<code here> then authority() returns

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic