Changeset 24353 in webkit
- Timestamp:
- Jul 16, 2007 11:17:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r24346 r24353 1 2007-07-16 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Tests for <rdar://problem/5334483> REGRESSION: JavaScript-induced loads 6 not added to back/forward list 7 8 * fast/history/location-assign-adds-history-item-expected.txt: Added. 9 * fast/history/location-assign-adds-history-item.html: Added. 10 * fast/history/location-href-set-adds-history-item-expected.txt: Added. 11 * fast/history/location-href-set-adds-history-item.html: Added. 12 * fast/history/location-replace-adds-history-item-expected.txt: Added. 13 * fast/history/location-replace-adds-history-item.html: Added. 14 * fast/history/location-set-adds-history-item-expected.txt: Added. 15 * fast/history/location-set-adds-history-item.html: Added. 16 * fast/history/window-open-adds-history-item-expected.txt: Added. 17 * fast/history/window-open-adds-history-item.html: Added. 18 * fast/history/window-open-adds-history-item2-expected.txt: Added. 19 * fast/history/window-open-adds-history-item2.html: Added. 20 * http/tests/navigation/redirect-load-no-form-restoration-expected.txt: 21 Updated results. Adding a history entry here is correct behavior. 22 1 23 2007-07-16 Sam Weinig <sam@webkit.org> 2 24 -
trunk/WebCore/ChangeLog
r24351 r24353 1 2007-07-16 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Fixed <rdar://problem/5334483> REGRESSION: JavaScript-induced 6 window.open loads not added to back/forward list 7 8 I did an audit of our history rules in loading and tried to establish 9 some sane uniformity. 10 11 The uniform rule is: 12 - HTTP redirects and HTTP redirects simulated by <meta http-equiv> 13 add a history item if and only if the redirect takes > 1 second. 14 - Other navigations, including JavaScript navigations, always 15 add a history item, except for location.replace navigations. 16 17 In the future, we'll want to refine the second case to be more like the 18 first. I've filed <rdar://problem/5339292> about that. 19 20 * bindings/js/JSHTMLDocumentCustom.cpp: 21 (WebCore::JSHTMLDocument::setLocation): Don't pass 'true' for 22 userGesture unconditionally. userGesture is used to determine popup 23 blocking, not history item creation. 24 25 * bindings/js/kjs_window.cpp: Pass 'false' for lockHistory in all loads 26 except location.replace, which intends to lock history. 27 28 * loader/FrameLoader.cpp: Distinguish between lockHistory and 29 userGesture. The former determines whether a new history item gets 30 created. The latter determines whether JavaScript can open popup 31 windows. Start passing these variables in functions that used to 32 swallow or conflate them. 33 34 (WebCore::FrameLoader::requestFrame): Pass 'true' for lockHistory here 35 because that's usually correct when setting the 'src' attribute of a 36 child frame, and we want to avoid regressing <rdar://problem/4921797>. 37 38 (WebCore::FrameLoader::load): Use the lockHistory variable to determine 39 whether to start a history-creating load. Using userGesture for this 40 purpose is wrong, as explained above. 41 42 * loader/FrameLoader.h: Renamed one variant of scheduleRedirection to 43 scheduleHTTPRedirection because the behavior there of measuring elapsed 44 time is specific to the HTTP redirection case. 45 46 * page/ContextMenuController.cpp: 47 (WebCore::ContextMenuController::contextMenuItemSelected): lockHistory 48 can always be false here because this navigation is never the result of 49 a redirection. 50 1 51 2007-07-16 Sam Weinig <sam@webkit.org> 2 52 -
trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
r24004 r24353 116 116 str = activeFrame->document()->completeURL(str); 117 117 118 // We always want a new history item when assigning to document.location.119 frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), false, true);118 bool userGesture = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->wasRunByUserGesture(); 119 frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), false, userGesture); 120 120 } 121 121 -
trunk/WebCore/bindings/js/kjs_window.cpp
r24351 r24353 747 747 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture(); 748 748 // We want a new history item if this JS was called via a user gesture 749 impl()->frame()->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), !userGesture, userGesture);749 impl()->frame()->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), false, userGesture); 750 750 } 751 751 } … … 1308 1308 if (!completedURL.isEmpty() && (!completedURL.startsWith("javascript:", false) || (window && window->isSafeScript(exec)))) { 1309 1309 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture(); 1310 frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false /*don't lock history*/, userGesture);1310 frame->loader()->scheduleLocationChange(completedURL, activeFrame->loader()->outgoingReferrer(), false, userGesture); 1311 1311 } 1312 1312 return Window::retrieve(frame); … … 1802 1802 if (!url.url().startsWith("javascript:", false) || (window && window->isSafeScript(exec))) { 1803 1803 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture(); 1804 // We want a new history item if this JS was called via a user gesture 1805 m_frame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), !userGesture, userGesture); 1804 m_frame->loader()->scheduleLocationChange(url.url(), activeFrame->loader()->outgoingReferrer(), false, userGesture); 1806 1805 } 1807 1806 } … … 1828 1827 if (!str.startsWith("javascript:", false) || (window && window->isSafeScript(exec))) { 1829 1828 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture(); 1830 frame->loader()->scheduleLocationChange(p->loader()->completeURL(str).url(), p->loader()->outgoingReferrer(), true /*lock history*/, userGesture);1829 frame->loader()->scheduleLocationChange(p->loader()->completeURL(str).url(), p->loader()->outgoingReferrer(), true, userGesture); 1831 1830 } 1832 1831 } … … 1851 1850 bool userGesture = static_cast<ScriptInterpreter *>(exec->dynamicInterpreter())->wasRunByUserGesture(); 1852 1851 // We want a new history item if this JS was called via a user gesture 1853 frame->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), !userGesture, userGesture);1852 frame->loader()->scheduleLocationChange(dstUrl, p->loader()->outgoingReferrer(), false, userGesture); 1854 1853 } 1855 1854 } -
trunk/WebCore/dom/Document.cpp
r24238 r24353 1746 1746 else 1747 1747 url = completeURL(url); 1748 frame->loader()->schedule Redirection(delay, url);1748 frame->loader()->scheduleHTTPRedirection(delay, url); 1749 1749 } 1750 1750 } else if (equalIgnoringCase(equiv, "set-cookie")) { -
trunk/WebCore/loader/FrameLoader.cpp
r24299 r24353 291 291 if (Frame* frame = m_frame->tree()->find(request.frameName())) { 292 292 if (!request.resourceRequest().url().isEmpty()) 293 frame->loader()->load(request, true, 0, 0, HashMap<String, String>());293 frame->loader()->load(request, false, true, 0, 0, HashMap<String, String>()); 294 294 if (Page* page = frame->page()) 295 295 page->chrome()->focus(); … … 397 397 frameRequest.resourceRequest().setHTTPReferrer(m_outgoingReferrer); 398 398 399 urlSelected(frameRequest, triggeringEvent, userGesture);399 urlSelected(frameRequest, triggeringEvent, lockHistory, userGesture); 400 400 } 401 401 … … 421 421 Frame* frame = m_frame->tree()->child(frameName); 422 422 if (frame) 423 frame->loader()->scheduleLocationChange(url.url(), m_outgoingReferrer, false, userGestureHint());423 frame->loader()->scheduleLocationChange(url.url(), m_outgoingReferrer, true, userGestureHint()); 424 424 else 425 425 frame = loadSubframe(ownerElement, url, frameName, m_outgoingReferrer); … … 833 833 URL = m_frame->document()->completeURL(URL); 834 834 835 schedule Redirection(delay, URL);835 scheduleHTTPRedirection(delay, URL); 836 836 } 837 837 … … 1244 1244 } 1245 1245 1246 void FrameLoader::schedule Redirection(double delay, const String& url)1246 void FrameLoader::scheduleHTTPRedirection(double delay, const String& url) 1247 1247 { 1248 1248 if (delay < 0 || delay > INT_MAX / 1000) 1249 1249 return; 1250 1250 1251 // We want a new history item if the refresh timeout > 1 second. We accomplish this 1252 // by pretending a slow redirect is a user gesture and passing false for lockHistory 1251 // We want a new history item if the refresh timeout is > 1 second. 1253 1252 if (!m_scheduledRedirection || delay <= m_scheduledRedirection->delay) 1254 scheduleRedirection(new ScheduledRedirection(delay, url, delay <= 1, delay > 1));1253 scheduleRedirection(new ScheduledRedirection(delay, url, delay <= 1, false)); 1255 1254 } 1256 1255 … … 1786 1785 void FrameLoader::load(const KURL& URL, Event* event) 1787 1786 { 1788 load(ResourceRequest(URL), true, event, 0, HashMap<String, String>());1789 } 1790 1791 void FrameLoader::load(const FrameLoadRequest& request, bool userGesture, Event* event,1787 load(ResourceRequest(URL), false, true, event, 0, HashMap<String, String>()); 1788 } 1789 1790 void FrameLoader::load(const FrameLoadRequest& request, bool lockHistory, bool userGesture, Event* event, 1792 1791 HTMLFormElement* submitForm, const HashMap<String, String>& formValues) 1793 1792 { … … 1819 1818 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) 1820 1819 loadType = FrameLoadTypeReload; 1821 else if ( !userGesture)1820 else if (lockHistory) 1822 1821 loadType = FrameLoadTypeInternal; 1823 1822 else … … 2960 2959 } 2961 2960 2962 // FIXME: W hy do we always pass true for userGesture?2963 load(request, true, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted);2961 // FIXME: We should probably call userGestureHint() to tell whether this form submission was the result of a user gesture. 2962 load(request, false, true, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted); 2964 2963 2965 2964 clearRecordedFormValues(); 2966 2965 } 2967 2966 2968 void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event, bool userGesture)2967 void FrameLoader::urlSelected(const FrameLoadRequest& request, Event* event, bool lockHistory, bool userGesture) 2969 2968 { 2970 2969 FrameLoadRequest copy = request; … … 2972 2971 copy.resourceRequest().setHTTPReferrer(m_outgoingReferrer); 2973 2972 2974 load(copy, userGesture, event, 0, HashMap<String, String>());2973 load(copy, lockHistory, userGesture, event, 0, HashMap<String, String>()); 2975 2974 } 2976 2975 -
trunk/WebCore/loader/FrameLoader.h
r24276 r24353 142 142 void finalSetupForReplace(DocumentLoader*); 143 143 void load(const KURL&, Event*); 144 void load(const FrameLoadRequest&, bool userGesture,144 void load(const FrameLoadRequest&, bool lockHistory, bool userGesture, 145 145 Event*, HTMLFormElement*, const HashMap<String, String>& formValues); 146 146 void load(const KURL&, const String& referrer, FrameLoadType, const String& target, … … 276 276 void changeLocation(const KURL& URL, const String& referrer, bool lockHistory = true, bool userGesture = false); 277 277 void urlSelected(const ResourceRequest&, const String& target, Event*, bool lockHistory, bool userGesture); 278 void urlSelected(const FrameLoadRequest&, Event*, bool userGesture);278 void urlSelected(const FrameLoadRequest&, Event*, bool lockHistory, bool userGesture); 279 279 280 280 bool requestFrame(HTMLFrameOwnerElement*, const String& URL, const AtomicString& frameName); … … 298 298 KURL dataURLBaseFromRequest(const ResourceRequest& request) const; 299 299 300 void scheduleRedirection(double delay, const String& URL);301 300 bool isScheduledLocationChangePending() const; 301 void scheduleHTTPRedirection(double delay, const String& URL); 302 302 void scheduleLocationChange(const String& URL, const String& referrer, bool lockHistory = true, bool userGesture = false); 303 303 void scheduleRefresh(bool userGesture = false); 304 bool isScheduledLocationChangePending() const;305 306 304 void scheduleHistoryNavigation(int steps); 307 305 -
trunk/WebCore/page/ContextMenuController.cpp
r24156 r24353 203 203 if (Frame* targetFrame = result.targetFrame()) 204 204 targetFrame->loader()->load(FrameLoadRequest(ResourceRequest(result.absoluteLinkURL(), 205 frame->loader()->outgoingReferrer())), true, 0, 0, HashMap<String, String>());205 frame->loader()->outgoingReferrer())), false, true, 0, 0, HashMap<String, String>()); 206 206 else 207 207 openNewWindow(result.absoluteLinkURL(), frame);
Note: See TracChangeset
for help on using the changeset viewer.