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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 frameHost()->eventHandlerRegistry().documentDetached(*this); 2218 frameHost()->eventHandlerRegistry().documentDetached(*this);
2219 2219
2220 m_frame->selection().documentDetached(*this); 2220 m_frame->selection().documentDetached(*this);
2221 m_frame->inputMethodController().documentDetached(); 2221 m_frame->inputMethodController().documentDetached();
2222 2222
2223 // If this Document is associated with a live DocumentLoader, the 2223 // If this Document is associated with a live DocumentLoader, the
2224 // DocumentLoader will take care of clearing the FetchContext. Deferring 2224 // DocumentLoader will take care of clearing the FetchContext. Deferring
2225 // to the DocumentLoader when possible also prevents prematurely clearing 2225 // to the DocumentLoader when possible also prevents prematurely clearing
2226 // the context in the case where multiple Documents end up associated with 2226 // the context in the case where multiple Documents end up associated with
2227 // a single DocumentLoader (e.g., navigating to a javascript: url). 2227 // a single DocumentLoader (e.g., navigating to a javascript: url).
2228 if (!loader()) 2228 if (!loader()) {
2229 m_fetcher->clearPreloads(ResourceFetcher::ClearAllPreloads);
Charlie Harrison 2016/08/04 18:10:26 tentative: can we do this in clearContext()?
Yoav Weiss 2016/08/04 20:26:14 sure. moved
2229 m_fetcher->clearContext(); 2230 m_fetcher->clearContext();
2231 }
2230 // If this document is the master for an HTMLImportsController, sever that 2232 // If this document is the master for an HTMLImportsController, sever that
2231 // relationship. This ensures that we don't leave import loads in flight, 2233 // relationship. This ensures that we don't leave import loads in flight,
2232 // thinking they should have access to a valid frame when they don't. 2234 // thinking they should have access to a valid frame when they don't.
2233 if (m_importsController) { 2235 if (m_importsController) {
2234 m_importsController->dispose(); 2236 m_importsController->dispose();
2235 setImportsController(nullptr); 2237 setImportsController(nullptr);
2236 } 2238 }
2237 2239
2238 m_timers.setTimerTaskRunner( 2240 m_timers.setTimerTaskRunner(
2239 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->cl one()); 2241 Platform::current()->currentThread()->scheduler()->timerTaskRunner()->cl one());
(...skipping 3794 matching lines...) Expand 10 before | Expand all | Expand 10 after
6034 } 6036 }
6035 6037
6036 void showLiveDocumentInstances() 6038 void showLiveDocumentInstances()
6037 { 6039 {
6038 WeakDocumentSet& set = liveDocumentSet(); 6040 WeakDocumentSet& set = liveDocumentSet();
6039 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6041 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6040 for (Document* document : set) 6042 for (Document* document : set)
6041 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6043 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6042 } 6044 }
6043 #endif 6045 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698