details.js (1196B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { 7 UPDATE_DETAILS, 8 } = require("resource://devtools/client/accessibility/constants.js"); 9 10 /** 11 * Update details with the given accessible object. 12 * 13 * @param {object} accessible front 14 */ 15 exports.updateDetails = 16 accessible => 17 async ({ dispatch }) => { 18 const { walker: domWalker } = 19 await accessible.targetFront.getFront("inspector"); 20 // By the time getFront resolves, the accessibleFront may have been destroyed. 21 // This typically happens during navigations. 22 if (accessible.isDestroyed()) { 23 return; 24 } 25 try { 26 const response = await Promise.all([ 27 domWalker.getNodeFromActor(accessible.actorID, [ 28 "rawAccessible", 29 "DOMNode", 30 ]), 31 accessible.getRelations(), 32 accessible.audit(), 33 accessible.hydrate(), 34 ]); 35 dispatch({ accessible, type: UPDATE_DETAILS, response }); 36 } catch (error) { 37 dispatch({ accessible, type: UPDATE_DETAILS, error }); 38 } 39 };