Changeset 80768 in webkit
- Timestamp:
- Mar 10, 2011 2:54:13 PM (13 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/Api/qwebframe.cpp
r79988 r80768 781 781 QUrl QWebFrame::requestedUrl() const 782 782 { 783 // There are some possible edge cases to be handled here, 784 // apart from checking if activeDocumentLoader is valid: 785 // 786 // * Method can be called while processing an unsucessful load. 787 // In this case, frameLoaderClient will hold the current error 788 // (m_loadError), and we will make use of it to recover the 'failingURL'. 789 // * If the 'failingURL' holds a null'ed string though, we fallback 790 // to 'outgoingReferrer' (it yet is safer than originalRequest). 791 FrameLoader* loader = d->frame->loader(); 792 FrameLoaderClientQt* loaderClient = d->frameLoaderClient; 793 794 if (!loader->activeDocumentLoader() 795 || !loaderClient->m_loadError.isNull()) { 796 if (!loaderClient->m_loadError.failingURL().isNull()) 797 return QUrl(loaderClient->m_loadError.failingURL()); 798 else if (!loader->outgoingReferrer().isEmpty()) 799 return QUrl(loader->outgoingReferrer()); 800 } 801 802 return loader->originalRequest().url(); 783 const KURL& lastRequestedUrl = d->frameLoaderClient->lastRequestedUrl(); 784 if (lastRequestedUrl.isValid()) 785 return lastRequestedUrl; 786 return d->frame->loader()->originalRequest().url(); 803 787 } 804 788 /*! -
trunk/Source/WebKit/qt/ChangeLog
r80716 r80768 1 2011-03-10 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> 2 3 Reviewed by Antonio Gomes. 4 5 Simplify how QWebFrame::requestedUrl() is obtained 6 https://bugs.webkit.org/show_bug.cgi?id=55842 7 8 When a load starts, store the requested URL until we know that it'll be 9 available for us in the document loader -- after load finished. 10 11 The existing auto tests cover the three different code paths in 12 requestedUrl() and the new code passes the autotests. In each of those 13 cases, we looked for the information in a different place, but in all 14 of them, dispatchDidStartProvisionalLoad was called. 15 16 This simplification will be useful to fix bug 32723. The way requestedUrl() 17 is implementent, we can't use it as a fallback for url() when the setUrl() 18 was called with an invalid URL. 19 20 * Api/qwebframe.cpp: 21 (QWebFrame::requestedUrl): 22 * WebCoreSupport/FrameLoaderClientQt.cpp: 23 (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad): 24 (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad): 25 * WebCoreSupport/FrameLoaderClientQt.h: 26 (WebCore::FrameLoaderClientQt::lastRequestedUrl): 27 1 28 2011-03-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 29 -
trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
r80475 r80768 438 438 printf("%s - in didStartProvisionalLoadForFrame\n", qPrintable(drtPrintFrameUserGestureStatus(m_frame))); 439 439 440 m_lastRequestedUrl = m_frame->loader()->activeDocumentLoader()->requestURL(); 441 440 442 if (m_webFrame) 441 443 emit m_webFrame->provisionalLoad(); … … 517 519 // Clears the previous error. 518 520 m_loadError = ResourceError(); 521 522 // The requested URL will be available in the document loader that just finished, so we 523 // don't need to keep it anymore. 524 m_lastRequestedUrl = KURL(); 519 525 520 526 if (!m_webFrame) -
trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
r80475 r80768 240 240 virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); 241 241 242 const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; } 243 242 244 static bool dumpFrameLoaderCallbacks; 243 245 static bool dumpUserGestureInFrameLoaderCallbacks; … … 268 270 bool m_hasRepresentation; 269 271 272 KURL m_lastRequestedUrl; 270 273 ResourceError m_loadError; 271 274 };
Note: See TracChangeset
for help on using the changeset viewer.