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

Prototype property returned on access despite later override to null #697

Open
natevw opened this issue Jan 10, 2015 · 0 comments
Open

Prototype property returned on access despite later override to null #697

natevw opened this issue Jan 10, 2015 · 0 comments

Comments

@natevw
Copy link
Contributor

natevw commented Jan 10, 2015

var util = require('util');

function Base() {}
Base.prototype.foo = function () {
    console.log("!!!");
};

var obj2 = new Base();
obj2.foo = null;
console.log("???", obj2.foo);

function Subclass() {}
util.inherits(Subclass, Base);
Subclass.prototype.foo = (void 0);

var obj = new Subclass();
obj.foo();

Expected:

??? null
TypeError: Property 'foo' of object # is not a function

Actual:

??? function () { [compiled code] }
!!!

This was masking an issue where the HTTPS agent prototype's socket creation method was not actually getting overridden as expected, instead the HTTP agent method was just getting called!

natevw added a commit that referenced this issue Jan 10, 2015
…te insecure socket (see #697 for cause of silent fallback)
natevw added a commit that referenced this issue Jan 27, 2015
…te insecure socket (see #697 for cause of silent fallback)
natevw added a commit that referenced this issue Feb 23, 2015
…te insecure socket (see #697 for cause of silent fallback)
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

No branches or pull requests

1 participant