OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * HSTS is HTTPS Strict Transport Security: a way for sites to elect to always | 6 * HSTS is HTTPS Strict Transport Security: a way for sites to elect to always |
7 * use HTTPS. See http://dev.chromium.org/sts | 7 * use HTTPS. See http://dev.chromium.org/sts |
8 * | 8 * |
9 * This UI allows a user to query and update the browser's list of HSTS domains. | 9 * This UI allows a user to query and update the browser's list of HSTS domains. |
10 * It also allows users to query and update the browser's list of public key | 10 * It also allows users to query and update the browser's list of public key |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 HSTSView.QUERY_FORM_ID = 'hsts-view-query-form'; | 66 HSTSView.QUERY_FORM_ID = 'hsts-view-query-form'; |
67 HSTSView.QUERY_SUBMIT_ID = 'hsts-view-query-submit'; | 67 HSTSView.QUERY_SUBMIT_ID = 'hsts-view-query-submit'; |
68 | 68 |
69 cr.addSingletonGetter(HSTSView); | 69 cr.addSingletonGetter(HSTSView); |
70 | 70 |
71 HSTSView.prototype = { | 71 HSTSView.prototype = { |
72 // Inherit the superclass's methods. | 72 // Inherit the superclass's methods. |
73 __proto__: superClass.prototype, | 73 __proto__: superClass.prototype, |
74 | 74 |
75 onSubmitAdd_: function(event) { | 75 onSubmitAdd_: function(event) { |
76 g_browser.sendHSTSAdd(this.addInput_.value, | 76 g_browser.sendHSTSAdd( |
77 this.addStsCheck_.checked, | 77 this.addInput_.value, this.addStsCheck_.checked, |
78 this.addPkpCheck_.checked, | 78 this.addPkpCheck_.checked, this.addPins_.value); |
79 this.addPins_.value); | |
80 g_browser.sendHSTSQuery(this.addInput_.value); | 79 g_browser.sendHSTSQuery(this.addInput_.value); |
81 this.queryInput_.value = this.addInput_.value; | 80 this.queryInput_.value = this.addInput_.value; |
82 this.addStsCheck_.checked = false; | 81 this.addStsCheck_.checked = false; |
83 this.addPkpCheck_.checked = false; | 82 this.addPkpCheck_.checked = false; |
84 this.addInput_.value = ''; | 83 this.addInput_.value = ''; |
85 this.addPins_.value = ''; | 84 this.addPins_.value = ''; |
86 event.preventDefault(); | 85 event.preventDefault(); |
87 }, | 86 }, |
88 | 87 |
89 onSubmitDelete_: function(event) { | 88 onSubmitDelete_: function(event) { |
(...skipping 22 matching lines...) Expand all Loading... |
112 yellowFade(this.queryOutputDiv_); | 111 yellowFade(this.queryOutputDiv_); |
113 return; | 112 return; |
114 } | 113 } |
115 | 114 |
116 this.queryOutputDiv_.innerHTML = ''; | 115 this.queryOutputDiv_.innerHTML = ''; |
117 | 116 |
118 var s = addNode(this.queryOutputDiv_, 'span'); | 117 var s = addNode(this.queryOutputDiv_, 'span'); |
119 s.innerHTML = '<b>Found:</b><br/>'; | 118 s.innerHTML = '<b>Found:</b><br/>'; |
120 | 119 |
121 var keys = [ | 120 var keys = [ |
122 'static_sts_domain', 'static_upgrade_mode', | 121 'static_sts_domain', |
123 'static_sts_include_subdomains', 'static_sts_observed', | 122 'static_upgrade_mode', |
124 'static_pkp_domain', 'static_pkp_include_subdomains', | 123 'static_sts_include_subdomains', |
125 'static_pkp_observed', 'static_spki_hashes', 'dynamic_sts_domain', | 124 'static_sts_observed', |
126 'dynamic_upgrade_mode', 'dynamic_sts_include_subdomains', | 125 'static_pkp_domain', |
127 'dynamic_sts_observed', 'dynamic_pkp_domain', | 126 'static_pkp_include_subdomains', |
128 'dynamic_pkp_include_subdomains', 'dynamic_pkp_observed', | 127 'static_pkp_observed', |
| 128 'static_spki_hashes', |
| 129 'dynamic_sts_domain', |
| 130 'dynamic_upgrade_mode', |
| 131 'dynamic_sts_include_subdomains', |
| 132 'dynamic_sts_observed', |
| 133 'dynamic_pkp_domain', |
| 134 'dynamic_pkp_include_subdomains', |
| 135 'dynamic_pkp_observed', |
129 'dynamic_spki_hashes', | 136 'dynamic_spki_hashes', |
130 ]; | 137 ]; |
131 | 138 |
132 var kStaticHashKeys = [ | 139 var kStaticHashKeys = |
133 'public_key_hashes', 'preloaded_spki_hashes', 'static_spki_hashes' | 140 ['public_key_hashes', 'preloaded_spki_hashes', 'static_spki_hashes']; |
134 ]; | |
135 | 141 |
136 var staticHashes = []; | 142 var staticHashes = []; |
137 for (var i = 0; i < kStaticHashKeys.length; ++i) { | 143 for (var i = 0; i < kStaticHashKeys.length; ++i) { |
138 var staticHashValue = result[kStaticHashKeys[i]]; | 144 var staticHashValue = result[kStaticHashKeys[i]]; |
139 if (staticHashValue != undefined && staticHashValue != '') | 145 if (staticHashValue != undefined && staticHashValue != '') |
140 staticHashes.push(staticHashValue); | 146 staticHashes.push(staticHashValue); |
141 } | 147 } |
142 | 148 |
143 for (var i = 0; i < keys.length; ++i) { | 149 for (var i = 0; i < keys.length; ++i) { |
144 var key = keys[i]; | 150 var key = keys[i]; |
145 var value = result[key]; | 151 var value = result[key]; |
146 addTextNode(this.queryOutputDiv_, ' ' + key + ': '); | 152 addTextNode(this.queryOutputDiv_, ' ' + key + ': '); |
147 | 153 |
148 // If there are no static_hashes, do not make it seem like there is a | 154 // If there are no static_hashes, do not make it seem like there is a |
149 // static PKP policy in place. | 155 // static PKP policy in place. |
150 if (staticHashes.length == 0 && key.startsWith('static_pkp_')) { | 156 if (staticHashes.length == 0 && key.startsWith('static_pkp_')) { |
151 addNode(this.queryOutputDiv_, 'br'); | 157 addNode(this.queryOutputDiv_, 'br'); |
152 continue; | 158 continue; |
153 } | 159 } |
154 | 160 |
155 if (key === 'static_spki_hashes') { | 161 if (key === 'static_spki_hashes') { |
156 addNodeWithText(this.queryOutputDiv_, 'tt', staticHashes.join(',')); | 162 addNodeWithText(this.queryOutputDiv_, 'tt', staticHashes.join(',')); |
157 } else if (key.indexOf('_upgrade_mode') >= 0) { | 163 } else if (key.indexOf('_upgrade_mode') >= 0) { |
158 addNodeWithText(this.queryOutputDiv_, 'tt', modeToString(value)); | 164 addNodeWithText(this.queryOutputDiv_, 'tt', modeToString(value)); |
159 } else { | 165 } else { |
160 addNodeWithText(this.queryOutputDiv_, 'tt', | 166 addNodeWithText( |
161 value == undefined ? '' : value); | 167 this.queryOutputDiv_, 'tt', value == undefined ? '' : value); |
162 } | 168 } |
163 addNode(this.queryOutputDiv_, 'br'); | 169 addNode(this.queryOutputDiv_, 'br'); |
164 } | 170 } |
165 | 171 |
166 yellowFade(this.queryOutputDiv_); | 172 yellowFade(this.queryOutputDiv_); |
167 } | 173 } |
168 }; | 174 }; |
169 | 175 |
170 function modeToString(m) { | 176 function modeToString(m) { |
171 // These numbers must match those in | 177 // These numbers must match those in |
(...skipping 12 matching lines...) Expand all Loading... |
184 element.style.webkitTransitionDuration = '0'; | 190 element.style.webkitTransitionDuration = '0'; |
185 element.style.backgroundColor = '#fffccf'; | 191 element.style.backgroundColor = '#fffccf'; |
186 setTimeout(function() { | 192 setTimeout(function() { |
187 element.style.webkitTransitionDuration = '1000ms'; | 193 element.style.webkitTransitionDuration = '1000ms'; |
188 element.style.backgroundColor = '#fff'; | 194 element.style.backgroundColor = '#fff'; |
189 }, 0); | 195 }, 0); |
190 } | 196 } |
191 | 197 |
192 return HSTSView; | 198 return HSTSView; |
193 })(); | 199 })(); |
OLD | NEW |