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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/live_regions.js

Issue 1514483006: Wrap new API in a try-catch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @fileoverview Implements support for live regions in ChromeVox Next. 6 * @fileoverview Implements support for live regions in ChromeVox Next.
7 */ 7 */
8 8
9 goog.provide('LiveRegions'); 9 goog.provide('LiveRegions');
10 10
(...skipping 24 matching lines...) Expand all
35 this.lastLiveRegionTime_ = new Date(0); 35 this.lastLiveRegionTime_ = new Date(0);
36 36
37 /** 37 /**
38 * Set of nodes that have been announced as part of a live region since 38 * Set of nodes that have been announced as part of a live region since
39 * |this.lastLiveRegionTime_|, to prevent duplicate announcements. 39 * |this.lastLiveRegionTime_|, to prevent duplicate announcements.
40 * @type {!WeakSet<AutomationNode>} 40 * @type {!WeakSet<AutomationNode>}
41 * @private 41 * @private
42 */ 42 */
43 this.liveRegionNodeSet_ = new WeakSet(); 43 this.liveRegionNodeSet_ = new WeakSet();
44 44
45 chrome.automation.addTreeChangeObserver( 45 // API only exists >= m49. Prevent us from crashing.
46 'liveRegionTreeChanges', this.onTreeChange.bind(this)); 46 try {
47 chrome.automation.addTreeChangeObserver(
48 'liveRegionTreeChanges', this.onTreeChange.bind(this));
49 } catch (e) {
50 }
47 }; 51 };
48 52
49 /** 53 /**
50 * Live region events received in fewer than this many milliseconds will 54 * Live region events received in fewer than this many milliseconds will
51 * queue, otherwise they'll be output with a category flush. 55 * queue, otherwise they'll be output with a category flush.
52 * @type {number} 56 * @type {number}
53 * @const 57 * @const
54 */ 58 */
55 LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 500; 59 LiveRegions.LIVE_REGION_QUEUE_TIME_MS = 500;
56 60
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return; 154 return;
151 parent = parent.parent; 155 parent = parent.parent;
152 } 156 }
153 157
154 this.liveRegionNodeSet_.add(node); 158 this.liveRegionNodeSet_.add(node);
155 output.go(); 159 output.go();
156 }, 160 },
157 }; 161 };
158 162
159 }); // goog.scope 163 }); // goog.scope
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