OLD | NEW |
1 <!-- | 1 <!-- |
2 The fuzzer/res/fuzzer.js file must be included before this file. | 2 The fuzzer/res/fuzzer.js file must be included before this file. |
3 | 3 |
4 This in an HTML Import-able file that contains the definition | 4 This in an HTML Import-able file that contains the definition |
5 of the following elements: | 5 of the following elements: |
6 | 6 |
7 <fuzzer-collapse-file-sk> | 7 <fuzzer-collapse-file-sk> |
8 | 8 |
9 This element will poll /json/list | 9 This element will poll /json/list |
10 | 10 |
11 To use this file import it: | 11 To use this file import it: |
12 | 12 |
13 <link href="/res/imp/fuzzer-collapse-file-sk.html" rel="import" /> | 13 <link href="/res/imp/fuzzer-collapse-file-sk.html" rel="import" /> |
14 | 14 |
15 Usage: | 15 Usage: |
16 | 16 |
17 <fuzzer-collapse-file-sk></fuzzer-collapse-file-sk> | 17 <fuzzer-collapse-file-sk></fuzzer-collapse-file-sk> |
18 | 18 |
19 Properties: | 19 Properties: |
20 file - The FileDetails object. Expected to have the following attributes: | 20 file - The FileDetails object. Expected to have the following attributes: |
21 fileName: String, | 21 fileName: String, |
22 count: Number, | 22 count: Number, |
23 byFunction: Array of FunctionDetail objects. See fuzzer-collapse-function
-sk.html for schema. | 23 byFunction: Array of FunctionDetail objects. See fuzzer-collapse-function
-sk.html for schema. |
24 | 24 |
25 expand: String, which should be "true" if the element and any children shoul
d start expanded. | 25 expand: String, which should be "true" if the element and any children shoul
d start expanded. |
| 26 exclude: Array of String, all fuzzes that have one or more of these strings
as a flag will not |
| 27 be shown. This array must be sorted lexographically. |
| 28 include: Array of String, all fuzzes must have one or more of these strings
as a flag to be |
| 29 shown. This array must be sorted lexographically. |
| 30 |
26 Methods: | 31 Methods: |
27 setFile(file) - Programmatically set the FileDetails object. | 32 setFile(file) - Programmatically set the FileDetails object. |
28 toggleLineNumbers() - Programmtically expand/collapse the function details. | 33 toggleLineNumbers() - Programmtically expand/collapse the function details. |
29 | 34 |
30 Events: | 35 Events: |
31 None. | 36 None. |
32 --> | 37 --> |
33 <link rel="import" href="/res/common/imp/9/details-summary.html"> | 38 <link rel="import" href="/res/common/imp/9/details-summary.html"> |
34 <link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.h
tml"> | 39 <link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.h
tml"> |
35 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> | 40 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> |
36 <link rel="import" href="fuzzer-collapse-details-sk.html" /> | 41 <link rel="import" href="fuzzer-collapse-function-sk.html" /> |
37 <dom-module id="fuzzer-collapse-file-sk"> | 42 <dom-module id="fuzzer-collapse-file-sk"> |
38 <template> | 43 <template> |
39 <style> | 44 <style> |
40 #file { | 45 #file { |
41 padding: 20px; | 46 padding: 20px; |
42 margin: 10px; | 47 margin: 10px; |
43 border-radius: 10px; | 48 border-radius: 10px; |
44 background-color: #F5F5F5; | 49 background-color: #F5F5F5; |
45 color: #000000; | 50 color: #000000; |
46 display:block; | 51 display:block; |
(...skipping 16 matching lines...) Expand all Loading... |
63 list-style-type: none; | 68 list-style-type: none; |
64 } | 69 } |
65 </style> | 70 </style> |
66 <details-sk id="file" open="[[expand]]"> | 71 <details-sk id="file" open="[[expand]]"> |
67 <summary-sk> | 72 <summary-sk> |
68 <h3> | 73 <h3> |
69 <a href$="{{_getDetailsLink(category, file)}}">{{file.fileName}}</a> | 74 <a href$="{{_getDetailsLink(category, file)}}">{{file.fileName}}</a> |
70 -- {{file.count}} crash-causing fuzzes | 75 -- {{file.count}} crash-causing fuzzes |
71 </h3> | 76 </h3> |
72 </summary-sk> | 77 </summary-sk> |
73 <template is="dom-repeat" items="{{file.byFunction}}" as="func"> | 78 <template is="dom-repeat" items="{{file.byFunction}}" as="func" sort="_by
Count" observe="count"> |
74 <details-sk class="func" open="[[expand]]"> | 79 <fuzzer-collapse-function-sk |
75 <summary-sk> | 80 class="func-group" |
76 <span> | 81 expand="[[expand]]" |
77 <a href$="{{_getDetailsLink(category, file, func)}}">Function {{fu
nc.functionName}}</a> | 82 func="{{func}}" |
78 -- {{func.count}} crash-causing fuzzes | 83 exclude="[[exclude]]" |
79 </span> | 84 include="[[include]]" |
80 </summary-sk> | 85 details-base="{{_getDetailsLink(category, file)}}" |
81 <ul> | 86 on-dom-change="_recount" |
82 <template is="dom-repeat" items="{{func.byLineNumber}}" as="lineNumb
er"> | 87 ></fuzzer-collapse-function-sk> |
83 <fuzzer-collapse-details-sk details="{{lineNumber}}" details-base=
"{{_getDetailsLink(category, file, func)}}" expand="{{_expandFirst(index)}}"></f
uzzer-collapse-details-sk> | |
84 </template> | |
85 </ul> | |
86 </details-sk> | |
87 </template> | 88 </template> |
88 </details-sk> | 89 </details-sk> |
89 </template> | 90 </template> |
90 <script> | 91 <script> |
91 Polymer({ | 92 Polymer({ |
92 is: 'fuzzer-collapse-file-sk', | 93 is: 'fuzzer-collapse-file-sk', |
93 | 94 |
94 properties: { | 95 properties: { |
95 file: { //expected to be provided | 96 file: { //expected to be provided |
96 type: Object, | 97 type: Object, |
97 value: function() { | 98 value: function() { |
98 return {}; | 99 return {}; |
99 }, | 100 }, |
100 }, | 101 }, |
101 category: { | 102 category: { |
102 type: String, | 103 type: String, |
103 value: "", | 104 value: "", |
104 }, | 105 }, |
105 // We can use one-way [[]] bindings to initialize all of the details-sk, | 106 // We can use one-way [[]] bindings to initialize all of the details-sk, |
106 // but keep their open states untangled. | 107 // but keep their open states untangled. |
107 expand: { | 108 expand: { |
108 type: Boolean, | 109 type: Boolean, |
109 value: false, | 110 value: false, |
110 }, | 111 }, |
| 112 exclude: { |
| 113 type: Array, |
| 114 value: function() { |
| 115 return []; |
| 116 }, |
| 117 }, |
| 118 include: { |
| 119 type: Array, |
| 120 value: function() { |
| 121 return []; |
| 122 }, |
| 123 }, |
| 124 }, |
| 125 |
| 126 _recount: function() { |
| 127 this.debounce("recount-file", function(){ |
| 128 this.flushDebouncer("recount-function"); |
| 129 var funcs = $$(".func-group", this.$.file); |
| 130 var sum = 0; |
| 131 funcs.forEach(function(a){ |
| 132 sum += a.numReports; |
| 133 }); |
| 134 this.set("file.count", sum); |
| 135 }.bind(this), 10); |
| 136 |
111 }, | 137 }, |
112 | 138 |
113 setFile: function(file) { | 139 setFile: function(file) { |
114 this.file = file; | 140 this.file = file; |
115 }, | 141 }, |
116 | 142 |
117 _expandFirst: function(index) { | |
118 return index === 0; | |
119 }, | |
120 | |
121 _getDetailsLink: function(category, file, func) { | 143 _getDetailsLink: function(category, file, func) { |
122 if (!file) { | 144 if (!file) { |
123 return "#"; | 145 return "#"; |
124 } | 146 } |
125 var base = fuzzer.getLinkToDetails("/category/"+category, "file", file.fil
eName); | 147 var base = fuzzer.getLinkToDetails("/category/"+category, "file", file.fil
eName); |
126 if (func) { | 148 if (func) { |
127 base = fuzzer.getLinkToDetails(base, "func", func.functionName); | 149 base = fuzzer.getLinkToDetails(base, "func", func.functionName); |
128 } | 150 } |
129 return base; | 151 return base; |
130 }, | 152 }, |
| 153 _byCount: function(a, b) { |
| 154 // Higher counts come first |
| 155 return b.count - a.count; |
| 156 } |
131 }); | 157 }); |
132 </script> | 158 </script> |
133 </dom-module> | 159 </dom-module> |
OLD | NEW |