Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ios/chrome/browser/passwords/resources/password_controller.js

Issue 2661503003: Catches and ignores errors when accessing win.document in Password Autofill JS (Closed)
Patch Set: cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698