EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/296640

Change subject: search satisfaction: use domInteractive instead of domComplete
......................................................................

search satisfaction: use domInteractive instead of domComplete

jQuery.ready fires after the DOMContentLoaded event. We are not
guaranteed to have domComplete at this point, so change to the
domInteractive timing which always fires before DOMContentLoaded.

Bug: T132516
Change-Id: Ife7f3e5a999dbb1a8c27cdaa8c8e12c4c6f5cfab
---
M modules/ext.wikimediaEvents.searchSatisfaction.js
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/40/296640/1

diff --git a/modules/ext.wikimediaEvents.searchSatisfaction.js 
b/modules/ext.wikimediaEvents.searchSatisfaction.js
index 812fc2e..c478bfe 100644
--- a/modules/ext.wikimediaEvents.searchSatisfaction.js
+++ b/modules/ext.wikimediaEvents.searchSatisfaction.js
@@ -431,7 +431,7 @@
         * @param {SessionState} session
         */
        function setupSearchTest( session ) {
-               var params,
+               var params, logEventWrapper,
                        textCatExtra = [],
                        logEvent = genLogEventFn( 'fulltext', session );
 
@@ -487,10 +487,13 @@
                                hitsReturned: $( '.mw-search-result-heading' 
).length,
                                extraParams: textCatExtra.join( ',' )
                        };
+                       // This method is called from jQuery.ready which runs 
on DOMContentLoaded. Use domInteractive since that
+                       // is immediately before DOMContentLoaded per spec.
                        if ( window.performance && window.performance.timing ) {
-                               params.msToDisplayResults = 
window.performance.timing.domComplete - 
window.performance.timing.navigationStart;
+                               params.msToDisplayResults = 
window.performance.timing.domInteractive - 
window.performance.timing.navigationStart;
                        }
                        logEvent( 'searchResultPage', params );
+                       } );
                } else if ( search.cameFromSearch ) {
                        logEvent( 'visitPage', {
                                position: search.resultPosition

-- 
To view, visit https://gerrit.wikimedia.org/r/296640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ife7f3e5a999dbb1a8c27cdaa8c8e12c4c6f5cfab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to