OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
5 * Copyright (C) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * | 10 * |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoa
d, isLocationChange) | 99 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoa
d, isLocationChange) |
100 , m_securityOrigin(securityOrigin) | 100 , m_securityOrigin(securityOrigin) |
101 , m_url(url) | 101 , m_url(url) |
102 , m_referrer(referrer) | 102 , m_referrer(referrer) |
103 , m_haveToldClient(false) | 103 , m_haveToldClient(false) |
104 { | 104 { |
105 } | 105 } |
106 | 106 |
107 virtual void fire(Frame* frame) | 107 virtual void fire(Frame* frame) |
108 { | 108 { |
109 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 109 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
110 frame->loader()->changeLocation(m_securityOrigin.get(), KURL(ParsedURLSt
ring, m_url), m_referrer, lockHistory(), lockBackForwardList(), false); | 110 frame->loader()->changeLocation(m_securityOrigin.get(), KURL(ParsedURLSt
ring, m_url), m_referrer, lockHistory(), lockBackForwardList(), false); |
111 } | 111 } |
112 | 112 |
113 virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) | 113 virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) |
114 { | 114 { |
115 if (m_haveToldClient) | 115 if (m_haveToldClient) |
116 return; | 116 return; |
117 m_haveToldClient = true; | 117 m_haveToldClient = true; |
118 | 118 |
119 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 119 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
120 frame->loader()->clientRedirected(KURL(ParsedURLString, m_url), delay(),
currentTime() + timer->nextFireInterval(), lockBackForwardList()); | 120 frame->loader()->clientRedirected(KURL(ParsedURLString, m_url), delay(),
currentTime() + timer->nextFireInterval(), lockBackForwardList()); |
121 } | 121 } |
122 | 122 |
123 virtual void didStopTimer(Frame* frame, bool newLoadInProgress) | 123 virtual void didStopTimer(Frame* frame, bool newLoadInProgress) |
124 { | 124 { |
125 if (!m_haveToldClient) | 125 if (!m_haveToldClient) |
126 return; | 126 return; |
127 | 127 |
128 // Do not set a UserGestureIndicator because | 128 // Do not set a UserGestureIndicator because |
129 // clientRedirectCancelledOrFinished() is also called from many places | 129 // clientRedirectCancelledOrFinished() is also called from many places |
(...skipping 20 matching lines...) Expand all Loading... |
150 ScheduledRedirect(double delay, SecurityOrigin* securityOrigin, const String
& url, bool lockHistory, bool lockBackForwardList) | 150 ScheduledRedirect(double delay, SecurityOrigin* securityOrigin, const String
& url, bool lockHistory, bool lockBackForwardList) |
151 : ScheduledURLNavigation(delay, securityOrigin, url, String(), lockHisto
ry, lockBackForwardList, false, false) | 151 : ScheduledURLNavigation(delay, securityOrigin, url, String(), lockHisto
ry, lockBackForwardList, false, false) |
152 { | 152 { |
153 clearUserGesture(); | 153 clearUserGesture(); |
154 } | 154 } |
155 | 155 |
156 virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAnc
estorsAreComplete(); } | 156 virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAnc
estorsAreComplete(); } |
157 | 157 |
158 virtual void fire(Frame* frame) | 158 virtual void fire(Frame* frame) |
159 { | 159 { |
160 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 160 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
161 bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(),
KURL(ParsedURLString, url())); | 161 bool refresh = equalIgnoringFragmentIdentifier(frame->document()->url(),
KURL(ParsedURLString, url())); |
162 frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString,
url()), referrer(), lockHistory(), lockBackForwardList(), refresh); | 162 frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString,
url()), referrer(), lockHistory(), lockBackForwardList(), refresh); |
163 } | 163 } |
164 }; | 164 }; |
165 | 165 |
166 class ScheduledLocationChange : public ScheduledURLNavigation { | 166 class ScheduledLocationChange : public ScheduledURLNavigation { |
167 public: | 167 public: |
168 ScheduledLocationChange(SecurityOrigin* securityOrigin, const String& url, c
onst String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLo
ad) | 168 ScheduledLocationChange(SecurityOrigin* securityOrigin, const String& url, c
onst String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLo
ad) |
169 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, lockHistory
, lockBackForwardList, duringLoad, true) { } | 169 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, lockHistory
, lockBackForwardList, duringLoad, true) { } |
170 }; | 170 }; |
171 | 171 |
172 class ScheduledRefresh : public ScheduledURLNavigation { | 172 class ScheduledRefresh : public ScheduledURLNavigation { |
173 public: | 173 public: |
174 ScheduledRefresh(SecurityOrigin* securityOrigin, const String& url, const St
ring& referrer) | 174 ScheduledRefresh(SecurityOrigin* securityOrigin, const String& url, const St
ring& referrer) |
175 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, true, true,
false, true) | 175 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, true, true,
false, true) |
176 { | 176 { |
177 } | 177 } |
178 | 178 |
179 virtual void fire(Frame* frame) | 179 virtual void fire(Frame* frame) |
180 { | 180 { |
181 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 181 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
182 frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString,
url()), referrer(), lockHistory(), lockBackForwardList(), true); | 182 frame->loader()->changeLocation(securityOrigin(), KURL(ParsedURLString,
url()), referrer(), lockHistory(), lockBackForwardList(), true); |
183 } | 183 } |
184 }; | 184 }; |
185 | 185 |
186 class ScheduledHistoryNavigation : public ScheduledNavigation { | 186 class ScheduledHistoryNavigation : public ScheduledNavigation { |
187 public: | 187 public: |
188 explicit ScheduledHistoryNavigation(int historySteps) | 188 explicit ScheduledHistoryNavigation(int historySteps) |
189 : ScheduledNavigation(0, false, false, false, true) | 189 : ScheduledNavigation(0, false, false, false, true) |
190 , m_historySteps(historySteps) | 190 , m_historySteps(historySteps) |
191 { | 191 { |
192 } | 192 } |
193 | 193 |
194 virtual void fire(Frame* frame) | 194 virtual void fire(Frame* frame) |
195 { | 195 { |
196 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 196 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
197 | 197 |
198 if (!m_historySteps) { | 198 if (!m_historySteps) { |
199 // Special case for go(0) from a frame -> reload only the frame | 199 // Special case for go(0) from a frame -> reload only the frame |
200 // To follow Firefox and IE's behavior, history reload can only navi
gate the self frame. | 200 // To follow Firefox and IE's behavior, history reload can only navi
gate the self frame. |
201 frame->loader()->urlSelected(frame->document()->url(), "_self", 0, l
ockHistory(), lockBackForwardList(), MaybeSendReferrer); | 201 frame->loader()->urlSelected(frame->document()->url(), "_self", 0, l
ockHistory(), lockBackForwardList(), MaybeSendReferrer); |
202 return; | 202 return; |
203 } | 203 } |
204 // go(i!=0) from a frame navigates into the history of the frame only, | 204 // go(i!=0) from a frame navigates into the history of the frame only, |
205 // in both IE and NS (but not in Mozilla). We can't easily do that. | 205 // in both IE and NS (but not in Mozilla). We can't easily do that. |
206 frame->page()->backForward()->goBackOrForward(m_historySteps); | 206 frame->page()->backForward()->goBackOrForward(m_historySteps); |
207 } | 207 } |
208 | 208 |
209 private: | 209 private: |
210 int m_historySteps; | 210 int m_historySteps; |
211 }; | 211 }; |
212 | 212 |
213 class ScheduledFormSubmission : public ScheduledNavigation { | 213 class ScheduledFormSubmission : public ScheduledNavigation { |
214 public: | 214 public: |
215 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBack
ForwardList, bool duringLoad) | 215 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBack
ForwardList, bool duringLoad) |
216 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList,
duringLoad, true) | 216 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList,
duringLoad, true) |
217 , m_submission(submission) | 217 , m_submission(submission) |
218 , m_haveToldClient(false) | 218 , m_haveToldClient(false) |
219 { | 219 { |
220 ASSERT(m_submission->state()); | 220 ASSERT(m_submission->state()); |
221 } | 221 } |
222 | 222 |
223 virtual void fire(Frame* frame) | 223 virtual void fire(Frame* frame) |
224 { | 224 { |
225 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 225 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
226 | 226 |
227 // The submitForm function will find a target frame before using the red
irection timer. | 227 // The submitForm function will find a target frame before using the red
irection timer. |
228 // Now that the timer has fired, we need to repeat the security check wh
ich normally is done when | 228 // Now that the timer has fired, we need to repeat the security check wh
ich normally is done when |
229 // selecting a target, in case conditions have changed. Other code paths
avoid this by targeting | 229 // selecting a target, in case conditions have changed. Other code paths
avoid this by targeting |
230 // without leaving a time window. If we fail the check just silently dro
p the form submission. | 230 // without leaving a time window. If we fail the check just silently dro
p the form submission. |
231 Document* requestingDocument = m_submission->state()->sourceDocument(); | 231 Document* requestingDocument = m_submission->state()->sourceDocument(); |
232 if (!requestingDocument->canNavigate(frame)) | 232 if (!requestingDocument->canNavigate(frame)) |
233 return; | 233 return; |
234 FrameLoadRequest frameRequest(requestingDocument->document()->securityOr
igin()); | 234 FrameLoadRequest frameRequest(requestingDocument->document()->securityOr
igin()); |
235 m_submission->populateFrameLoadRequest(frameRequest); | 235 m_submission->populateFrameLoadRequest(frameRequest); |
236 frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackF
orwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer); | 236 frame->loader()->loadFrameRequest(frameRequest, lockHistory(), lockBackF
orwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer); |
237 } | 237 } |
238 | 238 |
239 virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) | 239 virtual void didStartTimer(Frame* frame, Timer<NavigationScheduler>* timer) |
240 { | 240 { |
241 if (m_haveToldClient) | 241 if (m_haveToldClient) |
242 return; | 242 return; |
243 m_haveToldClient = true; | 243 m_haveToldClient = true; |
244 | 244 |
245 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingUserGesture : DefinitelyNotProcessingUserGesture); | 245 UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProce
ssingNewUserGesture : DefinitelyNotProcessingUserGesture); |
246 frame->loader()->clientRedirected(m_submission->requestURL(), delay(), c
urrentTime() + timer->nextFireInterval(), lockBackForwardList()); | 246 frame->loader()->clientRedirected(m_submission->requestURL(), delay(), c
urrentTime() + timer->nextFireInterval(), lockBackForwardList()); |
247 } | 247 } |
248 | 248 |
249 virtual void didStopTimer(Frame* frame, bool newLoadInProgress) | 249 virtual void didStopTimer(Frame* frame, bool newLoadInProgress) |
250 { | 250 { |
251 if (!m_haveToldClient) | 251 if (!m_haveToldClient) |
252 return; | 252 return; |
253 | 253 |
254 // Do not set a UserGestureIndicator because | 254 // Do not set a UserGestureIndicator because |
255 // clientRedirectCancelledOrFinished() is also called from many places | 255 // clientRedirectCancelledOrFinished() is also called from many places |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (m_timer.isActive()) | 474 if (m_timer.isActive()) |
475 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 475 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
476 m_timer.stop(); | 476 m_timer.stop(); |
477 | 477 |
478 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); | 478 OwnPtr<ScheduledNavigation> redirect(m_redirect.release()); |
479 if (redirect) | 479 if (redirect) |
480 redirect->didStopTimer(m_frame, newLoadInProgress); | 480 redirect->didStopTimer(m_frame, newLoadInProgress); |
481 } | 481 } |
482 | 482 |
483 } // namespace WebCore | 483 } // namespace WebCore |
OLD | NEW |