@@ -133,6 +133,23 @@ function changeCurrLocation(tabObj, rootNode, index, name) {
133
133
}
134
134
}
135
135
136
+ // get ax tree
137
+ // function getAccessibilityTree(tabId) {
138
+ // chrome.debugger.attach({ tabId: tabId }, '1.3', function () {
139
+ // chrome.debugger.sendCommand({ tabId: tabId }, '1.3', 'Accessibility.enable', {}, function () {
140
+ // chrome.debugger.sendCommand(
141
+ // { tabId: tabId },
142
+ // '1.3',
143
+ // 'Accessibility.getFullAxTree',
144
+ // {},
145
+ // function (response) {
146
+ // console.log(response);
147
+ // },
148
+ // );
149
+ // });
150
+ // });
151
+ // }
152
+
136
153
/*
137
154
The 'chrome.runtime' API allows a connection to the background service worker (background.js).
138
155
This allows us to set up listener's for when we connect, message, and disconnect the script.
@@ -248,6 +265,19 @@ chrome.runtime.onConnect.addListener((port) => {
248
265
return true ;
249
266
250
267
case 'jumpToSnap' :
268
+ // console.log('background.js: jumpToSnap:', getAccessibilityTree(tabId));
269
+ chrome . debugger . attach ( { tabId : tabId } , '1.3' , ( ) => {
270
+ chrome . debugger . sendCommand ( { tabId : tabId } , 'Accessibility.enable' , ( ) => {
271
+ chrome . debugger . sendCommand (
272
+ { tabId : tabId } ,
273
+ 'Accessibility.getFullAXTree' ,
274
+ { } ,
275
+ ( response ) => {
276
+ console . log ( response ) ;
277
+ } ,
278
+ ) ;
279
+ } ) ;
280
+ } ) ;
251
281
chrome . tabs . sendMessage ( tabId , msg ) ;
252
282
return true ; // attempt to fix message port closing error, consider return Promise
253
283
0 commit comments