Index: fuzzer/res/imp/fuzzer-collapse-function-sk.html |
diff --git a/fuzzer/res/imp/fuzzer-collapse-function-sk.html b/fuzzer/res/imp/fuzzer-collapse-function-sk.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..317a807ba71b61d75b9bda9fb0dc6f7b2717d234 |
--- /dev/null |
+++ b/fuzzer/res/imp/fuzzer-collapse-function-sk.html |
@@ -0,0 +1,149 @@ |
+<!-- |
+ The fuzzer/res/fuzzer.js file must be included before this file. |
+ |
+ This in an HTML Import-able file that contains the definition |
+ of the following elements: |
+ |
+ <fuzzer-collapse-function-sk> |
+ |
+ To use this file import it: |
+ |
+ <link href="/res/imp/fuzzer-collapse-function-sk.html" rel="import" /> |
+ |
+ Usage: |
+ |
+ <fuzzer-collapse-function-sk></fuzzer-collapse-function-sk> |
+ |
+ Properties: |
+ func - The FunctionDetails object. Expected to have the following attributes: |
+ functionName: String, |
+ count: Number, |
+ byLineNumber: Array of Detail objects. See fuzzer-collapse-details-sk.html for schema. |
+ |
+ detailsBase: String, the base url for details (should include file name) |
+ expand: String, which should be "true" if the gui should start expanded |
+ numReports: Number, the dynamically computed sum of all child line counts. This is exposed |
+ as its own variable to make dynamically summing the file easier. |
+ exclude: Array of String, all fuzzes that have one or more of these strings as a flag will not |
+ be shown. This array must be sorted lexographically. |
+ include: Array of String, all fuzzes must have one or more of these strings as a flag to be |
+ shown. This array must be sorted lexographically. |
+ |
+ Methods: |
+ setFunc(func) - Programmatically set the FunctionDetails object. |
+ |
+ Events: |
+ None. |
+--> |
+<link rel="import" href="/res/common/imp/9/details-summary.html"> |
+<link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.html"> |
+<link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> |
+<link rel="import" href="fuzzer-collapse-details-sk.html"> |
+<dom-module id="fuzzer-collapse-function-sk"> |
+ <template> |
+ <style> |
+ .func { |
+ padding: 20px; |
+ border-radius: 10px; |
+ background-color: #E5E5E5; |
+ color: #000000; |
+ display:block; |
+ } |
+ |
+ ul { |
+ list-style-type: none; |
+ } |
+ </style> |
+ <details-sk id="func" class="func" open="[[expand]]" > |
+ <summary-sk> |
+ <span> |
+ <a href$="{{_getDetailsLink(detailsBase, func)}}">Function {{func.functionName}}</a> |
+ -- {{numReports}} crash-causing fuzzes |
+ </span> |
+ </summary-sk> |
+ <ul> |
+ <template is="dom-repeat" items="{{func.byLineNumber}}" as="lineNumber"> |
+ <fuzzer-collapse-details-sk class="line-group" |
+ details="[[lineNumber]]" |
+ details-base="[[_getDetailsLink(detailsBase, func)]]" |
+ expand="[[_expandFirst(index)]]" |
+ exclude="[[exclude]]" |
+ include="[[include]]" |
+ on-dom-change="_recount"> |
+ </fuzzer-collapse-details-sk> |
+ </template> |
+ </ul> |
+ </div> |
+ </template> |
+ <script> |
+ Polymer({ |
+ is: 'fuzzer-collapse-function-sk', |
+ |
+ properties: { |
+ func: { |
+ type: Object, |
+ value: function() { |
+ return {}; |
+ }, |
+ }, |
+ detailsBase: { |
+ type: String, |
+ value: "" |
+ }, |
+ expand: { |
+ type: Boolean, |
+ value: false |
+ }, |
+ exclude: { |
+ type: Array, |
+ value: function() { |
+ return []; |
+ }, |
+ }, |
+ include: { |
+ type: Array, |
+ value: function() { |
+ return []; |
+ }, |
+ }, |
+ numReports: { |
+ type: Number, |
+ value: 1, |
+ notify: true, |
+ } |
+ }, |
+ |
+ _recount: function() { |
+ this.debounce("recount-function", function(){ |
+ var lines = $$(".line-group", this.$.func); |
+ var sum = 0; |
+ lines.forEach(function(a){ |
+ sum += a.numReports; |
+ }); |
+ // Allows the parent file to easily add up functions. |
+ this.set("numReports", sum); |
+ // Allows the functions to be sorted. |
+ this.set("func.count", sum); |
+ }.bind(this), 10); |
+ |
+ }, |
+ |
+ setFunc: function(func){ |
+ this.func = func; |
+ this._recount(); |
+ }, |
+ |
+ _expandFirst: function(index) { |
+ return index === 0; |
+ }, |
+ |
+ _getDetailsLink: function(detailsBase, func) { |
+ if (!file) { |
+ return "#"; |
+ } |
+ return fuzzer.getLinkToDetails(detailsBase, "func", func.functionName); |
+ }, |
+ |
+ }); |
+ </script> |
+</dom-module> |