jenkins-bot has submitted this change and it was merged.
Change subject: Expand coverage of conformance test
......................................................................
Expand coverage of conformance test
Cover the full set of Navigation Timing markers in the attribute order
conformance test. Previously-omitted markers which are now included in
the test:
* domComplete
* domLoading
* domainLookupEnd
* domainLookupStart
* fetchStart
* navigationStart
* secureConnectionStart
Change-Id: I62e20087c1abddf8871d7b0235c32e81956723c5
---
M modules/ext.navigationTiming.js
1 file changed, 53 insertions(+), 16 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ext.navigationTiming.js b/modules/ext.navigationTiming.js
index 0446020..bda58bb 100644
--- a/modules/ext.navigationTiming.js
+++ b/modules/ext.navigationTiming.js
@@ -36,26 +36,63 @@
}
/**
- * Assert that the attribute order complies with the W3C spec
+ * Check if the order of Navigation Timing marker values conforms
+ * to the specification.
+ *
+ * Markers may be undefined or zero if they are not implemented or not
+ * applicable to the current page. Markers which have a value must be
+ * in ascending order.
*
* @return {boolean}
*/
function isCompliant() {
- // Tests derived from
- //
<http://w3c-test.org/navigation-timing/test_timing_attributes_order.html>
- return (
- timing
&&
- timing.loadEventEnd >=
timing.loadEventStart &&
- timing.loadEventStart >=
timing.domContentLoadedEventEnd &&
- timing.domContentLoadedEventEnd >=
timing.domContentLoadedEventStart &&
- timing.domContentLoadedEventStart >=
timing.domInteractive &&
- timing.domInteractive >= timing.responseEnd
&&
- timing.responseEnd >=
timing.responseStart &&
- timing.responseStart >=
timing.requestStart &&
- timing.requestStart >= timing.connectEnd
&&
- timing.connectEnd >=
timing.connectStart &&
- timing.connectStart >= 0
- );
+ var sequences, markers, curr, prev;
+
+ if ( !timing ) {
+ return false;
+ }
+
+ sequences = [ [
+ 'navigationStart',
+ 'fetchStart',
+ 'domainLookupStart',
+ 'domainLookupEnd',
+ 'connectStart',
+ 'connectEnd',
+ 'requestStart',
+ 'responseStart',
+ 'responseEnd',
+ 'domInteractive',
+ 'domContentLoadedEventStart',
+ 'domContentLoadedEventEnd',
+ 'loadEventStart',
+ 'loadEventEnd'
+ ], [
+ 'secureConnectionStart',
+ 'requestStart'
+ ], [
+ 'fetchStart',
+ 'domLoading'
+ ], [
+ 'domContentLoadedEventEnd',
+ 'domComplete'
+ ] ];
+
+ while ( sequences.length ) {
+ markers = sequences.shift();
+ prev = null;
+ while ( markers.length ) {
+ curr = timing[ markers.shift() ];
+ if ( curr ) {
+ if ( curr < prev ) {
+ return false;
+ }
+ prev = curr;
+ }
+ }
+ }
+
+ return true;
}
function getNavTiming() {
--
To view, visit https://gerrit.wikimedia.org/r/287028
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I62e20087c1abddf8871d7b0235c32e81956723c5
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Phedenskog <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits