Changeset 67716 in webkit
- Timestamp:
- Sep 17, 2010 9:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67715 r67716 1 2010-09-17 Johnny Ding <jnd@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Stop history reload navigation to bypass WebKit's popup blocker. 6 https://bugs.webkit.org/show_bug.cgi?id=45369 7 8 * fast/events/popup-blocked-from-history-reload-expected.txt: Added. 9 * fast/events/popup-blocked-from-history-reload.html: Added. 10 1 11 2010-09-17 Zhenyao Mo <zmo@google.com> 2 12 -
trunk/WebCore/ChangeLog
r67714 r67716 1 2010-09-17 Johnny Ding <jnd@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Stop history reload navigation to bypass WebKit's popup blocker. 6 Now history reload can only navigate the page in self frame, no matter 7 what target frame is defined in <base> and no new window can be created. 8 https://bugs.webkit.org/show_bug.cgi?id=45369 9 10 Test: fast/events/popup-blocked-from-history-reload.html 11 12 * loader/RedirectScheduler.cpp: 13 (WebCore::ScheduledNavigation::ScheduledNavigation): 14 (WebCore::ScheduledNavigation::wasUserGesture): 15 Move the m_wasUserGesture to base class ScheduledNavigation. Then all 16 asynchronous navigation situations can restore the correct gesture state 17 during the real navigation process. 18 (WebCore::ScheduledURLNavigation::ScheduledURLNavigation): 19 (WebCore::ScheduledURLNavigation::fire): 20 (WebCore::ScheduledURLNavigation::referrer): 21 (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation): 22 (WebCore::ScheduledHistoryNavigation::fire): 23 (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): 24 (WebCore::ScheduledFormSubmission::fire): 25 (WebCore::RedirectScheduler::scheduleHistoryNavigation): 26 1 27 2010-09-16 Vangelis Kokkevis <vangelis@chromium.org> 2 28 -
trunk/WebCore/loader/RedirectScheduler.cpp
r66742 r67716 34 34 35 35 #include "BackForwardList.h" 36 #include "DOMWindow.h" 36 37 #include "DocumentLoader.h" 37 38 #include "Event.h" … … 42 43 #include "FrameLoader.h" 43 44 #include "FrameLoaderStateMachine.h" 44 #include "HistoryItem.h"45 45 #include "HTMLFormElement.h" 46 46 #include "HTMLFrameOwnerElement.h" 47 #include "HistoryItem.h" 47 48 #include "Page.h" 48 49 #include "UserGestureIndicator.h" … … 53 54 class ScheduledNavigation : public Noncopyable { 54 55 public: 55 ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange )56 ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange, bool wasUserGesture) 56 57 : m_delay(delay) 57 58 , m_lockHistory(lockHistory) … … 59 60 , m_wasDuringLoad(wasDuringLoad) 60 61 , m_isLocationChange(isLocationChange) 62 , m_wasUserGesture(wasUserGesture) 61 63 { 62 64 } … … 74 76 bool wasDuringLoad() const { return m_wasDuringLoad; } 75 77 bool isLocationChange() const { return m_isLocationChange; } 78 bool wasUserGesture() const { return m_wasUserGesture; } 76 79 77 80 private: … … 81 84 bool m_wasDuringLoad; 82 85 bool m_isLocationChange; 86 bool m_wasUserGesture; 83 87 }; 84 88 … … 86 90 public: 87 91 ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, bool duringLoad, bool isLocationChange) 88 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange )92 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange, wasUserGesture) 89 93 , m_url(url) 90 94 , m_referrer(referrer) 91 , m_wasUserGesture(wasUserGesture)92 95 , m_haveToldClient(false) 93 96 { … … 96 99 virtual void fire(Frame* frame) 97 100 { 98 frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), m_wasUserGesture, false);101 frame->loader()->changeLocation(KURL(ParsedURLString, m_url), m_referrer, lockHistory(), lockBackForwardList(), wasUserGesture(), false); 99 102 } 100 103 … … 116 119 String url() const { return m_url; } 117 120 String referrer() const { return m_referrer; } 118 bool wasUserGesture() const { return m_wasUserGesture; }119 121 120 122 private: 121 123 String m_url; 122 124 String m_referrer; 123 bool m_wasUserGesture;124 125 bool m_haveToldClient; 125 126 }; … … 152 153 class ScheduledHistoryNavigation : public ScheduledNavigation { 153 154 public: 154 explicit ScheduledHistoryNavigation(int historySteps ) : ScheduledNavigation(0, false, false, false, true), m_historySteps(historySteps) { }155 explicit ScheduledHistoryNavigation(int historySteps, bool wasUserGesture) : ScheduledNavigation(0, false, false, false, true, wasUserGesture), m_historySteps(historySteps) { } 155 156 156 157 virtual void fire(Frame* frame) 157 158 { 159 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); 160 158 161 FrameLoader* loader = frame->loader(); 159 162 if (!m_historySteps) { 160 163 // Special case for go(0) from a frame -> reload only the frame 161 loader->urlSelected(loader->url(), "", 0, lockHistory(), lockBackForwardList(), false, SendReferrer); 164 // To follow Firefox and IE's behavior, history reload can only navigate the self frame. 165 loader->urlSelected(loader->url(), "_self", 0, lockHistory(), lockBackForwardList(), wasUserGesture(), SendReferrer); 162 166 return; 163 167 } … … 174 178 public: 175 179 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad, bool wasUserGesture) 176 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true )180 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true, wasUserGesture) 177 181 , m_submission(submission) 178 182 , m_haveToldClient(false) 179 , m_wasUserGesture(wasUserGesture)180 183 { 181 184 ASSERT(m_submission->state()); … … 184 187 virtual void fire(Frame* frame) 185 188 { 186 UserGestureIndicator gestureIndicator( m_wasUserGesture? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);189 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture); 187 190 188 191 // The submitForm function will find a target frame before using the redirection timer. … … 215 218 RefPtr<FormSubmission> m_submission; 216 219 bool m_haveToldClient; 217 bool m_wasUserGesture;218 220 }; 219 221 … … 345 347 return; 346 348 } 347 349 348 350 // In all other cases, schedule the history traversal to occur asynchronously. 349 schedule(adoptPtr(new ScheduledHistoryNavigation(steps )));351 schedule(adoptPtr(new ScheduledHistoryNavigation(steps, m_frame->loader()->isProcessingUserGesture()))); 350 352 } 351 353
Note: See TracChangeset
for help on using the changeset viewer.