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

src: disallow calling env-dependent methods during bootstrap #27234

Closed
wants to merge 1 commit into from

Commits on Apr 15, 2019

  1. src: disallow calling env-dependent methods during bootstrap

    These cannot be preserved correctly in v8 snapshot. Currently
    none of these are called during bootstrap, this adds assertions
    to make sure future contributors do not accidentally call
    these in the wrong time.
    
    Consider this, on the machine that builds releases:
    
    ```
    process.cwd();  // "/home/iojs/build/workspace/"
    ```
    
    User downloads this binary to their machine:
    
    ```
    $ cd ~/
    $ pwd  // "/User/foo"
    $ node -p "process.cwd()" // "/home/iojs/build/workspace/"
    ```
    
    This patch only adds checks in methods that get states from the
    environment - it's not likely that the setters would be called
    during bootstrap, and if they are called, we'll just ignore them
    and whatever tests that test the change would fail when snapshot
    is enabled. However the getters may be called in order
    to persist information into strings and that would be harder
    to catch (the test is only likely to test the format of these
    strings which won't be useful).
    joyeecheung committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    aba0729 View commit details
    Browse the repository at this point in the history