Changeset 150120 in webkit
- Timestamp:
- May 15, 2013, 9:31:13 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/network/qt/QNetworkReplyHandler.cpp (modified) (6 diffs)
-
WebCore/platform/network/qt/QNetworkReplyHandler.h (modified) (1 diff)
-
WebKit/qt/ChangeLog (modified) (1 diff)
-
WebKit/qt/tests/qwebpage/tst_qwebpage.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150119 r150120 1 2013-05-15 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 3 [Qt] Fix a crash under ~PingLoader when the QNAM on the page has been destroyed. 4 https://bugs.webkit.org/show_bug.cgi?id=116035 5 6 Reviewed by Allan Sandfeld Jensen. 7 8 The previous fix only moved the crash location from WebKit down to QNetworkReplyHttpImpl 9 which expects its QNetworkAccessManager to still be alive. 10 11 Fix it by watching the QNetworkReply's destroyed() signal and avoid the dangling pointer 12 instead. The QNetworkReply doesn't need to be aborted in this case anyway. 13 14 * platform/network/qt/QNetworkReplyHandler.cpp: 15 (WebCore::QNetworkReplyWrapper::QNetworkReplyWrapper): 16 (WebCore::QNetworkReplyWrapper::release): 17 (WebCore::QNetworkReplyWrapper::stopForwarding): 18 Rename resetConnections to stopForwarding since not all connections are related 19 to data forwarding to the client anymore. 20 (WebCore::QNetworkReplyWrapper::receiveMetaData): 21 (WebCore::QNetworkReplyWrapper::replyDestroyed): 22 (WebCore::QNetworkReplyWrapper::didReceiveFinished): 23 * platform/network/qt/QNetworkReplyHandler.h: 24 (QNetworkReplyWrapper): 25 1 26 2013-05-15 Darin Adler <darin@apple.com> 2 27 -
trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
r150057 r150120 270 270 Q_ASSERT(m_reply); 271 271 272 // Allow the QNetworkReply to outlive its parent QNetworkAccessManager in case the later gets destroyed before our ResourceHandle is done with it.273 m_reply->setParent(0);274 275 272 // setFinished() must be the first that we connect, so isFinished() is updated when running other slots. 276 273 connect(m_reply, SIGNAL(finished()), this, SLOT(setFinished())); 277 274 connect(m_reply, SIGNAL(finished()), this, SLOT(receiveMetaData())); 278 275 connect(m_reply, SIGNAL(readyRead()), this, SLOT(receiveMetaData())); 276 connect(m_reply, SIGNAL(destroyed()), this, SLOT(replyDestroyed())); 279 277 } 280 278 … … 291 289 return 0; 292 290 293 resetConnections();291 m_reply->disconnect(this); 294 292 QNetworkReply* reply = m_reply; 295 293 m_reply = 0; … … 305 303 } 306 304 307 void QNetworkReplyWrapper:: resetConnections()305 void QNetworkReplyWrapper::stopForwarding() 308 306 { 309 307 if (m_reply) { 310 // Disconnect all connections except the one to setFinished() slot.308 // Disconnect all connections that might affect the ResourceHandleClient. 311 309 m_reply->disconnect(this, SLOT(receiveMetaData())); 312 310 m_reply->disconnect(this, SLOT(didReceiveFinished())); … … 319 317 { 320 318 // This slot is only used to receive the first signal from the QNetworkReply object. 321 resetConnections(); 322 319 stopForwarding(); 323 320 324 321 WTF::String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString(); … … 373 370 } 374 371 372 void QNetworkReplyWrapper::replyDestroyed() 373 { 374 m_reply = 0; 375 m_sniffer = nullptr; 376 } 377 375 378 void QNetworkReplyWrapper::emitMetaDataChanged() 376 379 { … … 403 406 { 404 407 // Disconnecting will make sure that nothing will happen after emitting the finished signal. 405 resetConnections();408 stopForwarding(); 406 409 m_queue->push(&QNetworkReplyHandler::finish); 407 410 } -
trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h
r134243 r150120 95 95 void receiveSniffedMIMEType(); 96 96 void setFinished(); 97 98 private: 99 void resetConnections(); 97 void replyDestroyed(); 98 99 private: 100 void stopForwarding(); 100 101 void emitMetaDataChanged(); 101 102 -
trunk/Source/WebKit/qt/ChangeLog
r150057 r150120 1 2013-05-15 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 3 [Qt] Fix a crash under ~PingLoader when the QNAM on the page has been destroyed. 4 https://bugs.webkit.org/show_bug.cgi?id=116035 5 6 Reviewed by Allan Sandfeld Jensen. 7 8 * tests/qwebpage/tst_qwebpage.cpp: 9 (tst_QWebPage::networkReplyParentDidntChange): Change test to match the new expectation. 10 (tst_QWebPage::destroyQNAMBeforeAbortDoesntCrash): 11 1 12 2013-05-14 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 13 -
trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r150057 r150120 175 175 176 176 void originatingObjectInNetworkRequests(); 177 void networkReplyParentChanged(); 177 void networkReplyParentDidntChange(); 178 void destroyQNAMBeforeAbortDoesntCrash(); 178 179 void testJSPrompt(); 179 180 void showModalDialog(); … … 2849 2850 } 2850 2851 2851 void tst_QWebPage::networkReplyParent Changed()2852 void tst_QWebPage::networkReplyParentDidntChange() 2852 2853 { 2853 2854 TestNetworkManager* networkManager = new TestNetworkManager(m_page); … … 2855 2856 networkManager->requests.clear(); 2856 2857 2857 // Trigger a load and check if pending QNetworkReplies havebeen reparented before returning to the event loop.2858 // Trigger a load and check that pending QNetworkReplies haven't been reparented before returning to the event loop. 2858 2859 m_view->load(QUrl("qrc:///resources/content.html")); 2859 2860 2860 2861 QVERIFY(networkManager->requests.count() > 0); 2861 QVERIFY(networkManager->findChildren<QNetworkReply*>().isEmpty()); 2862 QVERIFY(networkManager->findChildren<QNetworkReply*>().size() > 0); 2863 } 2864 2865 void tst_QWebPage::destroyQNAMBeforeAbortDoesntCrash() 2866 { 2867 QNetworkAccessManager* networkManager = new QNetworkAccessManager; 2868 m_page->setNetworkAccessManager(networkManager); 2869 2870 m_view->load(QUrl("qrc:///resources/content.html")); 2871 delete networkManager; 2872 // This simulates what PingLoader does with its QNetworkReply when it times out. 2873 // PingLoader isn't attached to a QWebPage and can be kept alive 2874 // for 60000 seconds (~16.7 hours) to then cancel its ResourceHandle. 2875 m_view->stop(); 2862 2876 } 2863 2877
Note:
See TracChangeset
for help on using the changeset viewer.