| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // This file adheres to closure-compiler conventions in order to enable | 5 // This file adheres to closure-compiler conventions in order to enable |
| 6 // compilation with ADVANCED_OPTIMIZATIONS. See http://goo.gl/FwOgy | 6 // compilation with ADVANCED_OPTIMIZATIONS. See http://goo.gl/FwOgy |
| 7 // | 7 // |
| 8 // Installs password management functions on the |__gCrWeb| object. | 8 // Installs password management functions on the |__gCrWeb| object. |
| 9 // | 9 // |
| 10 // Finds all password forms in the current document and extracts | 10 // Finds all password forms in the current document and extracts |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 * | 207 * |
| 208 * @param {Object} formData Form data. | 208 * @param {Object} formData Form data. |
| 209 * @param {string} username The username to fill. | 209 * @param {string} username The username to fill. |
| 210 * @param {string} password The password to fill. | 210 * @param {string} password The password to fill. |
| 211 * @param {Object} win A window or a frame containing formData. | 211 * @param {Object} win A window or a frame containing formData. |
| 212 * @param {string=} opt_normalizedOrigin The origin URL to compare to. | 212 * @param {string=} opt_normalizedOrigin The origin URL to compare to. |
| 213 * @return {boolean} Whether a form field has been filled. | 213 * @return {boolean} Whether a form field has been filled. |
| 214 */ | 214 */ |
| 215 __gCrWeb.fillPasswordFormWithData = | 215 __gCrWeb.fillPasswordFormWithData = |
| 216 function(formData, username, password, win, opt_normalizedOrigin) { | 216 function(formData, username, password, win, opt_normalizedOrigin) { |
| 217 var doc = win.document; | 217 var doc = null; |
| 218 |
| 219 try { |
| 220 doc = win.document; |
| 221 } catch(e) { |
| 222 } |
| 218 | 223 |
| 219 // If unable to read the 'document' property from a frame in a different | 224 // If unable to read the 'document' property from a frame in a different |
| 220 // origin, do nothing. | 225 // origin, do nothing. |
| 221 if (!doc) { | 226 if (!doc) { |
| 222 return false; | 227 return false; |
| 223 } | 228 } |
| 224 | 229 |
| 225 var origin = formData['origin']; | 230 var origin = formData['origin']; |
| 226 var normalizedOrigin = opt_normalizedOrigin || | 231 var normalizedOrigin = opt_normalizedOrigin || |
| 227 __gCrWeb.common.removeQueryAndReferenceFromURL(win.location.href); | 232 __gCrWeb.common.removeQueryAndReferenceFromURL(win.location.href); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 'method': formElement.getAttribute('method'), | 422 'method': formElement.getAttribute('method'), |
| 418 'name': __gCrWeb.common.getFormIdentifier(formElement), | 423 'name': __gCrWeb.common.getFormIdentifier(formElement), |
| 419 'origin': origin, | 424 'origin': origin, |
| 420 'fields': fields, | 425 'fields': fields, |
| 421 'usernameElement': usernameElement, | 426 'usernameElement': usernameElement, |
| 422 'usernameValue': usernameValue, | 427 'usernameValue': usernameValue, |
| 423 'passwords': passwords | 428 'passwords': passwords |
| 424 }; | 429 }; |
| 425 }; | 430 }; |
| 426 } | 431 } |
| OLD | NEW |