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

Side by Side Diff: ios/chrome/browser/find_in_page/resources/find_in_page.js

Issue 2755123002: Fix Find in Page on iOS 10.3. (Closed)
Patch Set: space Created 3 years, 9 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 /** 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
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 // The following try/catch catches a webkit error when searching a page
957 documents.push(win.frames[i].document); 957 // with iframes. See crbug.com/702566 for details.
958 windowsToSearch.push(win.frames[i]); 958 // To verify that this is still necessary:
959 // 1. Remove this try/catch.
960 // 2. Go to a page with iframes.
961 // 3. Search for anything.
962 // 4. Check if the webkit debugger spits out SecurityError (DOM Exception)
963 // and the search fails. If it doesn't, feel free to remove this.
964 try {
965 if (win.frames[i].document) {
966 documents.push(win.frames[i].document);
967 windowsToSearch.push(win.frames[i]);
968 }
969 } catch (e) {
970 // Do nothing.
959 } 971 }
960 } 972 }
961 } 973 }
962 return documents; 974 return documents;
963 }; 975 };
964 976
965 window.addEventListener('pagehide', __gCrWeb['findInPage']['disable']); 977 window.addEventListener('pagehide', __gCrWeb['findInPage']['disable']);
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