internals.isPreloaded() should be true even after document's onload |
||||
Issue descriptioninternals.isPreloaded() can turn false after document's onload or around, because of ResourceFetcher::clearPreloads(). I think internals.isPreloaded() is expected to be true if the url is preloaded at least once, even after document's onload.
,
Sep 2 2016
isPreloaded() relies on ResourceFetcher's m_preloads, which gets cleared (at least partially) by clearPreloads. That makes isPreloaded based tests potentially fragile (as we change policies around clearPreloads, when it should be called and what it should do). At the same time, we want to minimize the amount of test-only code and state we maintain...
,
Sep 2 2016
One solution would be to make ResourceFetcher to accumulate a set of Strings that represent preloaded URLs only in layout tests. This adds test-only code but no runtime costs other than a flag check per load. (I haven't figure out how to cleanly control whether ResourceFetcher accumulates URLs or not though) I expect we have to maintain a set of preloaded URLs, not a set of preloaded Resource, because retaining strong references to preloaded Resources will affect the lifetime of Resource and MemoryCache behavior.
,
Sep 2 2016
That sounds like a reasonable way to avoid the tight coupling of current memcache handling code and isPreloaded functionality. Is there a way to ifdef such test-only code away?
,
Sep 14 2016
> Is there a way to ifdef such test-only code away? I expect No. Probably putting a small piece of code to ResourceFetcher and disabling it in non-test environment by a runtime flag is reasonable. Drafting a CL.
,
Sep 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7978814bba57818814b7a10aa3366e16c6d33784 commit 7978814bba57818814b7a10aa3366e16c6d33784 Author: hiroshige <hiroshige@chromium.org> Date: Thu Sep 15 10:05:17 2016 Make internals.isPreloaded() to remain the same before/after clearPreloads() Previously, internals.isPreloaded() depends on |ResourceFetcher::m_preloads|, which is cleared by ResourceFetcher::clearPreloads(). This caused internals.isPreloaded() to turn false after around document's load event. This CL makes ResourceFetcher to keep a set of preloaded URLs (separately from |m_preloads|) if a blink::Internals object is created, and use the set to calculate internals.isPreloaded(). BUG= 643621 Review-Url: https://codereview.chromium.org/2332333003 Cr-Commit-Position: refs/heads/master@{#418821} [add] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/LayoutTests/fast/preloader/is-preloaded-after-load-expected.txt [add] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/LayoutTests/fast/preloader/is-preloaded-after-load.html [modify] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/LayoutTests/http/tests/linkHeader/link-preload-in-iframe.html [modify] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/LayoutTests/http/tests/linkHeader/resources/iframe-link-headers.php [modify] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp [modify] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/Source/core/fetch/ResourceFetcher.h [modify] https://crrev.com/7978814bba57818814b7a10aa3366e16c6d33784/third_party/WebKit/Source/core/testing/Internals.cpp
,
Sep 15 2016
|
||||
►
Sign in to add a comment |
||||
Comment 1 by hirosh...@chromium.org
, Sep 2 2016