Skip to content

Commit 3c70851

Browse files
committed
Merge branch 'master' of github.com:WPO-Foundation/wptagent
2 parents 9c9e15d + 8a6f608 commit 3c70851

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

internal/firefox.py

+6
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,12 @@ def on_stop_recording(self, task):
668668
interactive_file = os.path.join(task['dir'], task['prefix'] + '_interactive.json.gz')
669669
with gzip.open(interactive_file, GZIP_TEXT, 7) as f_out:
670670
f_out.write(interactive)
671+
long_tasks = self.execute_js('window.wrappedJSObject.wptagentGetLongTasks();')
672+
if long_tasks is not None and len(long_tasks):
673+
long_tasks_file = os.path.join(task['dir'], task['prefix'] + '_long_tasks.json.gz')
674+
with gzip.open(long_tasks_file, GZIP_TEXT, 7) as f_out:
675+
f_out.write(long_tasks)
676+
self.execute_js('window.wrappedJSObject.wptagentResetLongTasks();')
671677
# Close the browser if we are done testing (helps flush logs)
672678
if not len(task['script']):
673679
self.close_browser(self.job, task)

internal/safari_ios.py

+1
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ def on_start_processing(self, task):
978978
self.trace_parser.WriteCPUSlices(self.path_base + '_timeline_cpu.json.gz')
979979
self.trace_parser.WriteScriptTimings(self.path_base + '_script_timing.json.gz')
980980
self.trace_parser.WriteInteractive(self.path_base + '_interactive.json.gz')
981+
self.trace_parser.WriteLongTasks(self.path_base + '_long_tasks.json.gz')
981982
elapsed = monotonic() - start
982983
logging.debug("Done processing the trace events: %0.3fs", elapsed)
983984
self.trace_parser = None

internal/support/Firefox/extension/content-script.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@ function wptagentGetInteractivePeriods() {
3131
start = longTasks[i][1];
3232
}
3333
interactive.push([start, now]);
34+
return JSON.stringify(interactive);
35+
}
36+
37+
function wptagentGetLongTasks() {
38+
checkLongTask();
39+
return JSON.stringify(longTasks);
40+
}
41+
42+
function wptagentResetLongTasks() {
3443
longTasks = [];
3544
startTime = now;
36-
return JSON.stringify(interactive);
3745
}
3846

3947
exportFunction(wptagentGetInteractivePeriods, window, {defineAs:'wptagentGetInteractivePeriods'});
48+
exportFunction(wptagentGetLongTasks, window, {defineAs:'wptagentGetLongTasks'});
49+
exportFunction(wptagentResetLongTasks, window, {defineAs:'wptagentResetLongTasks'});

0 commit comments

Comments
 (0)