Skip to content

Commit

Permalink
Merge branch 'master' of github.com:WPO-Foundation/wptagent
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeenan committed May 1, 2020
2 parents 9c9e15d + 8a6f608 commit 3c70851
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions internal/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,12 @@ def on_stop_recording(self, task):
interactive_file = os.path.join(task['dir'], task['prefix'] + '_interactive.json.gz')
with gzip.open(interactive_file, GZIP_TEXT, 7) as f_out:
f_out.write(interactive)
long_tasks = self.execute_js('window.wrappedJSObject.wptagentGetLongTasks();')
if long_tasks is not None and len(long_tasks):
long_tasks_file = os.path.join(task['dir'], task['prefix'] + '_long_tasks.json.gz')
with gzip.open(long_tasks_file, GZIP_TEXT, 7) as f_out:
f_out.write(long_tasks)
self.execute_js('window.wrappedJSObject.wptagentResetLongTasks();')
# Close the browser if we are done testing (helps flush logs)
if not len(task['script']):
self.close_browser(self.job, task)
Expand Down
1 change: 1 addition & 0 deletions internal/safari_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ def on_start_processing(self, task):
self.trace_parser.WriteCPUSlices(self.path_base + '_timeline_cpu.json.gz')
self.trace_parser.WriteScriptTimings(self.path_base + '_script_timing.json.gz')
self.trace_parser.WriteInteractive(self.path_base + '_interactive.json.gz')
self.trace_parser.WriteLongTasks(self.path_base + '_long_tasks.json.gz')
elapsed = monotonic() - start
logging.debug("Done processing the trace events: %0.3fs", elapsed)
self.trace_parser = None
Expand Down
12 changes: 11 additions & 1 deletion internal/support/Firefox/extension/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ function wptagentGetInteractivePeriods() {
start = longTasks[i][1];
}
interactive.push([start, now]);
return JSON.stringify(interactive);
}

function wptagentGetLongTasks() {
checkLongTask();
return JSON.stringify(longTasks);
}

function wptagentResetLongTasks() {
longTasks = [];
startTime = now;
return JSON.stringify(interactive);
}

exportFunction(wptagentGetInteractivePeriods, window, {defineAs:'wptagentGetInteractivePeriods'});
exportFunction(wptagentGetLongTasks, window, {defineAs:'wptagentGetLongTasks'});
exportFunction(wptagentResetLongTasks, window, {defineAs:'wptagentResetLongTasks'});

0 comments on commit 3c70851

Please sign in to comment.