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

Side by Side Diff: components/security_interstitials/core/common/resources/interstitial_common.js

Issue 2503453003: Remove all calls to domAutomationController.setAutomationId.
Patch Set: Fix nacl_browsertest_util.cc Created 3 years, 5 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 is the shared code for security interstitials. It is used for both SSL 5 // This is the shared code for security interstitials. It is used for both SSL
6 // interstitials and Safe Browsing interstitials. 6 // interstitials and Safe Browsing interstitials.
7 7
8 // Should match security_interstitials::SecurityInterstitialCommands 8 // Should match security_interstitials::SecurityInterstitialCommands
9 /** @enum| {string} */ 9 /** @enum| {string} */
10 var SecurityInterstitialCommandId = { 10 var SecurityInterstitialCommandId = {
(...skipping 17 matching lines...) Expand all
28 }; 28 };
29 29
30 var HIDDEN_CLASS = 'hidden'; 30 var HIDDEN_CLASS = 'hidden';
31 31
32 /** 32 /**
33 * A convenience method for sending commands to the parent page. 33 * A convenience method for sending commands to the parent page.
34 * @param {string} cmd The command to send. 34 * @param {string} cmd The command to send.
35 */ 35 */
36 function sendCommand(cmd) { 36 function sendCommand(cmd) {
37 // <if expr="not is_ios"> 37 // <if expr="not is_ios">
38 window.domAutomationController.setAutomationId(1);
39 window.domAutomationController.send(cmd); 38 window.domAutomationController.send(cmd);
40 // </if> 39 // </if>
41 // <if expr="is_ios"> 40 // <if expr="is_ios">
42 // TODO(crbug.com/565877): Revisit message passing for WKWebView. 41 // TODO(crbug.com/565877): Revisit message passing for WKWebView.
43 var iframe = document.createElement('IFRAME'); 42 var iframe = document.createElement('IFRAME');
44 iframe.setAttribute('src', 'js-command:' + cmd); 43 iframe.setAttribute('src', 'js-command:' + cmd);
45 document.documentElement.appendChild(iframe); 44 document.documentElement.appendChild(iframe);
46 iframe.parentNode.removeChild(iframe); 45 iframe.parentNode.removeChild(iframe);
47 // </if> 46 // </if>
48 } 47 }
49 48
50 /** 49 /**
51 * Call this to stop clicks on <a href="#"> links from scrolling to the top of 50 * Call this to stop clicks on <a href="#"> links from scrolling to the top of
52 * the page (and possibly showing a # in the link). 51 * the page (and possibly showing a # in the link).
53 */ 52 */
54 function preventDefaultOnPoundLinkClicks() { 53 function preventDefaultOnPoundLinkClicks() {
55 document.addEventListener('click', function(e) { 54 document.addEventListener('click', function(e) {
56 var anchor = findAncestor(/** @type {Node} */ (e.target), function(el) { 55 var anchor = findAncestor(/** @type {Node} */ (e.target), function(el) {
57 return el.tagName == 'A'; 56 return el.tagName == 'A';
58 }); 57 });
59 // Use getAttribute() to prevent URL normalization. 58 // Use getAttribute() to prevent URL normalization.
60 if (anchor && anchor.getAttribute('href') == '#') 59 if (anchor && anchor.getAttribute('href') == '#')
61 e.preventDefault(); 60 e.preventDefault();
62 }); 61 });
63 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698