summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/extensions/error_page.html
blob: 4e0e47849852c8d8b5324bf2ebe0e27f56f4a4f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<link rel="import" href="chrome://resources/html/polymer.html">

<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_container_shadow_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/shared_style_css.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/cr.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_outline_manager.html">
<link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
<link rel="import" href="code_section.html">
<link rel="import" href="item_util.html">
<link rel="import" href="navigation_helper.html">
<link rel="import" href="shared_style.html">

<dom-module id="extensions-error-page">
  <template>
    <style include="cr-icons cr-shared-style shared-style">
      :host {
        display: block;
        height: 100%;
      }

      iron-icon {
        --iron-icon-fill-color: var(--google-grey-refresh-700);
        @apply --cr-icon-height-width;
        flex-shrink: 0;
      }

      iron-icon[icon='cr:warning'] {
        /* TODO(dbeam): find dark mode equivalent for this orange. */
        --iron-icon-fill-color: var(--paper-orange-500);
      }

      iron-icon[icon='cr:error'] {
        --iron-icon-fill-color: var(--error-color);
      }

      .section {
        padding: 0 var(--cr-section-padding);
      }

      #heading {
        align-items: center;
        display: flex;
        height: 40px;
        margin-bottom: 30px;
        padding: 8px 12px 0;
      }

      #heading span {
        flex: 1;
        margin: 0 10px;
      }

      #errorsList {
        min-height: 100px;
      }

      .error-item {
        @apply --cr-section;
        padding-inline-start: 0;
      }

      .error-item cr-icon-button {
        margin: 0;
      }

      .error-item.selected {
        background-color: rgba(0, 0, 0, 0.08);
      }

      .error-item .start {
        align-items: center;
        align-self: stretch;  /* Makes the tappable area fill its parent. */
        display: flex;
        flex: 1;
        padding: 0 var(--cr-section-padding);
      }

      .error-message {
        flex-grow: 1;
        margin-inline-start: 10px;
        word-break: break-word;
      }

      .devtools-controls {
        padding: 0 var(--cr-section-padding);
      }

      .details-heading {
        align-items: center;
        display: flex;
        height: var(--cr-section-min-height);
      }

      .stack-trace-container {
        list-style: none;
        margin-top: 0;
        padding: 0;
      }

      .stack-trace-container li {
        cursor: pointer;
        font-family: monospace;
        padding: 4px;
      }

      .stack-trace-container li.selected,
      .stack-trace-container li:hover {
        background: var(--google-blue-100);
        color: var(--google-grey-900);  /* Same in light & dark modes. */
      }

      extensions-code-section {
        height: 200px;
        margin-bottom: 20px;
      }

      :host-context(.focus-outline-visible) .start:focus {
        outline: -webkit-focus-ring-color auto 5px;
      }

      .start:focus {
        outline: none;
      }

      .context-url {
        word-wrap: break-word;
      }
    </style>
    <div class="page-container" id="container">
      <div class="page-content">
        <div id="heading" class="cr-title-text">
          <cr-icon-button class="icon-arrow-back no-overlap" id="closeButton"
              aria-label="$i18n{back}" on-click="onCloseButtonTap_">
          </cr-icon-button>
          <span>$i18n{errorsPageHeading}</span>
          <cr-button on-click="onClearAllTap_" hidden="[[!entries_.length]]">
            $i18n{clearAll}
          </cr-button>
        </div>
        <div class="section">
          <div id="errorsList">
            <template is="dom-repeat" items="[[entries_]]">
              <div class="item-container">
                <div class$="error-item
                    [[computeErrorClass_(item, selectedEntry_)]]">
                  <div actionable class="start" on-click="onErrorItemAction_"
                      on-keydown="onErrorItemAction_" tabindex="0"
                      role="button" aria-expanded$="[[isAriaExpanded_(
                          index, selectedEntry_)]]">
                    <iron-icon icon$="cr:[[computeErrorIcon_(item)]]"
                        title$="[[computeErrorTypeLabel_(item)]]">
                    </iron-icon>
                    <div id$="[[item.id]]" class="error-message">
                      [[item.message]]
                    </div>
                    <div class$="cr-icon [[iconName_(index, selectedEntry_)]]">
                    </div>
                  </div>
                  <div class="separator"></div>
                  <cr-icon-button class="icon-delete-gray"
                      on-click="onDeleteErrorAction_"
                      aria-describedby$="[[item.id]]"
                      aria-label="$i18n{clearEntry}"></cr-icon-button>
                </div>
                <iron-collapse opened="[[isOpened_(index, selectedEntry_)]]">
                  <div class="devtools-controls">
                    <template is="dom-if"
                        if="[[computeIsRuntimeError_(item)]]">
                      <div class="details-heading cr-title-text">
                        $i18n{errorContext}
                      </div>
                      <span class="context-url">
                        [[getContextUrl_(
                            item, '$i18nPolymer{errorContextUnknown}')]]
                      </span>
                      <div class="details-heading cr-title-text">
                        $i18n{stackTrace}
                      </div>
                      <ul class="stack-trace-container"
                          on-keydown="onStackKeydown_">
                        <template is="dom-repeat" items="[[item.stackTrace]]">
                          <li on-click="onStackFrameTap_"
                              tabindex$="[[getStackFrameTabIndex_(item,
                                  selectedStackFrame_)]]"
                              hidden="[[!shouldDisplayFrame_(item.url)]]"
                              class$="[[getStackFrameClass_(item,
                                  selectedStackFrame_)]]">
                            [[getStackTraceLabel_(item)]]
                          </li>
                        </template>
                      </ul>
                    </template>
                    <extensions-code-section code="[[code_]]"
                        is-active="[[isOpened_(index, selectedEntry_)]]"
                        could-not-display-code="$i18n{noErrorsToShow}">
                    </extensions-code-section>
                  </div>
                </iron-collapse>
              </div>
            </template>
          </div>
        </div>
      </div>
    </div>
  </template>
  <script src="error_page.js"></script>
</dom-module>