Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/core/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand All @@ -44,7 +47,15 @@ const constants = {
timeout: 10000
}),
allOrigins: '<unsafe_all_origins>',
sameOrigin: '<same_origin>'
sameOrigin: '<same_origin>',
serializableErrorProps: Object.freeze([
'message',
'stack',
'name',
'code',
'ruleId',
'method'
])
};

definitions.forEach(definition => {
Expand Down
30 changes: 20 additions & 10 deletions lib/core/utils/performance-timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
},
/**
Expand Down