Chromium Code Reviews| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 : ScheduledNavigation(delay, lockBackForwardList, isLocationChange) | 100 : ScheduledNavigation(delay, lockBackForwardList, isLocationChange) |
| 101 , m_originDocument(originDocument) | 101 , m_originDocument(originDocument) |
| 102 , m_url(url) | 102 , m_url(url) |
| 103 , m_referrer(referrer) | 103 , m_referrer(referrer) |
| 104 { | 104 { |
| 105 } | 105 } |
| 106 | 106 |
| 107 virtual void fire(Frame* frame) | 107 virtual void fire(Frame* frame) |
| 108 { | 108 { |
| 109 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); | 109 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); |
| 110 FrameLoadRequest request(m_originDocument.get(), ResourceRequest(KURL(Pa rsedURLString, m_url), m_referrer), "_self"); | 110 FrameLoadRequest request(m_originDocument.get(), ResourceRequest(KURL(Pa rsedURLString, m_url), AtomicString(m_referrer)), "_self"); |
| 111 request.setLockBackForwardList(lockBackForwardList()); | 111 request.setLockBackForwardList(lockBackForwardList()); |
| 112 request.setClientRedirect(ClientRedirect); | 112 request.setClientRedirect(ClientRedirect); |
| 113 frame->loader().load(request); | 113 frame->loader().load(request); |
| 114 } | 114 } |
| 115 | 115 |
| 116 Document* originDocument() const { return m_originDocument.get(); } | 116 Document* originDocument() const { return m_originDocument.get(); } |
| 117 String url() const { return m_url; } | 117 String url() const { return m_url; } |
| 118 String referrer() const { return m_referrer; } | 118 String referrer() const { return m_referrer; } |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 RefPtr<Document> m_originDocument; | 121 RefPtr<Document> m_originDocument; |
| 122 String m_url; | 122 String m_url; |
| 123 String m_referrer; | 123 String m_referrer; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 class ScheduledRedirect : public ScheduledURLNavigation { | 126 class ScheduledRedirect : public ScheduledURLNavigation { |
| 127 public: | 127 public: |
| 128 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool lockBackForwardList) | 128 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool lockBackForwardList) |
| 129 : ScheduledURLNavigation(delay, originDocument, url, String(), lockBackF orwardList, false) | 129 : ScheduledURLNavigation(delay, originDocument, url, String(), lockBackF orwardList, false) |
| 130 { | 130 { |
| 131 clearUserGesture(); | 131 clearUserGesture(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 virtual bool shouldStartTimer(Frame* frame) { return frame->loader().allAnce storsAreComplete(); } | 134 virtual bool shouldStartTimer(Frame* frame) { return frame->loader().allAnce storsAreComplete(); } |
| 135 | 135 |
| 136 virtual void fire(Frame* frame) | 136 virtual void fire(Frame* frame) |
| 137 { | 137 { |
| 138 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); | 138 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); |
| 139 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer()), "_self"); | 139 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), AtomicString(referrer())), "_self"); |
|
eseidel
2013/12/31 22:05:03
Is referrer ever used as non AtomicStrings?
Inactive
2013/12/31 22:47:25
The return value of referrer() is always expected
| |
| 140 request.setLockBackForwardList(lockBackForwardList()); | 140 request.setLockBackForwardList(lockBackForwardList()); |
| 141 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) | 141 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) |
| 142 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData); | 142 request.resourceRequest().setCachePolicy(ReloadIgnoringCacheData); |
| 143 request.setClientRedirect(ClientRedirect); | 143 request.setClientRedirect(ClientRedirect); |
| 144 frame->loader().load(request); | 144 frame->loader().load(request); |
| 145 } | 145 } |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class ScheduledLocationChange : public ScheduledURLNavigation { | 148 class ScheduledLocationChange : public ScheduledURLNavigation { |
| 149 public: | 149 public: |
| 150 ScheduledLocationChange(Document* originDocument, const String& url, const S tring& referrer, bool lockBackForwardList) | 150 ScheduledLocationChange(Document* originDocument, const String& url, const S tring& referrer, bool lockBackForwardList) |
| 151 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } | 151 : ScheduledURLNavigation(0.0, originDocument, url, referrer, lockBackFor wardList, true) { } |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 class ScheduledRefresh : public ScheduledURLNavigation { | 154 class ScheduledRefresh : public ScheduledURLNavigation { |
| 155 public: | 155 public: |
| 156 ScheduledRefresh(Document* originDocument, const String& url, const String& referrer) | 156 ScheduledRefresh(Document* originDocument, const String& url, const String& referrer) |
| 157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true) | 157 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true) |
| 158 { | 158 { |
| 159 } | 159 } |
| 160 | 160 |
| 161 virtual void fire(Frame* frame) | 161 virtual void fire(Frame* frame) |
| 162 { | 162 { |
| 163 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); | 163 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); |
| 164 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self"); | 164 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), AtomicString(referrer()), ReloadIgnoringCacheData), "_self"); |
| 165 request.setLockBackForwardList(lockBackForwardList()); | 165 request.setLockBackForwardList(lockBackForwardList()); |
| 166 request.setClientRedirect(ClientRedirect); | 166 request.setClientRedirect(ClientRedirect); |
| 167 frame->loader().load(request); | 167 frame->loader().load(request); |
| 168 } | 168 } |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 class ScheduledHistoryNavigation : public ScheduledNavigation { | 171 class ScheduledHistoryNavigation : public ScheduledNavigation { |
| 172 public: | 172 public: |
| 173 explicit ScheduledHistoryNavigation(int historySteps) | 173 explicit ScheduledHistoryNavigation(int historySteps) |
| 174 : ScheduledNavigation(0, false, true) | 174 : ScheduledNavigation(0, false, true) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 | 301 |
| 302 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame ); | 302 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame ); |
| 303 | 303 |
| 304 // If the URL we're going to navigate to is the same as the current one, exc ept for the | 304 // If the URL we're going to navigate to is the same as the current one, exc ept for the |
| 305 // fragment part, we don't need to schedule the location change. We'll skip this | 305 // fragment part, we don't need to schedule the location change. We'll skip this |
| 306 // optimization for cross-origin navigations to minimize the navigator's abi lity to | 306 // optimization for cross-origin navigations to minimize the navigator's abi lity to |
| 307 // execute timing attacks. | 307 // execute timing attacks. |
| 308 if (originDocument->securityOrigin()->canAccess(m_frame->document()->securit yOrigin())) { | 308 if (originDocument->securityOrigin()->canAccess(m_frame->document()->securit yOrigin())) { |
| 309 KURL parsedURL(ParsedURLString, url); | 309 KURL parsedURL(ParsedURLString, url); |
| 310 if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier (m_frame->document()->url(), parsedURL)) { | 310 if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier (m_frame->document()->url(), parsedURL)) { |
| 311 FrameLoadRequest request(originDocument, ResourceRequest(m_frame->do cument()->completeURL(url), referrer), "_self"); | 311 FrameLoadRequest request(originDocument, ResourceRequest(m_frame->do cument()->completeURL(url), AtomicString(referrer)), "_self"); |
| 312 request.setLockBackForwardList(lockBackForwardList); | 312 request.setLockBackForwardList(lockBackForwardList); |
| 313 request.setClientRedirect(ClientRedirect); | 313 request.setClientRedirect(ClientRedirect); |
| 314 m_frame->loader().load(request); | 314 m_frame->loader().load(request); |
| 315 return; | 315 return; |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 schedule(adoptPtr(new ScheduledLocationChange(originDocument, url, referrer, lockBackForwardList))); | 319 schedule(adoptPtr(new ScheduledLocationChange(originDocument, url, referrer, lockBackForwardList))); |
| 320 } | 320 } |
| 321 | 321 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 | 394 |
| 395 void NavigationScheduler::cancel() | 395 void NavigationScheduler::cancel() |
| 396 { | 396 { |
| 397 if (m_timer.isActive()) | 397 if (m_timer.isActive()) |
| 398 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 398 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
| 399 m_timer.stop(); | 399 m_timer.stop(); |
| 400 m_redirect.clear(); | 400 m_redirect.clear(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace WebCore | 403 } // namespace WebCore |
| OLD | NEW |