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

timers: length == 0 is untouchable because type checking #8487

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
7 participants
@yorkie
Copy link
Member

commented Sep 11, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

timers

Description of change

In setTimetout, setInterval and setImmediate functions, the case 0 on arguments.length are untouchable because an TypeError would be threw and not able to run at that line.

@yorkie yorkie added the timers label Sep 11, 2016

@Trott

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

LGTM if CI is green

@cjihrig

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2016

LGTM

@yorkie

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2016

@lpinca

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

Commit subject line is a bit too long, can I suggest "timers: remove unreachable code"?
Change LGTM though.

@yorkie yorkie force-pushed the yorkie:timers/fix-untouchable branch to 42fbed1 Sep 11, 2016

@yorkie

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2016

Thank you @lpinca changed to your suggestion :)

@addaleax

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

LGTM, CI failures look unrelated (one test-crypto-timing-safe-equal failure)

@Fishrock123

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

LGTM

@Fishrock123

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

Actually, isn't 1 also impossible to get to then?

@yorkie

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2016

@Fishrock123 setTimeout(fn) should be reachable to case 1, the TypeError should be only thrown when the callback is not a function.

@Fishrock123

This comment has been minimized.

Copy link
Member

commented Sep 11, 2016

Ah yes. Misunderstood.

@yorkie

This comment has been minimized.

Copy link
Member Author

commented Sep 15, 2016

Landed at 9b0246b :)

@yorkie yorkie closed this Sep 15, 2016

yorkie added a commit that referenced this pull request Sep 15, 2016

timers: remove unreachable code
PR-URL: #8487
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>

@yorkie yorkie deleted the yorkie:timers/fix-untouchable branch Sep 15, 2016

Fishrock123 added a commit that referenced this pull request Oct 11, 2016

timers: remove unreachable code
PR-URL: #8487
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.