mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 621376 - new Function.prototype on trace should not define Function.prototype.prototype. r=brendan
This commit is contained in:
parent
001fbb6163
commit
ff60a27654
22
js/src/jit-test/tests/basic/new-Function-prototype.js
Normal file
22
js/src/jit-test/tests/basic/new-Function-prototype.js
Normal file
@ -0,0 +1,22 @@
|
||||
var funProto = Function.prototype;
|
||||
assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined);
|
||||
|
||||
assertEq(parseInt.prototype, undefined);
|
||||
|
||||
var oldObj;
|
||||
for (var i = 0, sz = RUNLOOP; i < sz; oldObj = obj, i++)
|
||||
{
|
||||
var obj = new funProto;
|
||||
assertEq(obj === oldObj, false);
|
||||
assertEq(Object.prototype.toString.call(obj), "[object Object]");
|
||||
assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined);
|
||||
assertEq(Object.getOwnPropertyDescriptor(parseInt, "prototype"), undefined);
|
||||
assertEq(parseInt.prototype, undefined);
|
||||
}
|
||||
|
||||
checkStats({
|
||||
recorderStarted: 1,
|
||||
recorderAborted: 0,
|
||||
traceTriggered: 1,
|
||||
traceCompleted: 1,
|
||||
});
|
26
js/src/jit-test/tests/basic/new-bound-function.js
Normal file
26
js/src/jit-test/tests/basic/new-bound-function.js
Normal file
@ -0,0 +1,26 @@
|
||||
var funProto = Function.prototype;
|
||||
assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined);
|
||||
|
||||
function Point(x, y) { this.x = x; this.y = y; }
|
||||
|
||||
var YAxisPoint = Point.bind(null, 0);
|
||||
|
||||
assertEq(YAxisPoint.prototype, undefined);
|
||||
|
||||
var oldPoint;
|
||||
for (var i = 0, sz = RUNLOOP; i < sz; oldPoint = point, i++)
|
||||
{
|
||||
var point = new YAxisPoint(5);
|
||||
assertEq(point === oldPoint, false);
|
||||
assertEq(point.x, 0);
|
||||
assertEq(point.y, 5);
|
||||
assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined);
|
||||
assertEq(Object.getOwnPropertyDescriptor(YAxisPoint, "prototype"), undefined);
|
||||
}
|
||||
|
||||
checkStats({
|
||||
recorderStarted: 1,
|
||||
recorderAborted: 1,
|
||||
traceTriggered: 0,
|
||||
traceCompleted: 0,
|
||||
});
|
@ -2950,8 +2950,11 @@ js_CreateThisFromTrace(JSContext *cx, Class *clasp, JSObject *ctor)
|
||||
proto = NewNativeClassInstance(cx, clasp, proto, parent);
|
||||
if (!proto)
|
||||
return NULL;
|
||||
if (!js_SetClassPrototype(cx, ctor, proto, JSPROP_ENUMERATE | JSPROP_PERMANENT))
|
||||
return NULL;
|
||||
JSFunction *fun = ctor->getFunctionPrivate();
|
||||
if (!fun->isNative() && !fun->isFunctionPrototype()) {
|
||||
if (!js_SetClassPrototype(cx, ctor, proto, JSPROP_ENUMERATE | JSPROP_PERMANENT))
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* A primitive value in .prototype means to use Object.prototype
|
||||
|
Loading…
Reference in New Issue
Block a user