Bug 242886 - Javascript parsing incomplete
Summary: Javascript parsing incomplete
Status: RESOLVED UPSTREAM
Alias: None
Product: rekonq
Classification: Applications
Component: general (show other bugs)
Version: 0.4.95
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 0.7
Assignee: Andrea Diamantini
URL:
Keywords:
: 251591 251619 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-06-26 17:37 UTC by Jurian Sluiman
Modified: 2011-05-28 10:47 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jurian Sluiman 2010-06-26 17:37:01 UTC
Version:           0.4.95 (using KDE 4.4.2) 
OS:                Linux

Several sites depending heavily on javascript don't work. I cannot find the exact missing features in Rekonq, but sites includes the following:

http://getsatisfaction.com - login/comment: almost everything
http://twitter.com - 'More' and the end of someones tweet-page & follow buttons
http://fizion.nl/sketchup - choosing a specific gallery

I noticed more sites have problems, open them in Firefox (3.5.9) and they work perfectly.

Reproducible: Always
Comment 1 Panagiotis Papadopoulos 2010-06-27 17:30:34 UTC
I can confirm the problem with the twitter website in rekonq and Konqueror (with webkit kpart), but not in arora.
I'm using Qt 4.6.3 and use the Week 25 snapshot of the qtwebkit 2.0 branch, KDE SC version 4.4.4
Comment 2 Panagiotis Papadopoulos 2010-08-31 16:41:59 UTC
@adawit:

Could this be a KIO/KDEwebkit issue?
Here on Qt 4.7 from mainline git (2 days old) and its bundled QtWebKit on KDE SC 4.5 it still does not work in rekonq & Konqueror with the WebKit Kpart.
Comment 3 Andrea Diamantini 2010-08-31 17:42:08 UTC
Targetting 0.6 release. Not sure it can be addressed, anyway.
Comment 4 Andrea Diamantini 2010-09-01 01:40:13 UTC
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
Comment 5 Panagiotis Papadopoulos 2010-09-01 03:00:20 UTC
andrea: Awesome work! At least here the websites mentioned above are working now. Thx!
Comment 6 Andrea Diamantini 2010-09-06 01:34:25 UTC
I'm sorry I have to reopen this. The proposed fix no more lets requests properly handle cookies, so that rekonq can no more login in some web 2.0 services.

Working on a "proper" solution.
Comment 7 Andrea Diamantini 2010-09-18 00:57:35 UTC
*** Bug 251619 has been marked as a duplicate of this bug. ***
Comment 8 Andrea Diamantini 2010-09-19 10:49:19 UTC
*** Bug 251591 has been marked as a duplicate of this bug. ***
Comment 9 niburu1 2010-12-07 16:29:35 UTC
I'm observing the bug with hotmail as described in Bug 251591: https://bugs.kde.org/show_bug.cgi?id=251591. I'm using rekonq version 0.6.1 with Kubuntu 10.10.
Comment 10 Dawit Alemayehu 2011-05-28 01:46:23 UTC
The issue has long since been fixed in kdewebkit, and as such workarounds like the one in comment #4 are no longer necessary.
Comment 11 Andrea Diamantini 2011-05-28 10:47:40 UTC
Yes, thanks. Just removed it times ago, but forgot to report here. Targetting as RESOLVED, UPSTREAM.