Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/loader/NavigationScheduler.cpp

Issue 1843663005: Change bool ignoreCache to WebFrameLoadType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 { 112 {
113 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument)) 113 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument))
114 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur ityPolicy; 114 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur ityPolicy;
115 } 115 }
116 116
117 void fire(LocalFrame* frame) override 117 void fire(LocalFrame* frame) override
118 { 118 {
119 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 119 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
120 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck MainWorldContentSecurityPolicy); 120 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck MainWorldContentSecurityPolicy);
121 request.setReplacesCurrentItem(replacesCurrentItem()); 121 request.setReplacesCurrentItem(replacesCurrentItem());
122 request.setClientRedirect(ClientRedirect); 122 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
123 frame->loader().load(request); 123 frame->loader().load(request);
124 } 124 }
125 125
126 String url() const { return m_url; } 126 String url() const { return m_url; }
127 127
128 private: 128 private:
129 String m_url; 129 String m_url;
130 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy ; 130 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy ;
131 }; 131 };
132 132
133 class ScheduledRedirect final : public ScheduledURLNavigation { 133 class ScheduledRedirect final : public ScheduledURLNavigation {
134 public: 134 public:
135 static RawPtr<ScheduledRedirect> create(double delay, Document* originDocume nt, const String& url, bool replacesCurrentItem) 135 static RawPtr<ScheduledRedirect> create(double delay, Document* originDocume nt, const String& url, bool replacesCurrentItem)
136 { 136 {
137 return new ScheduledRedirect(delay, originDocument, url, replacesCurrent Item); 137 return new ScheduledRedirect(delay, originDocument, url, replacesCurrent Item);
138 } 138 }
139 139
140 bool shouldStartTimer(LocalFrame* frame) override { return frame->document() ->loadEventFinished(); } 140 bool shouldStartTimer(LocalFrame* frame) override { return frame->document() ->loadEventFinished(); }
141 141
142 void fire(LocalFrame* frame) override 142 void fire(LocalFrame* frame) override
143 { 143 {
144 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 144 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
145 FrameLoadRequest request(originDocument(), url(), "_self"); 145 FrameLoadRequest request(originDocument(), url(), "_self");
146 request.setReplacesCurrentItem(replacesCurrentItem()); 146 request.setReplacesCurrentItem(replacesCurrentItem());
147 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url())) 147 if (equalIgnoringFragmentIdentifier(frame->document()->url(), request.re sourceRequest().url()))
148 request.resourceRequest().setCachePolicy(ValidatingCacheData); 148 request.resourceRequest().setCachePolicy(ValidatingCacheData);
149 request.setClientRedirect(ClientRedirect); 149 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
150 frame->loader().load(request); 150 frame->loader().load(request);
151 } 151 }
152 152
153 private: 153 private:
154 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool replacesCurrentItem) 154 ScheduledRedirect(double delay, Document* originDocument, const String& url, bool replacesCurrentItem)
155 : ScheduledURLNavigation(delay, originDocument, url, replacesCurrentItem , false) 155 : ScheduledURLNavigation(delay, originDocument, url, replacesCurrentItem , false)
156 { 156 {
157 clearUserGesture(); 157 clearUserGesture();
158 } 158 }
159 }; 159 };
(...skipping 13 matching lines...) Expand all
173 class ScheduledReload final : public ScheduledNavigation { 173 class ScheduledReload final : public ScheduledNavigation {
174 public: 174 public:
175 static RawPtr<ScheduledReload> create() 175 static RawPtr<ScheduledReload> create()
176 { 176 {
177 return new ScheduledReload; 177 return new ScheduledReload;
178 } 178 }
179 179
180 void fire(LocalFrame* frame) override 180 void fire(LocalFrame* frame) override
181 { 181 {
182 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 182 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
183 ResourceRequest resourceRequest = 183 ResourceRequest resourceRequest = frame->loader().resourceRequestForRelo ad(FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirect);
184 frame->loader().resourceRequestForReload(FrameLoadTypeReload, KURL() , ClientRedirect);
185 if (resourceRequest.isNull()) 184 if (resourceRequest.isNull())
186 return; 185 return;
187 FrameLoadRequest request = FrameLoadRequest(nullptr, resourceRequest); 186 FrameLoadRequest request = FrameLoadRequest(nullptr, resourceRequest);
188 request.setClientRedirect(ClientRedirect); 187 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
189 frame->loader().load(request, FrameLoadTypeReload); 188 frame->loader().load(request, FrameLoadTypeReload);
190 } 189 }
191 190
192 private: 191 private:
193 ScheduledReload() 192 ScheduledReload()
194 : ScheduledNavigation(0.0, nullptr, true, true) 193 : ScheduledNavigation(0.0, nullptr, true, true)
195 { 194 {
196 } 195 }
197 }; 196 };
198 197
199 class ScheduledPageBlock final : public ScheduledURLNavigation { 198 class ScheduledPageBlock final : public ScheduledURLNavigation {
200 public: 199 public:
201 static RawPtr<ScheduledPageBlock> create(Document* originDocument, const Str ing& url) 200 static RawPtr<ScheduledPageBlock> create(Document* originDocument, const Str ing& url)
202 { 201 {
203 return new ScheduledPageBlock(originDocument, url); 202 return new ScheduledPageBlock(originDocument, url);
204 } 203 }
205 204
206 void fire(LocalFrame* frame) override 205 void fire(LocalFrame* frame) override
207 { 206 {
208 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 207 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
209 SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF -8", KURL(), ForceSynchronousLoad); 208 SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF -8", KURL(), ForceSynchronousLoad);
210 FrameLoadRequest request(originDocument(), url(), substituteData); 209 FrameLoadRequest request(originDocument(), url(), substituteData);
211 request.setReplacesCurrentItem(true); 210 request.setReplacesCurrentItem(true);
212 request.setClientRedirect(ClientRedirect); 211 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
213 frame->loader().load(request); 212 frame->loader().load(request);
214 } 213 }
215 private: 214 private:
216 ScheduledPageBlock(Document* originDocument, const String& url) 215 ScheduledPageBlock(Document* originDocument, const String& url)
217 : ScheduledURLNavigation(0.0, originDocument, url, true, true) 216 : ScheduledURLNavigation(0.0, originDocument, url, true, true)
218 { 217 {
219 } 218 }
220 219
221 }; 220 };
222 221
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // If the URL we're going to navigate to is the same as the current one, exc ept for the 326 // If the URL we're going to navigate to is the same as the current one, exc ept for the
328 // fragment part, we don't need to schedule the location change. We'll skip this 327 // fragment part, we don't need to schedule the location change. We'll skip this
329 // optimization for cross-origin navigations to minimize the navigator's abi lity to 328 // optimization for cross-origin navigations to minimize the navigator's abi lity to
330 // execute timing attacks. 329 // execute timing attacks.
331 if (originDocument->getSecurityOrigin()->canAccess(m_frame->document()->getS ecurityOrigin())) { 330 if (originDocument->getSecurityOrigin()->canAccess(m_frame->document()->getS ecurityOrigin())) {
332 KURL parsedURL(ParsedURLString, url); 331 KURL parsedURL(ParsedURLString, url);
333 if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier (m_frame->document()->url(), parsedURL)) { 332 if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier (m_frame->document()->url(), parsedURL)) {
334 FrameLoadRequest request(originDocument, m_frame->document()->comple teURL(url), "_self"); 333 FrameLoadRequest request(originDocument, m_frame->document()->comple teURL(url), "_self");
335 request.setReplacesCurrentItem(replacesCurrentItem); 334 request.setReplacesCurrentItem(replacesCurrentItem);
336 if (replacesCurrentItem) 335 if (replacesCurrentItem)
337 request.setClientRedirect(ClientRedirect); 336 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect);
338 m_frame->loader().load(request); 337 m_frame->loader().load(request);
339 return; 338 return;
340 } 339 }
341 } 340 }
342 341
343 schedule(ScheduledLocationChange::create(originDocument, url, replacesCurren tItem)); 342 schedule(ScheduledLocationChange::create(originDocument, url, replacesCurren tItem));
344 } 343 }
345 344
346 void NavigationScheduler::schedulePageBlock(Document* originDocument) 345 void NavigationScheduler::schedulePageBlock(Document* originDocument)
347 { 346 {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 m_redirect.clear(); 431 m_redirect.clear();
433 } 432 }
434 433
435 DEFINE_TRACE(NavigationScheduler) 434 DEFINE_TRACE(NavigationScheduler)
436 { 435 {
437 visitor->trace(m_frame); 436 visitor->trace(m_frame);
438 visitor->trace(m_redirect); 437 visitor->trace(m_redirect);
439 } 438 }
440 439
441 } // namespace blink 440 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | third_party/WebKit/Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698