aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-06-19 13:06:02 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-06-19 13:07:54 +0200
commit7bdf6e025f1fbbbc7af65f80ff7aa5922ff8e252 (patch)
tree4a84fc10527021d9fc947601a414ab12748bc3d9
parent732e4256fb6f7221d07af3d900951d77eabff611 (diff)
dashboard/app: fix table sorting on firefox
Under Firefox 60 browser, sort operation does not work and ReferenceError: event is not defined error message is printed in the Web Console window. Let's explicitly pass an object reference to the sortTable function. Credit goes to Tetsuo Handa.
-rw-r--r--dashboard/app/bug.html22
-rw-r--r--dashboard/app/static/common.js4
-rw-r--r--dashboard/app/templates.html20
3 files changed, 23 insertions, 23 deletions
diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html
index 580454e23..c421b9db3 100644
--- a/dashboard/app/bug.html
+++ b/dashboard/app/bug.html
@@ -37,17 +37,17 @@ Page with details about a single bug.
<table class="list_table">
<caption>All crashes ({{.Bug.NumCrashes}}):</caption>
<tr>
- <th><a onclick="return sortTable('Manager', textSort)" href="#">Manager</a></th>
- <th><a onclick="return sortTable('Time', dateSort)" href="#">Time</a></th>
- <th><a onclick="return sortTable('Kernel', textSort)" href="#">Kernel</a></th>
- <th><a onclick="return sortTable('Commit', textSort)" href="#">Commit</a></th>
- <th><a onclick="return sortTable('Syzkaller', textSort)" href="#">Syzkaller</a></th>
- <th><a onclick="return sortTable('Config', textSort)" href="#">Config</a></th>
- <th><a onclick="return sortTable('Log', textSort)" href="#">Log</a></th>
- <th><a onclick="return sortTable('Report', reproSort)" href="#">Report</a></th>
- <th><a onclick="return sortTable('Syz repro', reproSort)" href="#">Syz repro</a></th>
- <th><a onclick="return sortTable('C repro', textSort)" href="#">C repro</a></th>
- <th><a onclick="return sortTable('Maintainers', textSort)" href="#">Maintainers</a></th>
+ <th><a onclick="return sortTable(this, 'Manager', textSort)" href="#">Manager</a></th>
+ <th><a onclick="return sortTable(this, 'Time', dateSort)" href="#">Time</a></th>
+ <th><a onclick="return sortTable(this, 'Kernel', textSort)" href="#">Kernel</a></th>
+ <th><a onclick="return sortTable(this, 'Commit', textSort)" href="#">Commit</a></th>
+ <th><a onclick="return sortTable(this, 'Syzkaller', textSort)" href="#">Syzkaller</a></th>
+ <th><a onclick="return sortTable(this, 'Config', textSort)" href="#">Config</a></th>
+ <th><a onclick="return sortTable(this, 'Log', textSort)" href="#">Log</a></th>
+ <th><a onclick="return sortTable(this, 'Report', reproSort)" href="#">Report</a></th>
+ <th><a onclick="return sortTable(this, 'Syz repro', reproSort)" href="#">Syz repro</a></th>
+ <th><a onclick="return sortTable(this, 'C repro', textSort)" href="#">C repro</a></th>
+ <th><a onclick="return sortTable(this, 'Maintainers', textSort)" href="#">Maintainers</a></th>
</tr>
{{range $c := $.Crashes}}
<tr>
diff --git a/dashboard/app/static/common.js b/dashboard/app/static/common.js
index c2e021d81..5b4f8737c 100644
--- a/dashboard/app/static/common.js
+++ b/dashboard/app/static/common.js
@@ -1,8 +1,8 @@
// Copyright 2018 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
-function sortTable(colName, conv) {
- table = event.srcElement.parentNode.parentNode.parentNode;
+function sortTable(item, colName, conv) {
+ table = item.parentNode.parentNode.parentNode;
rows = table.getElementsByTagName("tr");
col = findColumnByName(rows[0].getElementsByTagName("th"), colName);
values = new Array;
diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html
index 7ad794cf3..772135fa7 100644
--- a/dashboard/app/templates.html
+++ b/dashboard/app/templates.html
@@ -48,22 +48,22 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the
<caption id="{{.Fragment}}">{{$.Caption}}:</caption>
<tr>
{{if $.ShowNamespace}}
- <th><a onclick="return sortTable('Kernel', textSort)" href="#">Kernel</a></th>
+ <th><a onclick="return sortTable(this, 'Kernel', textSort)" href="#">Kernel</a></th>
{{end}}
- <th><a onclick="return sortTable('Title', textSort)" href="#">Title</a></th>
- <th><a onclick="return sortTable('Repro', reproSort)" href="#">Repro</a></th>
- <th><a onclick="return sortTable('Count', numSort)" href="#">Count</a></th>
- <th><a onclick="return sortTable('Last', timeSort)" href="#">Last</a></th>
- <th><a onclick="return sortTable('Reported', timeSort)" href="#">Reported</a></th>
+ <th><a onclick="return sortTable(this, 'Title', textSort)" href="#">Title</a></th>
+ <th><a onclick="return sortTable(this, 'Repro', reproSort)" href="#">Repro</a></th>
+ <th><a onclick="return sortTable(this, 'Count', numSort)" href="#">Count</a></th>
+ <th><a onclick="return sortTable(this, 'Last', timeSort)" href="#">Last</a></th>
+ <th><a onclick="return sortTable(this, 'Reported', timeSort)" href="#">Reported</a></th>
{{if $.ShowPatch}}
- <th><a onclick="return sortTable('Closed', timeSort)" href="#">Closed</a></th>
- <th><a onclick="return sortTable('Patch', textSort)" href="#">Patch</a></th>
+ <th><a onclick="return sortTable(this, 'Closed', timeSort)" href="#">Closed</a></th>
+ <th><a onclick="return sortTable(this, 'Patch', textSort)" href="#">Patch</a></th>
{{end}}
{{if $.ShowPatched}}
- <th><a onclick="return sortTable('Patched', patchedSort)" href="#">Patched</a></th>
+ <th><a onclick="return sortTable(this, 'Patched', patchedSort)" href="#">Patched</a></th>
{{end}}
{{if $.ShowStatus}}
- <th><a onclick="return sortTable('Status', textSort)" href="#">Status</a></th>
+ <th><a onclick="return sortTable(this, 'Status', textSort)" href="#">Status</a></th>
{{end}}
</tr>
{{range $b := .Bugs}}