Skip to content

debugger: assert test before accessing this.binding - #5145

Closed
princejwesley wants to merge 1 commit into
nodejs:masterfrom
princejwesley:assert-move-up
Closed

debugger: assert test before accessing this.binding#5145
princejwesley wants to merge 1 commit into
nodejs:masterfrom
princejwesley:assert-move-up

Conversation

@princejwesley

Copy link
Copy Markdown
Contributor

assert this.binding before accessing it

@princejwesley

Copy link
Copy Markdown
Contributor Author

/cc @indutny

@MylesBorins

Copy link
Copy Markdown
Contributor

LGTM

1 similar comment
@indutny

indutny commented Feb 8, 2016

Copy link
Copy Markdown
Member

LGTM

@mscdex mscdex added the debugger label Feb 8, 2016
@thefourtheye

Copy link
Copy Markdown
Contributor

LGTM

@Trott

Trott commented Feb 9, 2016

Copy link
Copy Markdown
Member

Did you manage to trigger this issue (so that your code failed with cannot read property of undefined or something like that when it should have failed with the assertion error)? Or did you simply see the issue in the code without triggering it?

@princejwesley

Copy link
Copy Markdown
Contributor Author

@Trott I saw the issue in the code without triggering it.
Code before:
image

After:
image

@Trott

Trott commented Feb 9, 2016

Copy link
Copy Markdown
Member

LGTM

A test might be a good idea, or it might be overkill. Thoughts?

The test would be simple based on your code above:

'use strict';
require('../common');
const assert = require('assert');

assert.throws(() => { require('_debug_agent').start(); },
  assert.AssertionError);

@princejwesley

Copy link
Copy Markdown
Contributor Author

@Trott I just have rearranged the code (predicate assertion first).
I couldn't find tests for _debug_agent.js. shall I create test/debugger/test-debugger-agent.js ?

@Trott

Trott commented Feb 9, 2016

Copy link
Copy Markdown
Member

@princejwesley I would put it in test/parallel rather than test/debugger. test-debugger-agent.js is fine for a file name, I think.

@princejwesley

Copy link
Copy Markdown
Contributor Author

@Trott I have used test/parallel/test-debug-agent.js.

@Trott

Trott commented Feb 9, 2016

Copy link
Copy Markdown
Member

@Trott

Trott commented Feb 9, 2016

Copy link
Copy Markdown
Member

CI looks good! Thanks for doing this!

@jasnell

jasnell commented Feb 10, 2016

Copy link
Copy Markdown
Member

LGTM

jasnell pushed a commit that referenced this pull request Feb 10, 2016
PR-URL: #5145
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell

jasnell commented Feb 10, 2016

Copy link
Copy Markdown
Member

Landed in 826844e

@jasnell jasnell closed this Feb 10, 2016
rvagg pushed a commit that referenced this pull request Feb 15, 2016
PR-URL: #5145
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 1, 2016
PR-URL: #5145
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 1, 2016
PR-URL: #5145
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
PR-URL: #5145
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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.

7 participants