зеркало из https://github.com/mozilla/gecko-dev.git
bug 300534: Internal Narcissus functions show up in objects' prototypes. This fixes a failure on the js testsuite and also fixes Narcissus' failure on SpiderMonkey's bug 299641. r=brendan
This commit is contained in:
Родитель
5a2cebdfa7
Коммит
f47551589c
|
@ -890,18 +890,18 @@ var Fp = Function.prototype;
|
|||
var REp = RegExp.prototype;
|
||||
|
||||
if (!('__call__' in Fp)) {
|
||||
Fp.__call__ = function (t, a, x) {
|
||||
Fp.__defineProperty__('__call__', function (t, a, x) {
|
||||
// Curse ECMA yet again!
|
||||
a = Array.prototype.splice.call(a, 0, a.length);
|
||||
return this.apply(t, a);
|
||||
};
|
||||
}, true, true, true);
|
||||
|
||||
REp.__call__ = function (t, a, x) {
|
||||
REp.__defineProperty__('__call__', function (t, a, x) {
|
||||
a = Array.prototype.splice.call(a, 0, a.length);
|
||||
return this.exec.apply(this, a);
|
||||
};
|
||||
}, true, true, true);
|
||||
|
||||
Fp.__construct__ = function (a, x) {
|
||||
Fp.__defineProperty__('__construct__', function (a, x) {
|
||||
switch (a.length) {
|
||||
case 0:
|
||||
return new this();
|
||||
|
@ -921,14 +921,14 @@ if (!('__call__' in Fp)) {
|
|||
return new this(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
|
||||
}
|
||||
throw "PANIC: too many arguments to constructor";
|
||||
};
|
||||
}, true, true, true);
|
||||
|
||||
// Since we use native functions such as Date along with host ones such
|
||||
// as global.eval, we want both to be considered instances of the native
|
||||
// Function constructor.
|
||||
Fp.__hasInstance__ = function (v) {
|
||||
Fp.__defineProperty__('__hasInstance__', function (v) {
|
||||
return v instanceof Function || v instanceof global.Function;
|
||||
};
|
||||
}, true, true, true);
|
||||
}
|
||||
|
||||
function thunk(f, x) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* vim: set sw=4 ts=8 et tw=80: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -222,7 +223,13 @@ function Script(t, x) {
|
|||
}
|
||||
|
||||
// Node extends Array, which we extend slightly with a top-of-stack method.
|
||||
Array.prototype.top = function () { return this.length && this[this.length-1]; }
|
||||
Array.prototype.__defineProperty__(
|
||||
'top',
|
||||
function () {
|
||||
return this.length && this[this.length-1];
|
||||
},
|
||||
false, false, true
|
||||
);
|
||||
|
||||
function Node(t, type) {
|
||||
var token = t.token;
|
||||
|
|
Загрузка…
Ссылка в новой задаче