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

core(devtools-model): fix missing Runtime.experiments object #3514

Merged
merged 1 commit into from
Oct 9, 2017
Merged
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: 8 additions & 5 deletions lighthouse-core/lib/traces/devtools-timeline-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ class TimelineModel {
// populate with events
this._tracingModel.reset();

ConsoleQuieter.mute({prefix: 'timelineModel'});
this._tracingModel.addEvents(events);
this._tracingModel.tracingComplete();
this._timelineModel.setEvents(this._tracingModel);
ConsoleQuieter.unmuteAndFlush();
try {
ConsoleQuieter.mute({prefix: 'timelineModel'});
Copy link
Collaborator

Choose a reason for hiding this comment

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

what does this do?

Copy link
Member

Choose a reason for hiding this comment

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

what does this do?

any console messages that are absorbed are later logged with that as the logger prefix/title

Copy link
Collaborator

@patrickhulce patrickhulce Oct 9, 2017

Choose a reason for hiding this comment

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

oh I didn't mean this particular line, just why is this try/finally necessary now? we're not catching anything the connection to the mocha failure isn't clear to me, so here to learn :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Previous to this patch landing, when you run mocha lighthouse-core/test/lib/traces/devtools-timeline-model-test.js it just exits silently. That's because console-quieter was also muting the logs from mocha. They never got flushed (the finally) because of an exception.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh gotchaaaa, mocha really just calls console.log? I see

Copy link
Member Author

Choose a reason for hiding this comment

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

yah it does. found that this morning. was kinda surprised they aren't doing process.std*.write(), but yeah. :)

this._tracingModel.addEvents(events);
this._tracingModel.tracingComplete();
this._timelineModel.setEvents(this._tracingModel);
} finally {
ConsoleQuieter.unmuteAndFlush();
}

return this;
}
Expand Down
4 changes: 4 additions & 0 deletions lighthouse-core/lib/web-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports = (function() {

global.Runtime = global.Runtime || {};

// Required for devtools-timeline-model
global.Runtime.experiments = global.Runtime.experiments || {};
global.Runtime.experiments.isEnabled = global.Runtime.experiments.isEnabled || (_ => false);

const _queryParam = global.Runtime.queryParam;
global.Runtime.queryParam = function(arg) {
switch (arg) {
Expand Down