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

lib: consistent this in callbacks #14645

Closed
wants to merge 5 commits into from
Closed

Commits on Aug 9, 2017

  1. test: refactor test-fs-stat

    * add `use strict'
    * change checks that `this` is mapped to `global` in sloppy mode to
      checks that `this` is `undefined`
    * modify arguments to assertions to match docs (actual first, expected
      second)
    * add blank line below `common` declaration per test writing guide
    * use `assert.ifError()` as appropriate
    Trott committed Aug 9, 2017
    Configuration menu
    Copy the full SHA
    b3166e3 View commit details
    Browse the repository at this point in the history
  2. fs: invoke callbacks with undefined context

    Many callbacks appear to be invoked with `this` set to `undefined`
    including `fs.stat()`, `fs.lstat()`, and `fs.fstat()`.
    
    However, some such as `fs.open()` and `fs.mkdtemp()` invoke their
    callbacks with `this` set to `null`. Change to `undefined`.
    Trott committed Aug 9, 2017
    Configuration menu
    Copy the full SHA
    9d6365a View commit details
    Browse the repository at this point in the history
  3. test: check this value for nextTick()

    Depending on how many arguments are provided, `nextTick()` may run its
    callback with `this` set to `null` or not. Add assertions for
    both cases.
    Trott committed Aug 9, 2017
    Configuration menu
    Copy the full SHA
    23918c4 View commit details
    Browse the repository at this point in the history
  4. process: make this value consistent

    The value of `this` for callbacks of `nextTick()` can vary depending on
    the number of arguments. Make it consistent.
    Trott committed Aug 9, 2017
    Configuration menu
    Copy the full SHA
    aa07e87 View commit details
    Browse the repository at this point in the history
  5. benchmark: cover more nextTick() code

    The benchmarks for `process.nextTick()` do not cover the `default` case
    in the internal code's `switch` statement where the callback receives
    more than 3 arguments. Modify two of the benchmarks to include this
    condition.
    Trott committed Aug 9, 2017
    Configuration menu
    Copy the full SHA
    64e1f00 View commit details
    Browse the repository at this point in the history