You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.
Original issue 13 created by mikesamuel on 2007-12-05T04:22:32.000Z:
Jeff Walden reports that
var o =
{
toString: function()
{
if (firstTime)
{
firstTime = false;
return "toString"; // guessing this is readable on functions
}
return "constructor";
}
};
triggered a bug in readPub__ causing it to return the constructor.
We should use a similar trick to define an object
function singleUseFunction(x) {
var called = false;
return function () {
if (called) { throw new Error('Called multiple times'); }
called = true;
return x;
};
}
var o = {
toString: singleUseFunction('x'),
valueOf: singleUseFunction('x')
};
and pass o as a key to readPub et al.
What steps will reproduce the problem? 1. 2. 3.
What is the expected output? What do you see instead?
Please use labels and text to provide additional information.
The text was updated successfully, but these errors were encountered:
Original issue 13 created by mikesamuel on 2007-12-05T04:22:32.000Z:
Jeff Walden reports that
var o =
{
toString: function()
{
if (firstTime)
{
firstTime = false;
return "toString"; // guessing this is readable on functions
}
return "constructor";
}
};
triggered a bug in readPub__ causing it to return the constructor.
We should use a similar trick to define an object
function singleUseFunction(x) {
var called = false;
return function () {
if (called) { throw new Error('Called multiple times'); }
called = true;
return x;
};
}
var o = {
toString: singleUseFunction('x'),
valueOf: singleUseFunction('x')
};
and pass o as a key to readPub et al.
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
Please use labels and text to provide additional information.
The text was updated successfully, but these errors were encountered: