Chromium Code Reviews| 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 /** | 5 /** |
| 6 * Based heavily on code from the Google iOS app. | 6 * Based heavily on code from the Google iOS app. |
| 7 * | 7 * |
| 8 * @fileoverview A find in page tool. It scans the DOM for elements with the | 8 * @fileoverview A find in page tool. It scans the DOM for elements with the |
| 9 * text being search for, and wraps them with a span that highlights them. | 9 * text being search for, and wraps them with a span that highlights them. |
| 10 */ | 10 */ |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 /** | 946 /** |
| 947 * Gather all iframes in the main window. | 947 * Gather all iframes in the main window. |
| 948 * @return {Array<Document>} frames. | 948 * @return {Array<Document>} frames. |
| 949 */ | 949 */ |
| 950 __gCrWeb['findInPage'].frameDocuments = function() { | 950 __gCrWeb['findInPage'].frameDocuments = function() { |
| 951 var windowsToSearch = [window]; | 951 var windowsToSearch = [window]; |
| 952 var documents = []; | 952 var documents = []; |
| 953 while (windowsToSearch.length != 0) { | 953 while (windowsToSearch.length != 0) { |
| 954 var win = windowsToSearch.pop(); | 954 var win = windowsToSearch.pop(); |
| 955 for (var i = win.frames.length - 1; i >= 0; i--) { | 955 for (var i = win.frames.length - 1; i >= 0; i--) { |
| 956 if (win.frames[i].document) { | 956 try{ |
|
justincohen
2017/03/17 15:05:34
nit space
stkhapugin
2017/03/17 15:20:51
Done.
| |
| 957 documents.push(win.frames[i].document); | 957 if (win.frames[i].document) { |
| 958 windowsToSearch.push(win.frames[i]); | 958 documents.push(win.frames[i].document); |
| 959 windowsToSearch.push(win.frames[i]); | |
| 960 } | |
| 961 } catch (e) { | |
|
justincohen
2017/03/17 15:06:25
probably best to explain what we expect to catch h
stkhapugin
2017/03/17 15:20:51
Done.
| |
| 962 // Do nothing. | |
| 959 } | 963 } |
| 960 } | 964 } |
| 961 } | 965 } |
| 962 return documents; | 966 return documents; |
| 963 }; | 967 }; |
| 964 | 968 |
| 965 window.addEventListener('pagehide', __gCrWeb['findInPage']['disable']); | 969 window.addEventListener('pagehide', __gCrWeb['findInPage']['disable']); |
| OLD | NEW |