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

test: add known_issues test for #5350 #10319

Closed
wants to merge 1 commit into from

Conversation

AnnaMag
Copy link
Member

@AnnaMag AnnaMag commented Dec 17, 2016

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

tests

Description of change

A test addressing subproblem of #5350
inherited properties flattened in the vm.runInNewContext
is added to the known_issues directory.
It will be fixed with the 5.5 V8 API changes

#5350 is a consequence of the above as flattening of sandbox
inherited properties happens first inside the vm context
and is subsequently translated onto the outer sandbox.
assert.strictEqual(sandbox.hasOwnProperty('propBase'), false);

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 17, 2016
@Fishrock123
Copy link
Contributor

@AnnaMag btw, to get the list to show up as a checklist you need to remove the white space. :D

e.g. - [x]

Copy link
Contributor

@Fishrock123 Fishrock123 left a comment

Choose a reason for hiding this comment

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

I think make lint should catch those nits? I forget.

CI: https://ci.nodejs.org/job/node-test-pull-request/5454/


const context = vm.createContext(sandbox);

const result = vm.runInContext("this.hasOwnProperty('prop_base');", context);
Copy link
Contributor

Choose a reason for hiding this comment

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

single quotes please!

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this the proper way to write it?
'this.hasOwnProperty("propBase");'
I thought that double quotes are used in JS to avoid escaping: http://standardjs.com/rules.html
Could you clarify this for me, please? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh uh... good question. We don't use Standard though (for legacy reasons).

@Trott thoughts? I'd prefer template strings tbh but I think our linter may warn about that currently...

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I asked for future reference.
I used template strings here: https://github.com/nodejs/node/pull/10272/files
and looks like the linter was ok with it

Copy link
Member

Choose a reason for hiding this comment

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

In our lint rules, double quotes are acceptable if being used to avoid escaping single quotes. There are a few examples of it in the code base, but not many.

Copy link
Member

Choose a reason for hiding this comment

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

(Just providing the answer to the question asked. I'm fine with whatever you do in this case as long as the linter accepts it.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

const assert = require('assert');

const base = {
prop_base: 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

could we drop the trailing comma?

@AnnaMag
Copy link
Member Author

AnnaMag commented Dec 17, 2016

cc/ @fhinkel

From https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox
Outside of scripts run by the vm module, sandbox will remain unchanged.
Should sandbox always reflect changes happening in the vm context (even if changes do not cause unintended behavior)?

const assert = require('assert');

const base = {
prop_base: 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use camelCase for JavaScript variables please.

};

const sandbox = Object.create(base, {
prop_sandbox: {value: 3}
Copy link
Contributor

Choose a reason for hiding this comment

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

camelCase here too please.

@AnnaMag
Copy link
Member Author

AnnaMag commented Dec 17, 2016

@Fishrock123, @cjihrig Done- thanks!

@mscdex mscdex added the vm Issues and PRs related to the vm subsystem. label Dec 17, 2016
@italoacasas
Copy link
Contributor

@@ -0,0 +1,20 @@
'use strict';
// Ref: https://github.com/nodejs/node/issues/5350
Copy link
Member

Choose a reason for hiding this comment

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

We usually don't include Ref: when linking to issues. I can only find two tests that do that. (For consistency they probably shouldn't)

Copy link
Contributor

Choose a reason for hiding this comment

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

The known issue tests do.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it matters.

The more information possible the better, though.

Copy link
Member

Choose a reason for hiding this comment

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

I meant just get rid of Ref, not the link.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea. I meant the known issue tests (I think all of them) include Refs: at the top.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind. Didn't realize that's the standard for known tests. Sorry for derailing the discussion.

@AnnaMag
Copy link
Member Author

AnnaMag commented Dec 20, 2016

Yes, it seems to be included in all files in that dir. I assumed it was an agreed upon "standard". Of course, np to remove it.

Copy link
Member

@fhinkel fhinkel left a comment

Choose a reason for hiding this comment

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

LGTM

@italoacasas
Copy link
Contributor

Landed: b73402d

evanlucas pushed a commit that referenced this pull request Jan 3, 2017
PR-URL: #10319
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
PR-URL: #10319
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
PR-URL: #10319
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins
Copy link
Contributor

MylesBorins commented Jan 23, 2017

this passes on v6 and fails on v4. Landed only on v6

MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
PR-URL: #10319
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2017
@AnnaMag AnnaMag deleted the test-issue-5350 branch January 25, 2017 14:58
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
PR-URL: #10319
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants