@@ -9,7 +9,9 @@ import { benchmark } from "./generated/pings.js";
99import * as metrics from "./generated/sample.js" ;
1010
1111Glean . setSourceTags ( [ "automation" ] ) ;
12- Glean . initialize ( "glean-compat-benchmark" , true ) ;
12+ Glean . initialize ( "glean-compat-benchmark" , true , {
13+ enableAutoPageLoadEvents : true
14+ } ) ;
1315
1416metrics . pageLoaded . set ( ) ;
1517benchmark . submit ( ) ;
@@ -18,6 +20,7 @@ benchmark.submit();
1820//
1921// Overwrite the console.info function in order to know when (and if) the benchmark ping was sent.
2022// If a success ping message is logged we show that in the document.
23+ let pingSubmissionCount = 0 ;
2124console . info = function ( ) {
2225 var message = "" ;
2326 for ( var i = 0 ; i < arguments . length ; i ++ ) {
@@ -29,7 +32,14 @@ console.info = function () {
2932 }
3033 console . log ( message ) ;
3134 if ( / s u c c e s s f u l l y s e n t 2 0 0 .$ / . test ( message ) ) {
32- var elem = document . getElementById ( "msg" ) ;
33- elem . innerHTML = "Ping submitted successfully." ;
35+ pingSubmissionCount ++ ;
36+
37+ // Two pings should be submitted when run successfully
38+ // 1. The built-in page_load event, which submits an events ping.
39+ // 2. The benchmark ping.
40+ if ( pingSubmissionCount == 2 ) {
41+ var elem = document . getElementById ( "msg" ) ;
42+ elem . innerHTML = "Pings submitted successfully." ;
43+ }
3444 }
3545}
0 commit comments