| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * Finds all forms with passwords in the supplied window or frame and appends | 338 * Finds all forms with passwords in the supplied window or frame and appends |
| 339 * JS objects containing the form data to |formDataList|. | 339 * JS objects containing the form data to |formDataList|. |
| 340 * @param {!Array.<Object>} formDataList A list that this function populates | 340 * @param {!Array.<Object>} formDataList A list that this function populates |
| 341 * with descriptions of discovered forms. | 341 * with descriptions of discovered forms. |
| 342 * @param {Window} win A window (or frame) in which the function should | 342 * @param {Window} win A window (or frame) in which the function should |
| 343 * look for password forms. | 343 * look for password forms. |
| 344 */ | 344 */ |
| 345 __gCrWeb.getPasswordFormDataList = function(formDataList, win) { | 345 __gCrWeb.getPasswordFormDataList = function(formDataList, win) { |
| 346 var doc = win.document; | 346 var doc = null; |
| 347 | 347 |
| 348 // We may not be allowed to read the 'document' property from a frame | 348 try { |
| 349 // that is in a different domain. | 349 // Security violations may generate an exception or null to be returned. |
| 350 doc = win.document; |
| 351 } catch(e) { |
| 352 } |
| 353 |
| 350 if (!doc) { | 354 if (!doc) { |
| 351 return; | 355 return; |
| 352 } | 356 } |
| 353 | 357 |
| 354 var forms = doc.forms; | 358 var forms = doc.forms; |
| 355 for (var i = 0; i < forms.length; i++) { | 359 for (var i = 0; i < forms.length; i++) { |
| 356 var formData = __gCrWeb.getPasswordFormData(forms[i]); | 360 var formData = __gCrWeb.getPasswordFormData(forms[i]); |
| 357 if (formData) { | 361 if (formData) { |
| 358 formDataList.push(formData); | 362 formDataList.push(formData); |
| 359 } | 363 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 'method': formElement.getAttribute('method'), | 426 'method': formElement.getAttribute('method'), |
| 423 'name': __gCrWeb.common.getFormIdentifier(formElement), | 427 'name': __gCrWeb.common.getFormIdentifier(formElement), |
| 424 'origin': origin, | 428 'origin': origin, |
| 425 'fields': fields, | 429 'fields': fields, |
| 426 'usernameElement': usernameElement, | 430 'usernameElement': usernameElement, |
| 427 'usernameValue': usernameValue, | 431 'usernameValue': usernameValue, |
| 428 'passwords': passwords | 432 'passwords': passwords |
| 429 }; | 433 }; |
| 430 }; | 434 }; |
| 431 } | 435 } |
| OLD | NEW |