ChangeLog

 12011-08-01 Scott Graham <scottmg@chromium.org>
 2
 3 REGRESSION (r39725?): Resources removed from document can not be freed until the document is deleted
 4 https://bugs.webkit.org/show_bug.cgi?id=61006
 5
 6 Reviewed by Antti Koivisto.
 7
 8 Update exports for test harness.
 9
 10 * Source/autotools/symbols.filter:
 11
1122011-08-01 Hayato Ito <hayato@chromium.org>
213
314 Add support for getting an element in shadow root by its id into a window.internals object.

LayoutTests/ChangeLog

 12011-08-01 Scott Graham <scottmg@chromium.org>
 2
 3 https://bugs.webkit.org/show_bug.cgi?id=61006
 4
 5 Test for CachedResourceLoader. Not caused by cache-disabling but very
 6 difficult to reproduce when cache is active, so use cache disable in
 7 inspector to exercise code.
 8
 9 Reviewed by Antti Koivisto.
 10
 11 * http/tests/inspector/network/disabled-cache-crash-expected.txt: Added.
 12 * http/tests/inspector/network/disabled-cache-crash.html: Added.
 13 * platform/gtk/Skipped:
 14 * platform/mac/Skipped:
 15 * platform/qt/Skipped:
 16 * platform/win/Skipped:
 17
1182011-08-01 Anders Carlsson <andersca@apple.com>
219
320 Add fast/forms/selection-direction.html to the Skipped list.

LayoutTests/http/tests/inspector/network/disabled-cache-crash-expected.txt

 1CONSOLE MESSAGE: line 20: window 1 ok
 2CONSOLE MESSAGE: line 26: window 2 ok
 3

LayoutTests/http/tests/inspector/network/disabled-cache-crash.html

 1<html>
 2<head>
 3<script type="text/javascript">
 4 if (window.layoutTestController)
 5 layoutTestController.setCanOpenWindows();
 6
 7 var ga = document.createElement('script');
 8 ga.type = 'text/javascript';
 9 ga.async = true;
 10 ga.src = 'script.js';
 11 var s = document.getElementsByTagName('script')[0];
 12 s.parentNode.insertBefore(ga, s);
 13</script>
 14<script src="../inspector-test.js"></script>
 15<script type="text/javascript">
 16
 17function openWindow1()
 18{
 19 window.open(window.location, "_blank");
 20 console.log("window 1 ok");
 21}
 22
 23function openWindow2()
 24{
 25 window.open(window.location, "_blank");
 26 console.log("window 2 ok");
 27}
 28
 29function test()
 30{
 31 if (!window.internals) {
 32 console.log("This test cannot be run as window.internals is not available.");
 33 return;
 34 }
 35 NetworkAgent.setCacheDisabled(true, step1);
 36 internals.disableMemoryCache(true);
 37
 38 function step1(msg)
 39 {
 40 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
 41 InspectorTest.evaluateInPage("openWindow1()");
 42 }
 43
 44 function step2(msg)
 45 {
 46 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step3);
 47 InspectorTest.evaluateInPage("openWindow2()");
 48 }
 49
 50 function step3(msg)
 51 {
 52 NetworkAgent.setCacheDisabled(false, step4);
 53 }
 54
 55 function step4(msg)
 56 {
 57 internals.disableMemoryCache(false);
 58 InspectorTest.completeTest();
 59 }
 60}
 61</script>
 62<head>
 63<body onload="runTest()">
 64</body>
 65</html>
 66

LayoutTests/platform/gtk/Skipped

@@http/tests/inspector/network/network-size.html
14561456# https://bugs.webkit.org/show_bug.cgi?id=64097
14571457http/tests/inspector/network/network-disable-cache-memory.html
14581458http/tests/inspector/network/network-disable-cache-xhrs.html
 1459http/tests/inspector/network/disabled-cache-crash.html
14591460
14601461# https://bugs.webkit.org/show_bug.cgi?id=61437
14611462http/tests/inspector/network/network-clear-after-disabled.html

LayoutTests/platform/mac/Skipped

@@http/tests/inspector/network/network-size-sync.html
332332# https://bugs.webkit.org/show_bug.cgi?id=64097
333333http/tests/inspector/network/network-disable-cache-memory.html
334334http/tests/inspector/network/network-disable-cache-xhrs.html
 335http/tests/inspector/network/disabled-cache-crash.html
335336
336337# https://bugs.webkit.org/show_bug.cgi?id=58515
337338compositing/overflow/clip-content-under-overflow-controls.html

LayoutTests/platform/qt/Skipped

@@http/tests/inspector/network/network-size-sync.html
18491849# https://bugs.webkit.org/show_bug.cgi?id=64097
18501850http/tests/inspector/network/network-disable-cache-memory.html
18511851http/tests/inspector/network/network-disable-cache-xhrs.html
 1852http/tests/inspector/network/disabled-cache-crash.html
18521853
18531854# [Qt] media/video-playbackrate.html fails
18541855# https://bugs.webkit.org/show_bug.cgi?id=57476

LayoutTests/platform/win/Skipped

@@http/tests/inspector/network/network-size-sync.html
5555# https://bugs.webkit.org/show_bug.cgi?id=64097
5656http/tests/inspector/network/network-disable-cache-memory.html
5757http/tests/inspector/network/network-disable-cache-xhrs.html
 58http/tests/inspector/network/disabled-cache-crash.html
5859
5960# Fails <rdar://problem/5674289>
6061media/video-seek-past-end-paused.html

Source/WebCore/ChangeLog

 12011-08-01 Scott Graham <scottmg@chromium.org>
 2
 3 REGRESSION (r39725?): Resources removed from document can not be freed
 4 until the document is deleted
 5 https://bugs.webkit.org/show_bug.cgi?id=61006
 6
 7 Reviewed by Antti Koivisto.
 8
 9 Upon completing a load start a Timer to iterate through
 10 CachedResourceLoader's m_documentResources map to check for any items
 11 that have only one reference (thus being the reference in the map
 12 itself). The map should really be weak, but because the
 13 CachedResourceHandle achieves bookkeeping work in addition to
 14 reference counting, this is a simpler and more localized way to free
 15 the used memory while maintaining the other behaviour (when
 16 CachedResource is used as proxy).
 17
 18 With this patch the testcase at
 19 https://bugs.webkit.org/attachment.cgi?id=93850 should no longer
 20 consume 400MB of ram on load. Test added for crash discovered in
 21 previous revision, but no tests for memory usage.
 22
 23 Test: http/tests/inspector/network/disabled-cache-crash.html
 24
 25 * WebCore.exp.in:
 26 * loader/cache/CachedResource.h:
 27 (WebCore::CachedResource::hasOneHandle):
 28 * loader/cache/CachedResourceLoader.cpp:
 29 (WebCore::CachedResourceLoader::CachedResourceLoader):
 30 (WebCore::CachedResourceLoader::loadDone):
 31 (WebCore::CachedResourceLoader::garbageCollectDocumentResourcesTimerFired):
 32 * loader/cache/CachedResourceLoader.h:
 33 * testing/Internals.cpp:
 34 (WebCore::Internals::disableMemoryCache):
 35 * testing/Internals.h:
 36 * testing/Internals.idl:
 37
1382011-08-01 Benjamin Poulain <benjamin@webkit.org>
239
340 [Qt] OpenGLShims does not build on ARM

Source/WebCore/WebCore.exp.in

@@__ZN7WebCore11MemoryCache13setCapacitiesEjjj
217217__ZN7WebCore11MemoryCache14evictResourcesEv
218218__ZN7WebCore11MemoryCache19getOriginsWithCacheERN3WTF7HashSetINS1_6RefPtrINS_14SecurityOriginEEENS_18SecurityOriginHashENS1_10HashTraitsIS5_EEEE
219219__ZN7WebCore11MemoryCache25removeResourcesWithOriginEPNS_14SecurityOriginE
 220__ZN7WebCore11MemoryCache11setDisabledEb
220221__ZN7WebCore11RenderLayer19scrollRectToVisibleERKNS_7IntRectERKNS_15ScrollAlignmentES6_
221222__ZN7WebCore11globalPointERK8_NSPointP8NSWindow
222223__ZN7WebCore11memoryCacheEv

Source/WebCore/loader/cache/CachedResource.h

@@public:
182182 CachedMetadata* cachedMetadata(unsigned dataTypeID) const;
183183
184184 bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount && !m_handleCount && !m_resourceToRevalidate && !m_proxyResource; }
 185 bool hasOneHandle() const { return m_handleCount == 1; }
185186
186187 bool isExpired() const;
187188

Source/WebCore/loader/cache/CachedResourceLoader.cpp

@@static CachedResource* createResource(CachedResource::Type type, ResourceRequest
8686CachedResourceLoader::CachedResourceLoader(Document* document)
8787 : m_document(document)
8888 , m_requestCount(0)
 89 , m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)
8990 , m_autoLoadImages(true)
9091 , m_loadFinishing(false)
9192 , m_allowStaleResources(false)

@@void CachedResourceLoader::loadDone()
572573 if (frame())
573574 frame()->loader()->loadDone();
574575 performPostLoadActions();
 576
 577 if (!m_garbageCollectDocumentResourcesTimer.isActive())
 578 m_garbageCollectDocumentResourcesTimer.startOneShot(0);
 579}
 580
 581// Garbage collecting m_documentResources is a workaround for the
 582// CachedResourceHandles on the RHS being strong references. Ideally this
 583// would be a weak map, however CachedResourceHandles perform additional
 584// bookkeeping on CachedResources, so instead pseudo-GC them -- when the
 585// reference count reaches 1, m_documentResources is the only reference, so
 586// remove it from the map.
 587void CachedResourceLoader::garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>* timer)
 588{
 589 ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer);
 590
 591 typedef Vector<String, 10> StringVector;
 592 StringVector resourcesToDelete;
 593
 594 for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m_documentResources.end(); ++it) {
 595 if (it->second->hasOneHandle()) {
 596 resourcesToDelete.append(it->first);
 597 it->second->setOwningCachedResourceLoader(0);
 598 }
 599 }
 600
 601 for (StringVector::const_iterator it = resourcesToDelete.begin(); it != resourcesToDelete.end(); ++it)
 602 m_documentResources.remove(*it);
575603}
576604
577605void CachedResourceLoader::performPostLoadActions()

Source/WebCore/loader/cache/CachedResourceLoader.h

3030#include "CachedResourceHandle.h"
3131#include "CachePolicy.h"
3232#include "ResourceLoadPriority.h"
 33#include "Timer.h"
3334#include <wtf/Deque.h>
3435#include <wtf/HashMap.h>
3536#include <wtf/HashSet.h>

@@private:
117118 void notifyLoadedFromMemoryCache(CachedResource*);
118119 bool canRequest(CachedResource::Type, const KURL&, bool forPreload = false);
119120
 121 void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);
120122 void performPostLoadActions();
121123
122124 HashSet<String> m_validatedURLs;

@@private:
133135 };
134136 Deque<PendingPreload> m_pendingPreloads;
135137
 138 Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
 139
136140 //29 bits left
137141 bool m_autoLoadImages : 1;
138142 bool m_loadFinishing : 1;

Source/WebCore/testing/Internals.cpp

3232#include "Element.h"
3333#include "ExceptionCode.h"
3434#include "InspectorController.h"
 35#include "MemoryCache.h"
3536#include "NodeRenderingContext.h"
3637#include "Page.h"
3738#include "RenderObject.h"

@@String Internals::shadowPseudoId(Element* element, ExceptionCode& ec)
147148 return element->shadowPseudoId().string();
148149}
149150
 151void Internals::disableMemoryCache(bool disabled)
 152{
 153 WebCore::memoryCache()->setDisabled(disabled);
 154}
 155
150156#if ENABLE(INSPECTOR)
151157void Internals::setInspectorResourcesDataSizeLimits(Document* document, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec)
152158{

Source/WebCore/testing/Internals.h

@@public:
5555 String shadowPseudoId(Element*, ExceptionCode&);
5656 PassRefPtr<Element> createShadowContentElement(Document*, ExceptionCode&);
5757 Element* getElementByIdInShadowRoot(Node* shadowRoot, const String& id, ExceptionCode&);
 58 void disableMemoryCache(bool disabled);
5859
5960#if ENABLE(INSPECTOR)
6061 void setInspectorResourcesDataSizeLimits(Document*, int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&);

Source/WebCore/testing/Internals.idl

@@module window {
3737 DOMString shadowPseudoId(in Element element) raises (DOMException);
3838 Element createShadowContentElement(in Document document) raises(DOMException);
3939 Element getElementByIdInShadowRoot(in Node shadowRoot, in DOMString id) raises(DOMException);
 40 void disableMemoryCache(in boolean disabled);
4041
4142 void setInspectorResourcesDataSizeLimits(in Document document, in long maximumResourcesContentSize, in long maximumSingleResourceContentSize) raises(DOMException);
4243

Source/WebKit2/ChangeLog

 12011-08-01 Scott Graham <scottmg@chromium.org>
 2
 3 REGRESSION (r39725?): Resources removed from document can not be freed until the document is deleted
 4 https://bugs.webkit.org/show_bug.cgi?id=61006
 5
 6 Reviewed by Antti Koivisto.
 7
 8 Update exports for test harness.
 9
 10 * win/WebKit2.def:
 11 * win/WebKit2CFLite.def:
 12
1132011-08-01 Hayato Ito <hayato@chromium.org>
214
315 Add support for getting an element in shadow root by its id into a window.internals object.

Source/WebKit2/win/WebKit2.def

@@EXPORTS
154154 ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
155155 ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
156156 ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
 157 ?memoryCache@WebCore@@YAPAVMemoryCache@1@XZ
157158 ?page@Document@WebCore@@QBEPAVPage@2@XZ
158159 ?removeShadowRoot@Element@WebCore@@QAEXXZ
 160 ?setDisabled@MemoryCache@WebCore@@QAEX_N@Z
159161 ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
160162 ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
161163 ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ

Source/WebKit2/win/WebKit2CFLite.def

@@EXPORTS
148148 ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
149149 ?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
150150 ?jsStringSlowCase@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@AAV?$HashMap@PAVStringImpl@WTF@@V?$Weak@VJSString@JSC@@@JSC@@UStringHash@2@U?$HashTraits@PAVStringImpl@WTF@@@2@U?$HashTraits@V?$Weak@VJSString@JSC@@@JSC@@@2@@WTF@@PAVStringImpl@6@@Z
 151 ?memoryCache@WebCore@@YAPAVMemoryCache@1@XZ
151152 ?page@Document@WebCore@@QBEPAVPage@2@XZ
152153 ?removeShadowRoot@Element@WebCore@@QAEXXZ
 154 ?setDisabled@MemoryCache@WebCore@@QAEX_N@Z
153155 ?setDOMException@WebCore@@YAXPAVExecState@JSC@@H@Z
154156 ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
155157 ?shadowRoot@Element@WebCore@@QBEPAVShadowRoot@2@XZ

Source/autotools/symbols.filter

@@_ZN7WebCore10ClientRectC1Ev;
3535_ZN7WebCore10ClientRectC1ERKNS_7IntRectE;
3636_ZN7WebCore11EventTarget17toGeneratedStreamEv;
3737_ZN7WebCore11EventTarget8toStreamEv;
 38_ZN7WebCore11MemoryCache11setDisabledEb;
 39_ZN7WebCore11memoryCacheEv;
3840_ZN7WebCore12JSDOMWrapper34virtualFunctionToPreventWeakVtableEv;
3941_ZN7WebCore12RenderObject23absoluteBoundingBoxRectEb;
4042_ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE;