diff --git a/lib/core/constants.js b/lib/core/constants.js index 71918e37..c5b9fd2b 100644 --- a/lib/core/constants.js +++ b/lib/core/constants.js @@ -27,7 +27,10 @@ const definitions = [ const constants = { helpUrlBase: 'https://dequeuniversity.com/rules/', + // Size of a grid square in pixels gridSize: 200, + // At a certain point, looping over an array of elements and using .match on them + // is slower than just running querySelectorAll again. selectorSimilarFilterLimit: 700, results: [], resultGroups: [], @@ -44,7 +47,15 @@ const constants = { timeout: 10000 }), allOrigins: '', - sameOrigin: '' + sameOrigin: '', + serializableErrorProps: Object.freeze([ + 'message', + 'stack', + 'name', + 'code', + 'ruleId', + 'method' + ]) }; definitions.forEach(definition => { diff --git a/lib/core/utils/performance-timer.js b/lib/core/utils/performance-timer.js index 5b26c858..1ee71a2b 100644 --- a/lib/core/utils/performance-timer.js +++ b/lib/core/utils/performance-timer.js @@ -73,17 +73,27 @@ const performanceTimer = (() => { * @param {String} endMark String name of mark to end measuring */ measure(measureName, startMark, endMark, details = {}) { - if (window.performance && window.performance.measure !== undefined) { - if (Object.keys(details).length > 0) { - const measureOpts = { - detail: details, - start: startMark, - end: endMark - }; - window.performance.measure(measureName, measureOpts); - } else { - window.performance.measure(measureName, startMark, endMark); + try { + if (window.performance && window.performance.measure !== undefined) { + if (Object.keys(details).length > 0) { + const measureOpts = { + detail: details, + start: startMark, + end: endMark + }; + window.performance.measure(measureName, measureOpts); + } else { + window.performance.measure(measureName, startMark, endMark); + } } + } catch (err) { + // NOTE: Performance metrics will be missed if an error occurs here + a11yEngine.errorHandler.addNonCheckError( + 'INSTRUMENTATION_ERROR', + 'AxeCore PerformanceTimer measure Error', + err, + true + ); } }, /**