blob: 9bcc475f26ba07ffff90ba2211c77e041ce4ad16 [file] [log] [blame]
<!--
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
Methods:
setFunc(func) - Programmatically set the FunctionDetails object.
Events:
None.
-->
<link rel="import" href="/res/common/imp/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>
-- {{func.count}} crash-causing fuzzes
</span>
</summary-sk>
<ul>
<template is="dom-repeat" items="{{func.byLineNumber}}" as="lineNumber" sort="_byCount">
<fuzzer-collapse-details-sk class="line-group"
details="[[lineNumber]]"
details-base="[[_getDetailsLink(detailsBase, func)]]"
expand="[[_expandFirst(index)]]">
</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
},
},
setFunc: function(func){
this.func = func;
this._recount();
},
_expandFirst: function(index) {
return index === 0;
},
_byCount: function(a, b) {
// Higher counts come first
return b.count - a.count;
},
_getDetailsLink: function(detailsBase, func) {
if (!file) {
return "#";
}
return fuzzer.getLinkToDetails(detailsBase, "func", func.functionName);
},
});
</script>
</dom-module>