Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Audit: using deprecated APIs #1470

Merged
merged 12 commits into from
Jan 19, 2017
Merged

New Audit: using deprecated APIs #1470

merged 12 commits into from
Jan 19, 2017

Conversation

ebidel
Copy link
Contributor

@ebidel ebidel commented Jan 14, 2017

R: all

Part of #1458.

screen shot 2017-01-13 at 4 56 37 pm

@ebidel ebidel changed the title Add "using deprecated APIs" section. New Audit: using deprecated APIs Jan 14, 2017

const Gatherer = require('./gatherer');

class ConsoleViolations extends Gatherer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaict, this will gather all logs added to console rather than just violations, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. All logging generated by chrome. Not those using the console api. Are you thinking a rename of the class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically yeah. Console logs don't go through Log.entryAdded? Thought they did!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


afterPass(options) {
return this.endConsoleMessageCollect(options.driver)
.then(entries => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove this function and just go to catch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"name": "Avoiding deprecated APIs and browser interventions",
"audits": {
"deprecations": {
"expectedValue": true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't these not do anything since it's unscored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Just adding as a creative of habit. Removed.

@ebidel
Copy link
Contributor Author

ebidel commented Jan 17, 2017

PTAL

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good

@@ -17,4 +17,4 @@

body {
background-color: #eee;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line was bad?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why vscode stripped it. Done.

function deprecationsTest() {
stampTemplate('deprecations-tmpl', document.head);

// Some APIs atm are not triggering Chrome's deprecation messags. https://crbug.com/680832.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messages, but maybe something more like // TODO: some deprecated API messages are not currently being logged correctly. See: https://crbug.com/680832

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


// FAIL
const xhr = new XMLHttpRequest();
xhr.open('GET', 'https://lighthouse-viewer.appspot.com/data', false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do this to the local server? Ideally we wouldn't have any external connections for npm run smoke

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.


const Gatherer = require('./gatherer');

class ConsoleLogEntry extends Gatherer {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like "console.log entries" now :) What about just LogEntries to mirror debugger protocol's Log domain? (also made it plural to match e.g. tags-blocking-first-paint, styles, all-event-listeners, etc

Copy link
Contributor Author

@ebidel ebidel Jan 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a great name, is it? Hmm. We need something in between console messages and console logs entries only produced by chrome. LogEntries is better but it's still ambiguous. What about ChromeConsoleLogs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like having console + log still associates with console.log. ChromeConsoleMessages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

this._logEntries.push(entry);
}

beginConsoleMessageCollect(driver) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just inline beginConsoleMessageCollect and endConsoleMessageCollect? They're really short

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

'use strict';

/**
* @fileoverview Audits a page to determine if it is calling deprecated APIs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe slightly more specific about auditing the log messages to surface deprecated API warnings or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// MediaStreamTrack.getSources(); // FAIL
// } catch(e) {}

// console.timeline(); // FAIL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be crazy to uncomment these so we'd be forced to keep up to date as they're fixed and so the expectations file would no longer match? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to do that b/c smokehouse tests will fail indefinitely until Chrome fixes it. That could be an annoying while :\

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I meant uncomment these but keep smokehouse expectation at 4 and let chrome eventually fixing the broken deprecations break the test, then update the expectations. But no problem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh got it. Done.


// FAIL
const xhr = new XMLHttpRequest();
xhr.open('GET', 'dbw_tester.html', false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, forgot to include earlier: on the topic of cross origin requests, can you change the https://unknown.com (which appears to be a real site, just not https) to something like https://unknown.invalid, which is reserved for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -117,7 +117,7 @@ module.exports = [
score: false,
extendedInfo: {
value: {
length: 4
length: 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did this one change?

Copy link
Contributor Author

@ebidel ebidel Jan 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The xhr got switched to include another http1.1 resource: xhr.open('GET', 'dbw_tester.html', false);. Moved from using an http2 endpoint (lighthouse-viewer.appspot.com).

@ebidel
Copy link
Contributor Author

ebidel commented Jan 18, 2017

PTAL

@ebidel
Copy link
Contributor Author

ebidel commented Jan 19, 2017

Travis is happy now.

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about time, travis. LGTM
🐴 🚃 🎚 🏣 ➡️ 🚨

@brendankenny brendankenny merged commit 3c8f57c into master Jan 19, 2017
@brendankenny brendankenny deleted the deprecations branch January 19, 2017 04:55
@ebidel
Copy link
Contributor Author

ebidel commented Jan 19, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants