OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 The fuzzer/res/fuzzer.js file must be included before this file. |
| 3 |
| 4 This in an HTML Import-able file that contains the definition |
| 5 of the following elements: |
| 6 |
| 7 <fuzzer-collapse-function-sk> |
| 8 |
| 9 To use this file import it: |
| 10 |
| 11 <link href="/res/imp/fuzzer-collapse-function-sk.html" rel="import" /> |
| 12 |
| 13 Usage: |
| 14 |
| 15 <fuzzer-collapse-function-sk></fuzzer-collapse-function-sk> |
| 16 |
| 17 Properties: |
| 18 func - The FunctionDetails object. Expected to have the following attribute
s: |
| 19 functionName: String, |
| 20 count: Number, |
| 21 byLineNumber: Array of Detail objects. See fuzzer-collapse-details-sk.htm
l for schema. |
| 22 |
| 23 detailsBase: String, the base url for details (should include file name) |
| 24 expand: String, which should be "true" if the gui should start expanded |
| 25 numReports: Number, the dynamically computed sum of all child line counts.
This is exposed |
| 26 as its own variable to make dynamically summing the file easier. |
| 27 exclude: Array of String, all fuzzes that have one or more of these strings
as a flag will not |
| 28 be shown. This array must be sorted lexographically. |
| 29 include: Array of String, all fuzzes must have one or more of these strings
as a flag to be |
| 30 shown. This array must be sorted lexographically. |
| 31 |
| 32 Methods: |
| 33 setFunc(func) - Programmatically set the FunctionDetails object. |
| 34 |
| 35 Events: |
| 36 None. |
| 37 --> |
| 38 <link rel="import" href="/res/common/imp/9/details-summary.html"> |
| 39 <link rel="import" href="/res/imp/bower_components/iron-collapse/iron-collapse.h
tml"> |
| 40 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> |
| 41 <link rel="import" href="fuzzer-collapse-details-sk.html"> |
| 42 <dom-module id="fuzzer-collapse-function-sk"> |
| 43 <template> |
| 44 <style> |
| 45 .func { |
| 46 padding: 20px; |
| 47 border-radius: 10px; |
| 48 background-color: #E5E5E5; |
| 49 color: #000000; |
| 50 display:block; |
| 51 } |
| 52 |
| 53 ul { |
| 54 list-style-type: none; |
| 55 } |
| 56 </style> |
| 57 <details-sk id="func" class="func" open="[[expand]]" > |
| 58 <summary-sk> |
| 59 <span> |
| 60 <a href$="{{_getDetailsLink(detailsBase, func)}}">Function {{func.func
tionName}}</a> |
| 61 -- {{numReports}} crash-causing fuzzes |
| 62 </span> |
| 63 </summary-sk> |
| 64 <ul> |
| 65 <template is="dom-repeat" items="{{func.byLineNumber}}" as="lineNumber"> |
| 66 <fuzzer-collapse-details-sk class="line-group" |
| 67 details="[[lineNumber]]" |
| 68 details-base="[[_getDetailsLink(detailsBase, func)]]" |
| 69 expand="[[_expandFirst(index)]]" |
| 70 exclude="[[exclude]]" |
| 71 include="[[include]]" |
| 72 on-dom-change="_recount"> |
| 73 </fuzzer-collapse-details-sk> |
| 74 </template> |
| 75 </ul> |
| 76 </div> |
| 77 </template> |
| 78 <script> |
| 79 Polymer({ |
| 80 is: 'fuzzer-collapse-function-sk', |
| 81 |
| 82 properties: { |
| 83 func: { |
| 84 type: Object, |
| 85 value: function() { |
| 86 return {}; |
| 87 }, |
| 88 }, |
| 89 detailsBase: { |
| 90 type: String, |
| 91 value: "" |
| 92 }, |
| 93 expand: { |
| 94 type: Boolean, |
| 95 value: false |
| 96 }, |
| 97 exclude: { |
| 98 type: Array, |
| 99 value: function() { |
| 100 return []; |
| 101 }, |
| 102 }, |
| 103 include: { |
| 104 type: Array, |
| 105 value: function() { |
| 106 return []; |
| 107 }, |
| 108 }, |
| 109 numReports: { |
| 110 type: Number, |
| 111 value: 1, |
| 112 notify: true, |
| 113 } |
| 114 }, |
| 115 |
| 116 _recount: function() { |
| 117 this.debounce("recount-function", function(){ |
| 118 var lines = $$(".line-group", this.$.func); |
| 119 var sum = 0; |
| 120 lines.forEach(function(a){ |
| 121 sum += a.numReports; |
| 122 }); |
| 123 // Allows the parent file to easily add up functions. |
| 124 this.set("numReports", sum); |
| 125 // Allows the functions to be sorted. |
| 126 this.set("func.count", sum); |
| 127 }.bind(this), 10); |
| 128 |
| 129 }, |
| 130 |
| 131 setFunc: function(func){ |
| 132 this.func = func; |
| 133 this._recount(); |
| 134 }, |
| 135 |
| 136 _expandFirst: function(index) { |
| 137 return index === 0; |
| 138 }, |
| 139 |
| 140 _getDetailsLink: function(detailsBase, func) { |
| 141 if (!file) { |
| 142 return "#"; |
| 143 } |
| 144 return fuzzer.getLinkToDetails(detailsBase, "func", func.functionName); |
| 145 }, |
| 146 |
| 147 }); |
| 148 </script> |
| 149 </dom-module> |
OLD | NEW |