Changeset 136329 in webkit
- Timestamp:
- Dec 2, 2012 3:23:04 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r136326 r136329 1 2012-12-02 Pan Deng <pan.deng@intel.com> 2 3 [Resource Timing]Test cases of cross origin resource timing. 4 https://bugs.webkit.org/show_bug.cgi?id=84886. 5 6 Reviewed by Tony Gentilcore. 7 8 Test cases in this patch validate resource timing behavior when cross origin request with/without "allow-timing-origin" response header. 9 10 * http/tests/w3c/webperf/resources/blank_page_green_with_allow_timing.php: Added. 11 * http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request-expected.txt: Added. 12 * http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request.html: Added. 13 * http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_timing_allow_cross_origin_resource_request-expected.txt: Added. 14 * http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_timing_allow_cross_origin_resource_request.html: Added. 15 1 16 2012-12-02 Justin Novosad <junov@google.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r136328 r136329 1 2012-12-02 Pan Deng <pan.deng@intel.com> 2 3 [Resource Timing] implementation of cross origin resouce timing restrictions. 4 https://bugs.webkit.org/show_bug.cgi?id=84886. 5 6 Reviewed by Tony Gentilcore. 7 8 This patch implemented resource timing behaviors of cross origin. By default, detailed timing info is hided in cross origin resource timing, only startTime, duration, fetchStart and responseEnd can be observed. Exceptions are, server side allow its origin can be timing by another through a header with "timing-allow-origin" field. 9 10 Tests: http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_cross_origin_resource_request.html 11 http/tests/w3c/webperf/submission/Intel/resource-timing/test_resource_timing_timing_allow_cross_origin_resource_request.html 12 13 * page/Performance.cpp: 14 (WebCore::passesTimingAllowCheck): 15 (WebCore): 16 (WebCore::Performance::addResourceTiming): 17 * page/Performance.h: 18 (WebCore): 19 (Performance): 20 * page/PerformanceResourceTiming.cpp: 21 (WebCore): 22 * page/PerformanceResourceTiming.h: 23 (WebCore::PerformanceResourceTiming::create): 24 (PerformanceResourceTiming): 25 1 26 2012-12-02 Elliott Sprehn <esprehn@gmail.com> 2 27 -
trunk/Source/WebCore/page/PerformanceResourceTiming.cpp
r135458 r136329 1 1 /* 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 45 46 namespace WebCore { 46 47 47 double monotonicTimeToDocumentMilliseconds(Document* document, double seconds)48 static double monotonicTimeToDocumentMilliseconds(Document* document, double seconds) 48 49 { 49 50 ASSERT(seconds >= 0.0); 50 51 return document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(seconds) * 1000.0; 52 } 53 54 static bool passesTimingAllowCheck(const ResourceResponse& response, Document* requestingDocument) 55 { 56 AtomicallyInitializedStatic(AtomicString&, timingAllowOrigin = *new AtomicString("timing-allow-origin")); 57 58 const String& timingAllowOriginString = response.httpHeaderField(timingAllowOrigin); 59 if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOriginString, "null")) 60 return false; 61 62 if (timingAllowOriginString == "*") 63 return true; 64 65 const String& securityOrigin = requestingDocument->securityOrigin()->toString(); 66 Vector<String> timingAllowOrigins; 67 timingAllowOriginString.split(" ", timingAllowOrigins); 68 for (size_t i = 0; i < timingAllowOrigins.size(); ++i) 69 if (timingAllowOrigins[i] == securityOrigin) 70 return true; 71 72 return false; 51 73 } 52 74 … … 56 78 , m_timing(response.resourceLoadTiming()) 57 79 , m_finishTime(finishTime) 80 , m_shouldReportDetails(passesTimingAllowCheck(response, requestingDocument)) 58 81 , m_requestingDocument(requestingDocument) 59 82 { … … 74 97 { 75 98 // FIXME: Need to track and report redirects for resources. 99 if (!m_shouldReportDetails) 100 return 0.0; 76 101 return 0; 77 102 } … … 79 104 double PerformanceResourceTiming::redirectEnd() const 80 105 { 106 if (!m_shouldReportDetails) 107 return 0.0; 81 108 return 0; 82 109 } … … 90 117 double PerformanceResourceTiming::domainLookupStart() const 91 118 { 119 if (!m_shouldReportDetails) 120 return 0.0; 121 92 122 if (!m_timing || m_timing->dnsStart < 0) 93 123 return fetchStart(); … … 98 128 double PerformanceResourceTiming::domainLookupEnd() const 99 129 { 130 if (!m_shouldReportDetails) 131 return 0.0; 132 100 133 if (!m_timing || m_timing->dnsEnd < 0) 101 134 return domainLookupStart(); … … 106 139 double PerformanceResourceTiming::connectStart() const 107 140 { 141 if (!m_shouldReportDetails) 142 return 0.0; 143 108 144 if (!m_timing || m_timing->connectStart < 0) // Connection was reused. 109 145 return domainLookupEnd(); … … 119 155 double PerformanceResourceTiming::connectEnd() const 120 156 { 157 if (!m_shouldReportDetails) 158 return 0.0; 159 121 160 if (!m_timing || m_timing->connectEnd < 0) // Connection was reused. 122 161 return connectStart(); … … 127 166 double PerformanceResourceTiming::secureConnectionStart() const 128 167 { 168 if (!m_shouldReportDetails) 169 return 0.0; 170 129 171 if (!m_timing || m_timing->sslStart < 0) // Secure connection not negotiated. 130 172 return 0.0; … … 135 177 double PerformanceResourceTiming::requestStart() const 136 178 { 179 if (!m_shouldReportDetails) 180 return 0.0; 181 137 182 if (!m_timing) 138 183 return connectEnd(); 184 139 185 return resourceTimeToDocumentMilliseconds(m_timing->sendStart); 140 186 } … … 142 188 double PerformanceResourceTiming::responseStart() const 143 189 { 190 if (!m_shouldReportDetails) 191 return 0.0; 192 144 193 if (!m_timing) 145 194 return requestStart(); … … 150 199 double PerformanceResourceTiming::responseEnd() const 151 200 { 201 if (!m_shouldReportDetails) 202 return 0.0; 203 152 204 if (!m_timing) 153 205 return responseStart(); 206 154 207 return monotonicTimeToDocumentMilliseconds(m_requestingDocument.get(), m_finishTime); 155 208 } -
trunk/Source/WebCore/page/PerformanceResourceTiming.h
r135458 r136329 1 1 /* 2 2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 79 80 RefPtr<ResourceLoadTiming> m_timing; 80 81 double m_finishTime; 82 bool m_shouldReportDetails; 81 83 RefPtr<Document> m_requestingDocument; 82 84 };
Note: See TracChangeset
for help on using the changeset viewer.