Auto merge of #23873 - RestitutorOrbis:jn-add-tao, r=jdm

Add PerformanceResourceTiming:TimingAllowCheck

Added timing allow check to http_loader.rs in `fn http_network_fetch`.

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21270

### Things to Do
- [x] Map header values from Timing-Allow-Origin to URL types using [Url::Parse](https://docs.rs/url/2.0.0/url/)
- [x] Check equality of those header URL origin with the origin in question
- [x] Just use url instead of `res.origin`
- [x] Change `.set_attribute(ResourceAttribute::RedirectStart(0))` to `.set_attribute(ResourceAttribute::RedirectStart(RedirectStartValue::Zero))`
- [x] Change `.set_attribute(ResourceAttribute::RedirectEnd(0))` to `.set_attribute(ResourceAttribute::RedirectEnd(RedirectEndValue::Zero))`
- [x] Figure out how to set DomainLookupStart, RequestStart, and ResponseStart without directly passing value as part of enum
- [x] Figure out how to handle lack of DomainLookupEnd (#21260) and SecureConnectionStart (#21268)
- [x] add a flag to ResourceFetchTiming that indicates if the timing check passed, and only update timing attributes if that flag is false
- [x] add function to mark timing test as failed and set all attributes to 0
- [x] resolve compile error regarding move of header_strings variable
- [x] resolve URL parse errors that appear during test execution
- [x] ~~Fix /resource-timing/crossorigin-sandwich-no-TAO.sub.html~~ (Refer to resource_TAO_cross_origin_redirect_chain.html)
- [x] ~~Fix /resource-timing/crossorigin-sandwich-TAO.sub.html~~ (Refer to resource_TAO_cross_origin_redirect_chain.html)
- [x] ~~Fix /resource-timing/resource-reload-TAO.sub.html~~ (Get TIMEOUT, fails on Firefox too?)
- [x] ~~Fix /resource-timing/resource_TAO_cross_origin_redirect_chain.html~~ (Problem seems to lie in loading the iFrame, when the request is made, the URL attached to the PerformanceResourceTiming interface is the initial URL set on the iFrame instead of the URL that is ultimately loaded)
- [x] ~~Fix resource-timing/resource_TAO_multi_wildcard.html~~ (Doesn't work because IMG element doesn't generate HTTP request with Origin field)
- [x] Fix /resource-timing/resource_TAO_match_origin.htm
- [x] Fix /resource-timing/resource_TAO_match_wildcard.htm
- [x] Fix /resource-timing/resource_TAO_multi.htm
- [x] Fix /resource-timing/resource_TAO_wildcard.htm
- [x] Fix /resource-timing/resource_TAO_zero.htm
- [x] Fix /resource-timing/resource_TAO_null.htm
- [x] Fix /resource-timing/resource_TAO_origin.htm (tests for responseStart and domainLookupEnd fail because #21260 and #21271 haven't been resolved)
- [x] Fix /resource-timing/resource_TAO_space.htm
- [x] Fix /resource-timing/resource_TAO_origin_uppercase.htm
- [x] ~~Fix /resource-timing/resource_timing_TAO_cross_origin_redirect.html~~ (Refer to resource_TAO_cross_origin_redirect_chain.html)
- [x] ~~Fix /resource-timing/TAO-case-insensitive-null-opaque-origin.sub.html~~ (TIMEOUT, doesn't seem to parse iFrame SRC correctly? There doesn't seem to be any sign that it makes a request to TAOResponse.py)
- [x] Fix /resource-timing/TAO-crossorigin-port.sub.html
- [x] ~~Fix /resource-timing/TAO-null-opaque-origin.sub.html~~ (Refer to /resource-timing/TAO-crossorigin-port.sub.html)
- [x] /navigation-timing/nav2_test_redirect_chain_xserver_partial_opt_in.html
- [x] /navigation-timing/nav2_test_document_open.html
- [x] /navigation-timing/nav2_test_frame_removed.html
- [x] /performance-timeline/not-clonable.html
- [x] /navigation-timing/nav2_test_redirect_xserver.html
- [x] /resource-timing/resource_connection_reuse.https.html
- [x] /resource-timing/resource_reparenting.html
- [x] /resource-timing/resource_connection_reuse.html
- [x] /resource-timing/resource_script_types.html
- [x] /resource-timing/idlharness.any.html
- [x] /resource-timing/clear_resource_timing_functionality.html
- [x] /resource-timing/idlharness.any.worker.html
- [x] /resource-timing/resource_cached.htm
- [x] /resource-timing/resource_connection_reuse_mixed_content_redirect.html
- [x] /resource-timing/resource_connection_reuse_mixed_content.html
- [x] /resource-timing/resource_timing_buffer_full_when_shrink_buffer_size.html
- [x] /navigation-timing/idlharness.window.html
- [x] /navigation-timing/nav2_test_navigate_iframe.html
- [x] /navigation-timing/nav2_test_navigate_within_document.html
- [x] /resource-timing/resource_reuse.sub.html
- [x] /navigation-timing/nav2_test_instance_accessible_from_the_start.html
- [x] /resource-timing/resource_dedicated_worker.html
- [x] /navigation-timing/unload-event-same-origin-check.html
- [x] /navigation-timing/nav2_test_navigation_type_backforward.html

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23873)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-09-24 19:11:28 -04:00 committed by GitHub
commit e6b271d329
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 183 additions and 147 deletions

View file

@ -1,42 +1,42 @@
[idlharness.window.html]
[PerformanceNavigationTiming must be primary interface of performance.getEntriesByType("navigation")[0\]]
expected: FAIL
expected: PASS
[Stringification of performance.getEntriesByType("navigation")[0\]]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "unloadEventStart" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "unloadEventEnd" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domInteractive" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domContentLoadedEventStart" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domContentLoadedEventEnd" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "domComplete" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "loadEventStart" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "loadEventEnd" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "type" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "redirectCount" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: performance.getEntriesByType("navigation")[0\] must inherit property "toJSON()" with the proper type]
expected: FAIL
expected: PASS
[PerformanceNavigationTiming interface: default toJSON operation on performance.getEntriesByType("navigation")[0\]]
expected: FAIL

View file

@ -1,5 +0,0 @@
[nav2_test_document_open.html]
type: testharness
[Navigation Timing 2 WPT]
expected: FAIL

View file

@ -1,5 +0,0 @@
[nav2_test_frame_removed.html]
type: testharness
[Navigation Timing 2 WPT]
expected: FAIL

View file

@ -1,5 +1,5 @@
[nav2_test_instance_accessible_from_the_start.html]
type: testharness
[PerformanceNavigationTiming instance exists with reasonable values.]
expected: FAIL
expected: PASS

View file

@ -1,8 +1,8 @@
[nav2_test_navigate_iframe.html]
expected: ERROR
expected: OK
[PerformanceNavigationTiming.name updated in iframes]
expected: FAIL
[navigation.name updated when iframe URL changes]
expected: TIMEOUT
expected: PASS

View file

@ -1,5 +1,5 @@
[nav2_test_navigate_within_document.html]
type: testharness
[Navigation Timing 2 WPT]
expected: FAIL
expected: PASS

View file

@ -1,5 +1,6 @@
[nav2_test_navigation_type_backforward.html]
type: testharness
expected: TIMEOUT
[Navigation Timing 2 WPT]
expected: FAIL
expected: NOTRUN

View file

@ -1,4 +0,0 @@
[nav2_test_redirect_chain_xserver_partial_opt_in.html]
[Navigation Timing 2 WPT]
expected: FAIL

View file

@ -1,5 +0,0 @@
[nav2_test_redirect_xserver.html]
type: testharness
[Navigation Timing 2 WPT]
expected: FAIL

View file

@ -1,37 +1,37 @@
[unload-event-same-origin-check.html]
[Redirect chain with a partial TAO opt-in]
expected: FAIL
expected: PASS
[No previous document with same origin redirect]
expected: FAIL
[cross-cross-same Redirect chain with no TAO opt-in]
expected: FAIL
expected: PASS
[Same-cross-same redirect chain with no TAO opt-in]
expected: FAIL
expected: PASS
[Same origin previous document with same origin redirect]
expected: FAIL
[Redirect chain with full TAO opt-in]
expected: FAIL
expected: PASS
[Previous document same origin]
expected: FAIL
[No previous document]
expected: FAIL
expected: PASS
[No previous document with cross origin redirect]
expected: FAIL
expected: PASS
[Previous document cross origin]
expected: FAIL
expected: PASS
[No previous document with cross origin redirect with TAO]
expected: FAIL
expected: PASS
[No previous document with cross origin redirect with partial TAO]
expected: FAIL
expected: PASS

View file

@ -1,4 +0,0 @@
[not-clonable.html]
[Test that a postMessage of a performance entry fails]
expected: FAIL

View file

@ -1,4 +0,0 @@
[TAO-crossorigin-port.sub.html]
[Makes sure that the iframe passed the test and had an entry which passed the timing allow check]
expected: FAIL

View file

@ -1,6 +1,6 @@
[clear_resource_timing_functionality.html]
[4 resource timing entries should be stored in this page.]
expected: FAIL
expected: PASS
[No resource timing entries should be stored after clearResourceTimings.]
expected: FAIL

View file

@ -1,45 +1,45 @@
[idlharness.any.html]
[PerformanceResourceTiming interface: attribute transferSize]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute decodedBodySize]
expected: FAIL
expected: PASS
[Stringification of resource]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute encodedBodySize]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming must be primary interface of resource]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "workerStart" with the proper type]
expected: FAIL
[PerformanceResourceTiming interface: attribute secureConnectionStart]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "secureConnectionStart" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute workerStart]
expected: FAIL
[PerformanceResourceTiming interface: resource must inherit property "domainLookupEnd" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute domainLookupEnd]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: default toJSON operation on resource]
expected: FAIL
@ -50,37 +50,37 @@
expected: FAIL
[PerformanceResourceTiming interface: attribute transferSize]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "secureConnectionStart" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute decodedBodySize]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "domainLookupEnd" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute encodedBodySize]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute secureConnectionStart]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: attribute workerStart]
expected: FAIL
[PerformanceResourceTiming interface: attribute domainLookupEnd]
expected: FAIL
expected: PASS
[PerformanceResourceTiming interface: default toJSON operation on resource]
expected: FAIL

View file

@ -0,0 +1,3 @@
[resource_TAO_multi_wildcard.html]
[redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should not be all returned as 0 when the HTTP response has multiple Timing-Allow-Origin header fields and the subsequent field value is separated by a comma, i.e. TAO algorithm passes]
expected: FAIL

View file

@ -1,4 +0,0 @@
[resource_TAO_null.htm]
[redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the value of Timing-Allow-Origin is null and TAO algorithm fails]
expected: FAIL

View file

@ -1,4 +0,0 @@
[resource_TAO_origin_uppercase.htm]
[redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the value of Timing-Allow-Origin is NOT a case-sensitive match for the value of the origin of the current document and TAO algorithm passes]
expected: FAIL

View file

@ -1,4 +0,0 @@
[resource_TAO_space.htm]
[redirectStart, redirectEnd, domainLookupStart, domainLookupEnd, connectStart, connectEnd, secureConnectionStart, requestStart, and responseStart -- should be all returned as 0 when the Timing-Allow-Origin header value of the HTTP response is a space separated origin/wildcard list]
expected: FAIL

View file

@ -1,25 +0,0 @@
[resource_TAO_zero.htm]
[secureConnectionStart should be 0 in cross-origin request.]
expected: FAIL
[domainLookupEnd should be 0 in cross-origin request.]
expected: FAIL
[connectEnd should be 0 in cross-origin request.]
expected: FAIL
[connectStart should be 0 in cross-origin request.]
expected: FAIL
[There should be one resource timing entry.]
expected: FAIL
[requestStart should be 0 in cross-origin request.]
expected: FAIL
[domainLookupStart should be 0 in cross-origin request.]
expected: FAIL
[responseEnd should be greater than 0 in cross-origin request.]
expected: FAIL

View file

@ -1,4 +1,4 @@
[resource_cached.htm]
[There should be two entries]
expected: FAIL
expected: PASS

View file

@ -1,6 +1,6 @@
[resource_connection_reuse.html]
[There should be 2 PerformanceEntries]
expected: FAIL
expected: PASS
[domainLookupEnd and fetchStart should be the same]
expected: FAIL
@ -12,7 +12,7 @@
expected: FAIL
[secureConnectionStart should be zero]
expected: FAIL
expected: PASS
[connectEnd and fetchStart should be the same]
expected: FAIL

View file

@ -1,6 +1,6 @@
[resource_connection_reuse.https.html]
[There should be 2 PerformanceEntries]
expected: FAIL
expected: PASS
[secureConnectionStart and fetchStart should be the same]
expected: FAIL

View file

@ -1,6 +1,6 @@
[resource_connection_reuse_mixed_content.html]
[There should be 2 PerformanceEntries]
expected: FAIL
expected: PASS
[secureConnectionStart and fetchStart should be the same]
expected: FAIL

View file

@ -1,6 +1,6 @@
[resource_connection_reuse_mixed_content_redirect.html]
[There should be 2 PerformanceEntries]
expected: FAIL
expected: PASS
[secureConnectionStart and fetchStart should be the same]
expected: FAIL

View file

@ -0,0 +1,3 @@
[resource_dedicated_worker.html]
[There should be six entries: 4 scripts, 1 stylesheet, and the worker itself]
expected: FAIL

View file

@ -6,5 +6,5 @@
expected: FAIL
[Testing resource entries]
expected: FAIL
expected: PASS

View file

@ -1,4 +1,5 @@
[resource_reuse.sub.html]
expected: ERROR
[Testing resource entries]
expected: FAIL
@ -11,3 +12,6 @@
[requestStart should be non-zero on the same-origin request]
expected: FAIL
[There should be only one entry]
expected: FAIL

View file

@ -30,5 +30,5 @@
expected: FAIL
[Testing resource entries]
expected: FAIL
expected: PASS

View file

@ -3,5 +3,5 @@
expected: FAIL
[There are 4 scripts, and setResourceTimingBufferSize does not reduce the size.]
expected: FAIL
expected: PASS

View file

@ -9,9 +9,6 @@
[Can use clearMarks and clearMeasures in workers]
expected: FAIL
[Resource timing seems to work in workers]
expected: FAIL
[performance.clearResourceTimings in workers]
expected: FAIL