| Differences between
and this patch
- a/Source/WebCore/ChangeLog +18 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-03-29  James Simonsen  <simonjam@chromium.org>
2
3
        [Resource Timing] Expose timing information for iframes
4
        https://bugs.webkit.org/show_bug.cgi?id=103927
5
6
        Reviewed by Nate Chapin.
7
8
        The only catch with main documents is that we only want to record the load that was initiated by
9
        adding the <iframe> to a document. We don't want any subsequent navigations within the iframe to
10
        be reported.
11
12
        Test: http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation.html
13
14
        * loader/cache/CachedResourceLoader.cpp:
15
        (WebCore::CachedResourceLoader::revalidateResource):
16
        (WebCore::CachedResourceLoader::loadResource):
17
        (WebCore::CachedResourceLoader::loadDone): Make sure iframes are reported in the parent.
18
1
2013-03-29  Nate Chapin  <japhet@chromium.org>
19
2013-03-29  Nate Chapin  <japhet@chromium.org>
2
20
3
        ASSERT d->m_defersLoading != defers on detik.com and drive.google.com
21
        ASSERT d->m_defersLoading != defers on detik.com and drive.google.com
- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp -10 / +24 lines
Lines 44-49 a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec1
44
#include "FrameLoader.h"
44
#include "FrameLoader.h"
45
#include "FrameLoaderClient.h"
45
#include "FrameLoaderClient.h"
46
#include "HTMLElement.h"
46
#include "HTMLElement.h"
47
#include "HTMLFrameOwnerElement.h"
47
#include "LoaderStrategy.h"
48
#include "LoaderStrategy.h"
48
#include "Logging.h"
49
#include "Logging.h"
49
#include "MemoryCache.h"
50
#include "MemoryCache.h"
Lines 527-536 CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(co a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec2
527
    memoryCache()->remove(resource);
528
    memoryCache()->remove(resource);
528
    memoryCache()->add(newResource.get());
529
    memoryCache()->add(newResource.get());
529
#if ENABLE(RESOURCE_TIMING)
530
#if ENABLE(RESOURCE_TIMING)
530
    if (resource->type() != CachedResource::MainResource) {
531
    storeResourceTimingInitiatorInformation(resource, request);
531
        InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
532
        m_initiatorMap.add(newResource.get(), info);
533
    }
534
#else
532
#else
535
    UNUSED_PARAM(request);
533
    UNUSED_PARAM(request);
536
#endif
534
#endif
Lines 548-560 CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec3
548
    if (!memoryCache()->add(resource.get()))
546
    if (!memoryCache()->add(resource.get()))
549
        resource->setOwningCachedResourceLoader(this);
547
        resource->setOwningCachedResourceLoader(this);
550
#if ENABLE(RESOURCE_TIMING)
548
#if ENABLE(RESOURCE_TIMING)
551
    if (type != CachedResource::MainResource) {
549
    storeResourceTimingInitiatorInformation(resource, request);
550
#endif
551
    return resource;
552
}
553
554
#if ENABLE(RESOURCE_TIMING)
555
void CachedResourceLoader::storeResourceTimingInitiatorInformation(const CachedResourceHandle<CachedResource>& resource, const CachedResourceRequest& request)
556
{
557
    if (resource->type() == CachedResource::MainResource) {
558
        // <iframe>s should report the initial navigation requested by the parent document, but not subsequent navigations.
559
        if (frame()->ownerElement() && m_documentLoader->frameLoader()->stateMachine()->committingFirstRealLoad()) {
560
            InitiatorInfo info = { frame()->ownerElement()->localName(), monotonicallyIncreasingTime() };
561
            m_initiatorMap.add(resource.get(), info);
562
        }
563
    } else {
552
        InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
564
        InitiatorInfo info = { request.initiatorName(), monotonicallyIncreasingTime() };
553
        m_initiatorMap.add(resource.get(), info);
565
        m_initiatorMap.add(resource.get(), info);
554
    }
566
    }
555
#endif
556
    return resource;
557
}
567
}
568
#endif // ENABLE(RESOURCE_TIMING)
558
569
559
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const
570
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, CachedResourceRequest::DeferOption defer) const
560
{
571
{
Lines 740-752 void CachedResourceLoader::loadDone(CachedResource* resource) a/Source/WebCore/loader/cache/CachedResourceLoader.cpp_sec4
740
    RefPtr<Document> protectDocument(m_document);
751
    RefPtr<Document> protectDocument(m_document);
741
752
742
#if ENABLE(RESOURCE_TIMING)
753
#if ENABLE(RESOURCE_TIMING)
743
    // FIXME: Add resource timing support for main resources.
754
    if (resource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) {
744
    if (resource && resource->type() != CachedResource::MainResource && resource->response().isHTTP() && ((!resource->errorOccurred() && !resource->wasCanceled()) || resource->response().httpStatusCode() == 304)) {
745
        HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource);
755
        HashMap<CachedResource*, InitiatorInfo>::iterator initiatorIt = m_initiatorMap.find(resource);
746
        if (initiatorIt != m_initiatorMap.end()) {
756
        if (initiatorIt != m_initiatorMap.end()) {
747
            ASSERT(document());
757
            ASSERT(document());
758
            Document* initiatorDocument = document();
759
            if (resource->type() == CachedResource::MainResource)
760
                initiatorDocument = document()->parentDocument();
761
            ASSERT(initiatorDocument);
748
            const InitiatorInfo& info = initiatorIt->value;
762
            const InitiatorInfo& info = initiatorIt->value;
749
            document()->domWindow()->performance()->addResourceTiming(info.name, document(), resource->resourceRequest(), resource->response(), info.startTime, resource->loadFinishTime());
763
            initiatorDocument->domWindow()->performance()->addResourceTiming(info.name, initiatorDocument, resource->resourceRequest(), resource->response(), info.startTime, resource->loadFinishTime());
750
            m_initiatorMap.remove(initiatorIt);
764
            m_initiatorMap.remove(initiatorIt);
751
        }
765
        }
752
    }
766
    }
- a/Source/WebCore/loader/cache/CachedResourceLoader.h +3 lines
Lines 145-150 private: a/Source/WebCore/loader/cache/CachedResourceLoader.h_sec1
145
    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&);
145
    CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, CachedResourceRequest&);
146
    CachedResourceHandle<CachedResource> revalidateResource(const CachedResourceRequest&, CachedResource*);
146
    CachedResourceHandle<CachedResource> revalidateResource(const CachedResourceRequest&, CachedResource*);
147
    CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, CachedResourceRequest&, const String& charset);
147
    CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, CachedResourceRequest&, const String& charset);
148
#if ENABLE(RESOURCE_TIMING)
149
    void storeResourceTimingInitiatorInformation(const CachedResourceHandle<CachedResource>&, const CachedResourceRequest&);
150
#endif
148
    void requestPreload(CachedResource::Type, CachedResourceRequest&, const String& charset);
151
    void requestPreload(CachedResource::Type, CachedResourceRequest&, const String& charset);
149
152
150
    enum RevalidationPolicy { Use, Revalidate, Reload, Load };
153
    enum RevalidationPolicy { Use, Revalidate, Reload, Load };
- a/LayoutTests/ChangeLog +13 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2013-03-29  James Simonsen  <simonjam@chromium.org>
2
3
        [Resource Timing] Expose timing information for iframes
4
        https://bugs.webkit.org/show_bug.cgi?id=103927
5
6
        Reviewed by Nate Chapin.
7
8
        * http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_frame_initiator_type.html: Fix timeout.
9
        * http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation-expected.txt: Added.
10
        * http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation.html: Added.
11
        * http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types-expected.txt: Remove bad line.
12
        * platform/chromium/TestExpectations: Unskip tests that relied on iframes.
13
1
2013-03-29  Nate Chapin  <japhet@chromium.org>
14
2013-03-29  Nate Chapin  <japhet@chromium.org>
2
15
3
        ASSERT d->m_defersLoading != defers on detik.com and drive.google.com
16
        ASSERT d->m_defersLoading != defers on detik.com and drive.google.com
- a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_frame_initiator_type.html -1 / +1 lines
Lines 13-19 a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_frame_initiator_type.html_sec1
13
setup({explicit_done: true});
13
setup({explicit_done: true});
14
14
15
function onload_test() {
15
function onload_test() {
16
    var context = new PerformanceContext(iframe.contentWindow.performance);
16
    var context = new PerformanceContext(document.getElementById("frameContext").contentWindow.performance);
17
    var entries = context.getEntries();
17
    var entries = context.getEntries();
18
18
19
    var expected_entries = {
19
    var expected_entries = {
- a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation-expected.txt +8 lines
Line 0 a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation-expected.txt_sec1
1
Description
2
3
This test validates that iframes that navigate themselves don't appear in the buffer.
4
5
6
7
PASS /w3c/webperf/resources/inject_resource_test.html is expected to have initiatorType iframe 
8
- a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation.html +48 lines
Line 0 a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_iframe_self_navigation.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8" />
5
<title>Resource Timing self navigating iframes</title>
6
<link rel="author" title="Google" href="http://www.google.com/" />
7
<link rel="help" href="http://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
8
<script src="/w3c/resources/testharness.js"></script>
9
<script src="/w3c/resources/testharnessreport.js"></script>
10
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
11
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
12
<script>
13
setup({explicit_done: true});
14
var d;
15
var iframe;
16
var iframeBody;
17
function setup_iframe() {
18
    var iframe_content = '<iframe id="innerFrame" src="/w3c/webperf/resources/inject_resource_test.html"></iframe>';
19
    iframe = document.getElementById('frameContext');
20
    d = iframe.contentWindow.document;
21
    d.write(iframe_content);
22
    iframe.contentWindow.setup_iframe = setup_inner_iframe;
23
}
24
function setup_inner_iframe() {
25
    var iframe_content = '<script>window.location = "/w3c/webperf/resources/generate_resource.php?type=iframe";</scr' + 'ipt>';
26
    var inner_iframe = d.getElementById('innerFrame');
27
    inner_iframe.contentWindow.document.write(iframe_content);
28
    inner_iframe.addEventListener("load", onload_test);
29
}
30
function onload_test() {
31
    var context = new PerformanceContext(iframe.contentWindow.performance);
32
    var entries = context.getEntriesByType('resource');
33
    var expected_entries = {
34
        '/w3c/webperf/resources/inject_resource_test.html': 'iframe',
35
    };
36
    test_resource_entries(entries, expected_entries);
37
    done();
38
}
39
window.setup_iframe = setup_iframe;
40
</script>
41
</head>
42
<body>
43
<h1>Description</h1>
44
<p>This test validates that iframes that navigate themselves don't appear in the buffer.</p>
45
<div id="log"></div>
46
<iframe id="frameContext" src="/w3c/webperf/resources/inject_resource_test.html"></iframe>
47
</body>
48
</html>
- a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types-expected.txt -1 lines
Lines 19-24 PASS /w3c/webperf/resources/generate_resource.php?type=image&id=input is expecte a/LayoutTests/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types-expected.txt_sec1
19
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=n1 is expected to have initiatorType css 
19
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=n1 is expected to have initiatorType css 
20
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=object is expected to have initiatorType object 
20
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=object is expected to have initiatorType object 
21
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=poster is expected to have initiatorType video 
21
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=poster is expected to have initiatorType video 
22
PASS /w3c/webperf/resources/generate_resource.php?type=image&id=sync_xhr is expected to have initiatorType xmlhttprequest 
23
PASS /w3c/webperf/resources/nested.css is expected to have initiatorType link 
22
PASS /w3c/webperf/resources/nested.css is expected to have initiatorType link 
24
23
- a/LayoutTests/platform/chromium/TestExpectations -5 / +2 lines
Lines 3512-3522 webkit.org/b/85522 http/tests/security/sandboxed-iframe-form-top.html [ Skip ] a/LayoutTests/platform/chromium/TestExpectations_sec1
3512
3512
3513
webkit.org/b/102724 [ Linux ] svg/carto.net/colourpicker.svg [ ImageOnlyFailure Pass ]
3513
webkit.org/b/102724 [ Linux ] svg/carto.net/colourpicker.svg [ ImageOnlyFailure Pass ]
3514
3514
3515
webkit.org/b/103927 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_frame_initiator_type.html [ Failure ]
3515
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_dynamic_insertion.html [ Timeout ]
3516
webkit.org/b/103927 [ Mac Linux ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_dynamic_insertion.html [ Failure ]
3516
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types.html [ Timeout ]
3517
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_dynamic_insertion.html [ Failure Timeout ]
3518
webkit.org/b/103927 [ Mac Linux ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types.html [ Failure ]
3519
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_initiator_types.html [ Failure Timeout ]
3520
webkit.org/b/103927 [ Mac Linux ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure ]
3517
webkit.org/b/103927 [ Mac Linux ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure ]
3521
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure Timeout ]
3518
webkit.org/b/103927 [ Win ] http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_redirects.html [ Failure Timeout ]
3522
webkit.org/b/103927 http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request.html [ Failure ]
3519
webkit.org/b/103927 http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request.html [ Failure ]

Return to Bug 103927