Changeset 20813 in webkit
- Timestamp:
- Apr 9, 2007, 5:00:21 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r20809 r20813 1 2007-04-09 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin 4 5 Layout test for the fix for <rdar://4921797> and http://bugs.webkit.org/show_bug.cgi?id=12005 6 7 * http/tests/navigation/multiple-back-forward-entries-expected.txt: Added. 8 * http/tests/navigation/multiple-back-forward-entries.html: Added. 9 * http/tests/navigation/resources/slow-resource.pl: Added. 10 1 11 2007-04-09 Justin Garcia <justin.garcia@apple.com> 2 12 -
trunk/WebCore/ChangeLog
r20805 r20813 1 2007-04-09 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Darin 4 5 Fixes <rdar://4921797> and http://bugs.webkit.org/show_bug.cgi?id=12005 6 7 The original regression was to claim that more loads were the result of a "user gesture" than really 8 were. A lot of the ways a frame load could be kicked off didn't properly set up this flag, and it 9 wasn't properly propagated and respected where it should've been. 10 11 This patch cleans much of that up. One loose end is the "treatAsUserGesture" flag which is a stop 12 gap measure to keep "slow redirects" working to create a new history item. In the future, we need 13 to cleanup the meaning and use of "userGesture" and "lockHistory." This includes integrating them 14 in to FrameLoadRequest and being very clear of what their meaning actually is at different stages of 15 the Frame load process. 16 17 * dom/Document.cpp: 18 (WebCore::Document::processHttpEquiv): Pass only the delay for the redirect 19 20 * html/HTMLAnchorElement.cpp: 21 (WebCore::HTMLAnchorElement::defaultEventHandler): Pass "lockHistory" false, "userGesture" true 22 23 * ksvg2/svg/SVGAElement.cpp: 24 (WebCore::SVGAElement::defaultEventHandler): Pass "lockHistory" false, "userGesture" true 25 26 * loader/FrameLoader.cpp: 27 (WebCore::ScheduledRedirection::ScheduledRedirection): Figure "lockHistory" and "userGesture" from the 28 delay here, instead of at 3 other different sites that call this method 29 (WebCore::FrameLoader::changeLocation): Set userGesture correctly 30 (WebCore::FrameLoader::urlSelected): Propagate userGesture down 31 (WebCore::FrameLoader::requestFrame): 32 (WebCore::FrameLoader::receivedFirstData): 33 (WebCore::FrameLoader::scheduleRedirection): Pass only the delay here 34 (WebCore::FrameLoader::redirectionTimerFired): Set userGesture correctly 35 (WebCore::FrameLoader::load): 36 (WebCore::FrameLoader::updateHistoryForInternalLoad): Insteading of asserting we aren't a redirect, 37 handle the case where we *are* a redirect by updating the previous history item 38 * loader/FrameLoader.h: 39 1 40 2007-04-09 Anders Carlsson <andersca@apple.com> 2 41 -
trunk/WebCore/dom/Document.cpp
r20794 r20813 1746 1746 if (frame && parseHTTPRefresh(content, true, delay, url)) { 1747 1747 if (url.isEmpty()) 1748 frame->loader()->scheduleRedirection(delay, frame->loader()->url().url(), delay <= 1);1748 url = frame->loader()->url().url(); 1749 1749 else 1750 // We want a new history item if the refresh timeout > 1 second1751 frame->loader()->scheduleRedirection(delay, completeURL(url), delay <= 1);1750 url = completeURL(url); 1751 frame->loader()->scheduleRedirection(delay, url); 1752 1752 } 1753 1753 } else if (equalIgnoringCase(equiv, "set-cookie")) { -
trunk/WebCore/html/HTMLAnchorElement.cpp
r20729 r20813 216 216 217 217 if (!evt->defaultPrevented() && document()->frame()) 218 document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt );218 document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, true); 219 219 220 220 evt->setDefaultHandled(); -
trunk/WebCore/ksvg2/svg/SVGAElement.cpp
r20725 r20813 116 116 if (!evt->defaultPrevented()) 117 117 if (document()->frame()) 118 document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt );118 document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, true); 119 119 120 120 evt->setDefaultHandled(); -
trunk/WebCore/loader/FrameLoader.cpp
r20740 r20813 124 124 bool wasUserGesture; 125 125 126 ScheduledRedirection(double redirectDelay, const String& redirectURL, bool redirectLockHistory )126 ScheduledRedirection(double redirectDelay, const String& redirectURL, bool redirectLockHistory, bool userGesture) 127 127 : type(redirection) 128 128 , delay(redirectDelay) … … 130 130 , historySteps(0) 131 131 , lockHistory(redirectLockHistory) 132 , wasUserGesture( false)132 , wasUserGesture(userGesture) 133 133 { 134 134 } … … 330 330 ResourceRequest request(completeURL(URL), referrer, policy); 331 331 332 urlSelected(request, "_self", 0, lockHistory );333 } 334 335 void FrameLoader::urlSelected(const ResourceRequest& request, const String& _target, Event* triggeringEvent, bool lockHistory )332 urlSelected(request, "_self", 0, lockHistory, userGesture); 333 } 334 335 void FrameLoader::urlSelected(const ResourceRequest& request, const String& _target, Event* triggeringEvent, bool lockHistory, bool userGesture) 336 336 { 337 337 String target = _target; … … 353 353 frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer); 354 354 355 urlSelected(frameRequest, triggeringEvent );355 urlSelected(frameRequest, triggeringEvent, userGesture); 356 356 } 357 357 … … 369 369 Frame* frame = m_frame->tree()->child(frameName); 370 370 if (frame) 371 frame->loader()->scheduleLocationChange(url.url(), m_outgoingReferrer, false, false);371 frame->loader()->scheduleLocationChange(url.url(), m_outgoingReferrer, false, userGestureHint()); 372 372 else 373 373 frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer); … … 773 773 URL = m_frame->document()->completeURL(URL); 774 774 775 // We want a new history item if the refresh timeout > 1 second 776 scheduleRedirection(delay, URL, delay <= 1); 775 scheduleRedirection(delay, URL); 777 776 } 778 777 … … 1156 1155 } 1157 1156 1158 void FrameLoader::scheduleRedirection(double delay, const String& url , bool doLockHistory)1157 void FrameLoader::scheduleRedirection(double delay, const String& url) 1159 1158 { 1160 1159 if (delay < 0 || delay > INT_MAX / 1000) 1161 1160 return; 1161 1162 // We want a new history item if the refresh timeout > 1 second. We accomplish this 1163 // by pretending a slow redirect is a user gesture and passing false for lockHistory 1162 1164 if (!m_scheduledRedirection || delay <= m_scheduledRedirection->delay) 1163 scheduleRedirection(new ScheduledRedirection(delay, url, d oLockHistory));1165 scheduleRedirection(new ScheduledRedirection(delay, url, delay <= 1, delay > 1)); 1164 1166 } 1165 1167 … … 1284 1286 if (redirection->historySteps == 0) { 1285 1287 // Special case for go(0) from a frame -> reload only the frame 1286 urlSelected(m_URL, "", 0 );1288 urlSelected(m_URL, "", 0, redirection->lockHistory, redirection->wasUserGesture); 1287 1289 return; 1288 1290 } … … 2829 2831 } 2830 2832 2831 void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event )2833 void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event, bool userGesture) 2832 2834 { 2833 2835 FrameLoadRequest copy = request; … … 2835 2837 copy.resourceRequest().setHTTPReferrer(m_outgoingReferrer); 2836 2838 2837 // FIXME: Why do we always pass true for userGesture? 2838 load(copy, true, event, 0, HashMap<String, String>()); 2839 load(copy, userGesture, event, 0, HashMap<String, String>()); 2839 2840 } 2840 2841 … … 4033 4034 LOG(History, "WebCoreHistory - Updating History for internal load in frame %s", documentLoader()->title().utf8().data()); 4034 4035 #endif 4035 4036 // Add an item to the item tree for this frame 4037 ASSERT(!documentLoader()->isClientRedirect()); 4038 Frame* parentFrame = m_frame->tree()->parent(); 4039 // The only case where parentItem is NULL should be when a parent frame loaded an 4040 // empty URL, which doesn't set up a current item in that parent. 4041 if (parentFrame) { 4042 if (parentFrame->loader()->m_currentHistoryItem) 4043 parentFrame->loader()->m_currentHistoryItem->addChildItem(createHistoryItem(true)); 4036 4037 if (documentLoader()->isClientRedirect()) { 4038 m_currentHistoryItem->setURL(documentLoader()->URL()); 4039 m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request()); 4044 4040 } else { 4045 // See 3556159. It's not clear if it's valid to be in FrameLoadTypeOnLoadEvent 4046 // for a top-level frame, but that was a likely explanation for those crashes, 4047 // so let's guard against it. 4048 // ...and all FrameLoadTypeOnLoadEvent uses were folded to WebFrameLoadTypeInternal 4049 LOG_ERROR("No parent frame in transitionToCommitted:, FrameLoadTypeInternal"); 4041 // Add an item to the item tree for this frame 4042 Frame* parentFrame = m_frame->tree()->parent(); 4043 // The only case where parentItem is NULL should be when a parent frame loaded an 4044 // empty URL, which doesn't set up a current item in that parent. 4045 if (parentFrame) { 4046 if (parentFrame->loader()->m_currentHistoryItem) 4047 parentFrame->loader()->m_currentHistoryItem->addChildItem(createHistoryItem(true)); 4048 } else { 4049 // See 3556159. It's not clear if it's valid to be in FrameLoadTypeOnLoadEvent 4050 // for a top-level frame, but that was a likely explanation for those crashes, 4051 // so let's guard against it. 4052 // ...and all FrameLoadTypeOnLoadEvent uses were folded to WebFrameLoadTypeInternal 4053 LOG_ERROR("No parent frame in transitionToCommitted:, FrameLoadTypeInternal"); 4054 } 4050 4055 } 4051 4056 } -
trunk/WebCore/loader/FrameLoader.h
r20740 r20813 265 265 266 266 void changeLocation(const String& URL, const String& referrer, bool lockHistory = true, bool userGesture = false); 267 void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory = false);268 void urlSelected(const FrameLoadRequest&, Event* );267 void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory, bool userGesture); 268 void urlSelected(const FrameLoadRequest&, Event*, bool userGesture); 269 269 270 270 bool requestFrame(HTMLFrameOwnerElement*, const String& URL, const AtomicString& frameName); … … 288 288 KURL dataURLBaseFromRequest(const ResourceRequest& request) const; 289 289 290 void scheduleRedirection(double delay, const String& URL , bool lockHistory = true);290 void scheduleRedirection(double delay, const String& URL); 291 291 292 292 void scheduleLocationChange(const String& URL, const String& referrer, bool lockHistory = true, bool userGesture = false);
Note:
See TracChangeset
for help on using the changeset viewer.