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

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

Issue 2174563003: Clear all preloads when document is detached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issues inside clearPreloads and add tests Created 4 years, 4 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 565
566 // It never makes sense to have a document loader that is detached from its 566 // It never makes sense to have a document loader that is detached from its
567 // frame have any loads active, so go ahead and kill all the loads. 567 // frame have any loads active, so go ahead and kill all the loads.
568 m_fetcher->stopFetching(); 568 m_fetcher->stopFetching();
569 569
570 // If that load cancellation triggered another detach, leave. 570 // If that load cancellation triggered another detach, leave.
571 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.) 571 // (fast/frames/detach-frame-nested-no-crash.html is an example of this.)
572 if (!m_frame) 572 if (!m_frame)
573 return; 573 return;
574 574
575 m_fetcher->clearPreloads(ResourceFetcher::ClearAllPreloads);
575 m_fetcher->clearContext(); 576 m_fetcher->clearContext();
576 m_applicationCacheHost->detachFromDocumentLoader(); 577 m_applicationCacheHost->detachFromDocumentLoader();
577 m_applicationCacheHost.clear(); 578 m_applicationCacheHost.clear();
578 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this); 579 WeakIdentifierMap<DocumentLoader>::notifyObjectDestroyed(this);
579 clearMainResourceHandle(); 580 clearMainResourceHandle();
580 m_frame = nullptr; 581 m_frame = nullptr;
581 } 582 }
582 583
583 void DocumentLoader::clearMainResourceHandle() 584 void DocumentLoader::clearMainResourceHandle()
584 { 585 {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 { 714 {
714 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); 715 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing);
715 if (!source.isNull()) 716 if (!source.isNull())
716 m_writer->appendReplacingData(source); 717 m_writer->appendReplacingData(source);
717 endWriting(m_writer.get()); 718 endWriting(m_writer.get());
718 } 719 }
719 720
720 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 721 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
721 722
722 } // namespace blink 723 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698