Skip to content

Commit

Permalink
core: remove no-mutation-events audit
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Jun 15, 2018
1 parent deaf607 commit 87905d5
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 552 deletions.
37 changes: 0 additions & 37 deletions lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,39 +208,6 @@ <h2>Do better web tester page</h2>
const db = openDatabase('mydb', '1.0', 'my first database', 1024);
}

function mutationEvenTest() {
// FAIL
document.addEventListener('DOMNodeInserted', function(e) {
console.log('DOMNodeInserted');
});

// FAIL
document.addEventListener('DOMNodeRemoved', function(e) {
console.log('DOMNodeRemoved');
});

// FAIL
document.body.addEventListener('DOMNodeInserted', function(e) {
console.log('DOMNodeInserted');
});

// FAIL
const el = document.querySelector('#touchmove-section');
el.addEventListener('DOMNodeInserted', function(e) {
console.log('DOMNodeInserted on element');
});

// FAIL
window.addEventListener('DOMNodeInserted', function(e) {
console.log('DOMNodeInserted');
});

// PASS - not MutationEvents
window.addEventListener('DOMContentLoaded', function(e) {
console.log('DOMContentLoaded');
});
}

function passiveEventsListenerTest() {
// FAIL
window.addEventListener('wheel', function(e) {
Expand Down Expand Up @@ -364,7 +331,6 @@ <h2>Do better web tester page</h2>
dateNowTest();
consoleTimeTest();
websqlTest();
mutationEvenTest();
passiveEventsListenerTest();
geolocationOnStartTest();
notificationOnStartTest();
Expand All @@ -387,9 +353,6 @@ <h2>Do better web tester page</h2>
if (params.has('websql')) {
websqlTest();
}
if (params.has('mutationEvents')) {
mutationEvenTest();
}
if (params.has('passiveEvents')) {
passiveEventsListenerTest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ module.exports = [
},
},
},
'no-mutation-events': {
score: 0,
details: {
items: {
length: 6,
},
},
},
'no-vulnerable-libraries': {
score: 0,
details: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ module.exports = [
'no-document-write': {
score: 1,
},
'no-mutation-events': {
score: 1,
},
'no-websql': {
score: 1,
},
Expand Down
92 changes: 0 additions & 92 deletions lighthouse-core/audits/dobetterweb/no-mutation-events.js

This file was deleted.

3 changes: 0 additions & 3 deletions lighthouse-core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = {
'chrome-console-messages',
'image-usage',
'accessibility',
'dobetterweb/all-event-listeners',
'dobetterweb/anchors-with-no-rel-noopener',
'dobetterweb/appcache',
'dobetterweb/domstats',
Expand Down Expand Up @@ -166,7 +165,6 @@ module.exports = {
'dobetterweb/external-anchors-use-rel-noopener',
'dobetterweb/geolocation-on-start',
'dobetterweb/no-document-write',
'dobetterweb/no-mutation-events',
'dobetterweb/no-vulnerable-libraries',
'dobetterweb/no-websql',
'dobetterweb/notification-on-start',
Expand Down Expand Up @@ -371,7 +369,6 @@ module.exports = {
{id: 'is-on-https', weight: 1},
{id: 'uses-http2', weight: 1},
{id: 'uses-passive-event-listeners', weight: 1},
{id: 'no-mutation-events', weight: 1},
{id: 'no-document-write', weight: 1},
{id: 'external-anchors-use-rel-noopener', weight: 1},
{id: 'geolocation-on-start', weight: 1},
Expand Down
32 changes: 0 additions & 32 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1077,38 +1077,6 @@ class Driver {
await this.evaluteScriptOnNewDocument(scriptStr);
}

/**
* Keeps track of calls to a JS function and returns a list of {url, line, col}
* of the usage. Should be called before page load (in beforePass).
* @param {string} funcName The function name to track ('Date.now', 'console.time').
* @return {function(): Promise<Array<{url: string, line: number, col: number}>>}
* Call this method when you want results.
*/
captureFunctionCallSites(funcName) {
const globalVarToPopulate = `window['__${funcName}StackTraces']`;
const collectUsage = () => {
return this.evaluateAsync(
`Array.from(${globalVarToPopulate}).map(item => JSON.parse(item))`)
.then(result => {
if (!Array.isArray(result)) {
throw new Error(
'Driver failure: Expected evaluateAsync results to be an array ' +
`but got "${JSON.stringify(result)}" instead.`);
}
// Filter out usage from extension content scripts.
return result.filter(item => !item.isExtension);
});
};

const funcBody = pageFunctions.captureJSCallUsage.toString();

this.evaluteScriptOnNewDocument(`
${globalVarToPopulate} = new Set();
(${funcName} = ${funcBody}(${funcName}, ${globalVarToPopulate}))`);

return collectUsage;
}

/**
* @param {Array<string>} urls URL patterns to block. Wildcards ('*') are allowed.
* @return {Promise<void>}
Expand Down
154 changes: 0 additions & 154 deletions lighthouse-core/gather/gatherers/dobetterweb/all-event-listeners.js

This file was deleted.

Loading

0 comments on commit 87905d5

Please sign in to comment.