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

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

Issue 414223004: Implement NavigationScheduler::schedulePageBlock() as a redirect to empty substitute data. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/xss-protection-parsing-04-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
41 #include "core/inspector/InspectorInstrumentation.h" 41 #include "core/inspector/InspectorInstrumentation.h"
42 #include "core/loader/DocumentLoader.h" 42 #include "core/loader/DocumentLoader.h"
43 #include "core/loader/FormState.h" 43 #include "core/loader/FormState.h"
44 #include "core/loader/FormSubmission.h" 44 #include "core/loader/FormSubmission.h"
45 #include "core/loader/FrameLoadRequest.h" 45 #include "core/loader/FrameLoadRequest.h"
46 #include "core/loader/FrameLoader.h" 46 #include "core/loader/FrameLoader.h"
47 #include "core/loader/FrameLoaderClient.h" 47 #include "core/loader/FrameLoaderClient.h"
48 #include "core/loader/FrameLoaderStateMachine.h" 48 #include "core/loader/FrameLoaderStateMachine.h"
49 #include "core/page/BackForwardClient.h" 49 #include "core/page/BackForwardClient.h"
50 #include "core/page/Page.h" 50 #include "core/page/Page.h"
51 #include "platform/SharedBuffer.h"
51 #include "platform/UserGestureIndicator.h" 52 #include "platform/UserGestureIndicator.h"
52 #include "wtf/CurrentTime.h" 53 #include "wtf/CurrentTime.h"
53 54
54 namespace blink { 55 namespace blink {
55 56
56 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; 57 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0;
57 58
58 class ScheduledNavigation { 59 class ScheduledNavigation {
59 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED; 60 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED;
60 public: 61 public:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 virtual void fire(LocalFrame* frame) OVERRIDE 168 virtual void fire(LocalFrame* frame) OVERRIDE
168 { 169 {
169 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or(); 170 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
170 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self"); 171 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), "_self");
171 request.setLockBackForwardList(lockBackForwardList()); 172 request.setLockBackForwardList(lockBackForwardList());
172 request.setClientRedirect(ClientRedirect); 173 request.setClientRedirect(ClientRedirect);
173 frame->loader().load(request); 174 frame->loader().load(request);
174 } 175 }
175 }; 176 };
176 177
178 class ScheduledPageBlock FINAL : public ScheduledURLNavigation {
179 public:
180 ScheduledPageBlock(Document* originDocument, const String& url, const Referr er& referrer)
181 : ScheduledURLNavigation(0.0, originDocument, url, referrer, true, true)
182 {
183 }
184
185 virtual void fire(LocalFrame* frame) OVERRIDE
186 {
187 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat or();
Mike West 2014/07/30 16:57:39 Nit: Do we need a user gesture here?
188 SubstituteData substituteData(SharedBuffer::create(), "text/plain", "UTF -8", KURL(), ForceSynchronousLoad);
189 FrameLoadRequest request(originDocument(), ResourceRequest(KURL(ParsedUR LString, url()), referrer(), ReloadIgnoringCacheData), substituteData);
190 request.setLockBackForwardList(true);
191 request.setClientRedirect(ClientRedirect);
192 frame->loader().load(request);
193 }
194 };
195
177 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation { 196 class ScheduledHistoryNavigation FINAL : public ScheduledNavigation {
178 public: 197 public:
179 explicit ScheduledHistoryNavigation(int historySteps) 198 explicit ScheduledHistoryNavigation(int historySteps)
180 : ScheduledNavigation(0, false, true) 199 : ScheduledNavigation(0, false, true)
181 , m_historySteps(historySteps) 200 , m_historySteps(historySteps)
182 { 201 {
183 } 202 }
184 203
185 virtual void fire(LocalFrame* frame) OVERRIDE 204 virtual void fire(LocalFrame* frame) OVERRIDE
186 { 205 {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 return; 342 return;
324 } 343 }
325 } 344 }
326 345
327 schedule(adoptPtr(new ScheduledLocationChange(originDocument, url, referrer, lockBackForwardList))); 346 schedule(adoptPtr(new ScheduledLocationChange(originDocument, url, referrer, lockBackForwardList)));
328 } 347 }
329 348
330 void NavigationScheduler::schedulePageBlock(Document* originDocument, const Refe rrer& referrer) 349 void NavigationScheduler::schedulePageBlock(Document* originDocument, const Refe rrer& referrer)
331 { 350 {
332 ASSERT(m_frame->page()); 351 ASSERT(m_frame->page());
333 schedule(adoptPtr(new ScheduledLocationChange(originDocument, SecurityOrigin ::urlWithUniqueSecurityOrigin(), referrer, false))); 352 const KURL& url = m_frame->document()->url();
Nate Chapin 2014/07/25 20:33:38 Inline this?
353 schedule(adoptPtr(new ScheduledPageBlock(originDocument, url, referrer)));
334 } 354 }
335 355
336 void NavigationScheduler::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubm ission> submission) 356 void NavigationScheduler::scheduleFormSubmission(PassRefPtrWillBeRawPtr<FormSubm ission> submission)
337 { 357 {
338 ASSERT(m_frame->page()); 358 ASSERT(m_frame->page());
339 schedule(adoptPtr(new ScheduledFormSubmission(submission, mustLockBackForwar dList(m_frame)))); 359 schedule(adoptPtr(new ScheduledFormSubmission(submission, mustLockBackForwar dList(m_frame))));
340 } 360 }
341 361
342 void NavigationScheduler::scheduleRefresh() 362 void NavigationScheduler::scheduleRefresh()
343 { 363 {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 440
421 void NavigationScheduler::cancel() 441 void NavigationScheduler::cancel()
422 { 442 {
423 if (m_timer.isActive()) 443 if (m_timer.isActive())
424 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); 444 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame);
425 m_timer.stop(); 445 m_timer.stop();
426 m_redirect.clear(); 446 m_redirect.clear();
427 } 447 }
428 448
429 } // namespace blink 449 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/xss-protection-parsing-04-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698