OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 The common.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-stacktrace-sk> |
| 8 |
| 9 <fuzzer-stacktrace-sk> displays a strack trace showing the first 8 frames and
can be expanded with a click. |
| 10 |
| 11 To use this file import it: |
| 12 |
| 13 <link href="/res/imp/fuzzer-stacktrace-sk.html" rel="import" /> |
| 14 |
| 15 Usage: |
| 16 |
| 17 <fuzzer-stacktrace-sk></fuzzer-stacktrace-sk> |
| 18 |
| 19 Properties: |
| 20 trace - The stack trace object. Expected to be provided. Expected to have t
he following attributes: |
| 21 - frames: An array of elements with the following attributes: |
| 22 - packageName : String |
| 23 - fileName : String |
| 24 - lineNumber : Number |
| 25 - functionName [optional] |
| 26 |
| 27 Methods: |
| 28 None. |
| 29 |
| 30 Events: |
| 31 None. |
| 32 --> |
| 33 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> |
| 34 <link rel="import" href="/res/imp/bower_components/paper-icon-button/paper-icon-
button.html"> |
| 35 <dom-module id="fuzzer-stacktrace-sk"> |
| 36 <template> |
| 37 <style> |
| 38 .stacktrace{ |
| 39 padding:4px 8px; |
| 40 display:table; |
| 41 } |
| 42 .frame { |
| 43 display:table-row; |
| 44 } |
| 45 .frame:nth-child(odd) { |
| 46 background-color:#EEE; |
| 47 } |
| 48 .frame:nth-child(even) { |
| 49 background-color:#FFF; |
| 50 } |
| 51 /*<tr> cells cannot have rounded corners. Neither can cells with display:
table-row; |
| 52 A workaround is to use display:table, table-row, table-cell and put |
| 53 a border radius on the left parts of the left-most cell and a border radiu
s on |
| 54 the right parts of the right most cell. Also note that the table-row's pad
ding |
| 55 and such is determined by its children's styles.*/ |
| 56 .line { |
| 57 display:table-cell; |
| 58 padding:4px 8px; |
| 59 border-radius: 8px 0 0 8px; |
| 60 } |
| 61 .function-name { |
| 62 display:table-cell; |
| 63 padding:4px 8px 4px 50px; |
| 64 border-radius: 0 8px 8px 0; |
| 65 } |
| 66 #expand{ |
| 67 cursor:pointer; |
| 68 /*Make this a bit bigger than normal (24px) */ |
| 69 --iron-icon-height: 30px; |
| 70 --iron-icon-width: 30px; |
| 71 } |
| 72 .hidden{ |
| 73 display:none; |
| 74 } |
| 75 </style> |
| 76 <div class="stacktrace"> |
| 77 <template is="dom-repeat" items="{{frames}}" as="frame"> |
| 78 <div class="frame" > |
| 79 <span class="line">{{frame.packageName}}{{frame.fileName}}:{{frame.l
ineNumber}}</span> |
| 80 <span class="function-name"> |
| 81 <template is="dom-if" if="{{frame.functionName}}"> |
| 82 <span>{{frame.functionName}}</span> |
| 83 </template> |
| 84 </span> |
| 85 </div> |
| 86 </template> |
| 87 |
| 88 <paper-icon-button id="expand" icon="icons:more-horiz" on-click="showMore" t
itle="expand stacktrace"></paper-icon-button> |
| 89 |
| 90 </div> |
| 91 </template> |
| 92 |
| 93 <script> |
| 94 Polymer({ |
| 95 is: 'fuzzer-stacktrace-sk', |
| 96 |
| 97 properties: { |
| 98 trace: { |
| 99 type: Object, |
| 100 value: function() { return {}; }, |
| 101 }, |
| 102 expanded: { |
| 103 type: Boolean, |
| 104 value: false |
| 105 }, |
| 106 frames: { |
| 107 type: Array, |
| 108 computed: "_getStackFrames(trace, expanded)" |
| 109 } |
| 110 }, |
| 111 |
| 112 setStackTrace: function(trace) { |
| 113 this.trace = trace; |
| 114 }, |
| 115 |
| 116 _getStackFrames: function(trace, expanded) { |
| 117 if (!trace.frames) { |
| 118 return []; |
| 119 } |
| 120 if (expanded || trace.frames.length < 8) { |
| 121 return trace.frames; |
| 122 } |
| 123 return trace.frames.slice(0, 8); |
| 124 }, |
| 125 |
| 126 showMore: function() { |
| 127 this.expanded = true; |
| 128 this.$.expand.toggleClass("hidden"); |
| 129 } |
| 130 }); |
| 131 </script |
| 132 </dom-module id="fuzzer-stacktrace-sk"> |
OLD | NEW |