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

Chore: Move evaluate to child process #494

Closed
wants to merge 1 commit into from

Conversation

qzhou1607-zz
Copy link
Contributor

  • Move evaluate to its child process
  • Start evaluate on traverse::start

This solves the stuck spinner issue.

Fix #485


try {
const script: vm.Script = new vm.Script(source);
const evaluteResult = await script.runInContext(jsdomutils.implForWrapper(window.document)._global);
Copy link
Contributor

Choose a reason for hiding this comment

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

After navigate you should wait for this._options.waitFor as it does in jsdom.ts. In that way, you will have a version of the site as much similar to the parent one as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sarvaje Done.

@@ -11,7 +11,7 @@ import { AxeResults, Result as AxeResult, NodeResult as AxeNodeResult } from 'ax

import { readFileAsync } from '../../utils/misc';
import { debug as d } from '../../utils/debug';
import { IAsyncHTMLElement, ITraverseEnd, IRule, IRuleBuilder, Severity } from '../../types'; // eslint-disable-line no-unused-vars
import { IAsyncHTMLElement, IRule, IRuleBuilder, Severity, ITraverseStart } from '../../types'; // eslint-disable-line no-unused-vars
Copy link
Member

Choose a reason for hiding this comment

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

Now that I think about it, we have a problem switching to traverse::start with chrome.
We might want to create a custom event for evaluating scripts and each connector can fire it when it is more appropriate.
Maybe something like canevaluate?

@sonarwhal/contributors what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@molant I haven't encounter any issue with axe using chrome so far. What's the issue with using traverse::start in chrome?

Now that I think about it, we have a problem switching to traverse::start with chrome.

That way maybe we can have a more clear message to show when evaluate is running, like Running scripts..., rather than hanging at Traversing the DOM when it's actually evaluating.

Maybe something like canevaluate?

Copy link
Member

Choose a reason for hiding this comment

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

I haven't encounter any issue with axe using chrome so far.

The problem is that we will be telling people to evaluate scripts on traverse::start. Those scripts could modify the DOM and alter the results. That's why I'd rather do all of that at the end of the process for chrome. With jsdom we don't have that problem because it is a separate process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@molant I put it back as traverse::end for now before we decide whether or not we should have a custom event.

Copy link
Member

Choose a reason for hiding this comment

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

For reference, the discussion about this is now in #497

@molant
Copy link
Member

molant commented Sep 7, 2017

@alrra what do you think about the tagging of this PR? Maybe use a Fix instead of Chore?

@alrra
Copy link
Contributor

alrra commented Sep 7, 2017

@alrra what do you think about the tagging of this PR? Maybe use a Fix instead of Chore?

It's a user facing thing ("This solves the stuck spinner issue") so yes, use Fix:.

@molant
Copy link
Member

molant commented Sep 7, 2017

It's a user facing thing ("This solves the stuck spinner issue") so yes, use Fix:.

I'll update the commit message when squashing. There is a huge queue on travis an don't want to wait even more to merge this.

@alrra alrra closed this in a5b9951 Sep 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants