Reduce reliance on fnGlobalObject.js

This harness function is not necessary in the majority of cases in which
it is used. Remove its usage to simplify tests and decrease the amount
of domain-specific knowledge necessary to contribute to the test suite.

Persist the harness function itself for use by future tests for ES2015
modules (such a helper is necessary for tests that are interpreted as
module code).
This commit is contained in:
Mike Pennisi 2016-04-22 13:07:00 -04:00 committed by Gorkem Yakin
parent 9aa4dced8d
commit eb644bb2da
219 changed files with 523 additions and 658 deletions

View File

@ -6,12 +6,10 @@ es5id: B.2.1
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.escape)
includes:
- fnGlobalObject.js
- propertyHelper.js
includes: [propertyHelper.js]
---*/
var global = fnGlobalObject();
var global = this;
verifyWritable(global, "escape");
verifyNotEnumerable(global, "escape");

View File

@ -6,13 +6,9 @@ es5id: B.2.2
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.unescape)
includes:
- fnGlobalObject.js
- propertyHelper.js
includes: [propertyHelper.js]
---*/
var global = fnGlobalObject();
verifyWritable(global, "unescape");
verifyNotEnumerable(global, "unescape");
verifyConfigurable(global, "unescape");
verifyWritable(this, "unescape");
verifyNotEnumerable(this, "unescape");
verifyConfigurable(this, "unescape");

View File

@ -4,7 +4,6 @@
/*---
es5id: 15.4.3.2-1-15
description: Array.isArray applied to the global object
includes: [fnGlobalObject.js]
---*/
assert.sameValue(Array.isArray(fnGlobalObject()), false, 'Array.isArray(fnGlobalObject())');
assert.sameValue(Array.isArray(this), false, 'Array.isArray(this)');

View File

@ -4,7 +4,6 @@
/*---
es5id: 15.4.4.16-2-15
description: Array.prototype.every - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
function callbackfn1(val, idx, obj) {
@ -15,11 +14,11 @@ includes: [fnGlobalObject.js]
return val > 11;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
assert(Array.prototype.every.call(fnGlobalObject(), callbackfn1), 'Array.prototype.every.call(fnGlobalObject(), callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn2), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn2)');
assert(Array.prototype.every.call(this, callbackfn1), 'Array.prototype.every.call(this, callbackfn1) !== true');
assert.sameValue(Array.prototype.every.call(this, callbackfn2), false, 'Array.prototype.every.call(this, callbackfn2)');

View File

@ -5,12 +5,13 @@
es5id: 15.4.4.16-5-1
description: Array.prototype.every - thisArg not passed
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/
var global = this;
function callbackfn(val, idx, obj)
{
return this === fnGlobalObject();
return this === global;
}
var arr = [1];

View File

@ -4,15 +4,15 @@
/*---
es5id: 15.4.4.16-5-21
description: Array.prototype.every - the global object can be used as thisArg
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return this === fnGlobalObject();
return this === global;
}
assert([11].every(callbackfn, fnGlobalObject()), '[11].every(callbackfn, fnGlobalObject()) !== true');
assert([11].every(callbackfn, global), '[11].every(callbackfn, global) !== true');
assert(accessed, 'accessed !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.16-7-c-i-23
description: >
Array.prototype.every - This object is an global object which
contains index property
includes: [fnGlobalObject.js]
---*/
function callbackfn(val, idx, obj) {
@ -17,8 +16,8 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1;
var oldLen = this.length;
this[0] = 11;
this.length = 1;
assert.sameValue(Array.prototype.every.call(fnGlobalObject(), callbackfn), false, 'Array.prototype.every.call(fnGlobalObject(), callbackfn)');
assert.sameValue(Array.prototype.every.call(this, callbackfn), false, 'Array.prototype.every.call(this, callbackfn)');

View File

@ -6,14 +6,14 @@ es5id: 15.4.4.16-7-c-iii-27
description: >
Array.prototype.every - return value of callbackfn is the global
object
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return fnGlobalObject();
return global;
}
assert([11].every(callbackfn), '[11].every(callbackfn) !== true');

View File

@ -4,18 +4,17 @@
/*---
es5id: 15.4.4.20-2-15
description: Array.prototype.filter - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
function callbackfn(val, idx, obj) {
return obj.length === 2;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
var newArr = Array.prototype.filter.call(this, callbackfn);
assert.sameValue(newArr.length, 2, 'newArr.length');

View File

@ -4,17 +4,18 @@
/*---
es5id: 15.4.4.20-5-21
description: Array.prototype.filter - the global object can be used as thisArg
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(val, idx, obj) {
accessed = true;
return this === fnGlobalObject();
return this === global;
}
var newArr = [11].filter(callbackfn, fnGlobalObject());
var newArr = [11].filter(callbackfn, global);
assert.sameValue(newArr[0], 11, 'newArr[0]');
assert(accessed, 'accessed !== true');

View File

@ -6,17 +6,16 @@ es5id: 15.4.4.20-9-c-i-23
description: >
Array.prototype.filter - This object is the global object which
contains index property
includes: [fnGlobalObject.js]
---*/
function callbackfn(val, idx, obj) {
return idx === 0 && val === 11;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1;
var newArr = Array.prototype.filter.call(fnGlobalObject(), callbackfn);
var oldLen = this.length;
this[0] = 11;
this.length = 1;
var newArr = Array.prototype.filter.call(this, callbackfn);
assert.sameValue(newArr.length, 1, 'newArr.length');
assert.sameValue(newArr[0], 11, 'newArr[0]');

View File

@ -6,11 +6,11 @@ es5id: 15.4.4.20-9-c-iii-28
description: >
Array.prototype.filter - return value of callbackfn is the global
object
includes: [fnGlobalObject.js]
---*/
var global = this;
function callbackfn(val, idx, obj) {
return fnGlobalObject();
return global;
}
var newArr = [11].filter(callbackfn);

View File

@ -4,7 +4,6 @@
/*---
es5id: 15.4.4.18-2-15
description: Array.prototype.forEach - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
var result = false;
@ -12,11 +11,11 @@ includes: [fnGlobalObject.js]
result = (obj.length === 2);
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
Array.prototype.forEach.call(this, callbackfn);
assert(result, 'result !== true');

View File

@ -4,14 +4,14 @@
/*---
es5id: 15.4.4.18-5-21
description: Array.prototype.forEach - the global object can be used as thisArg
includes: [fnGlobalObject.js]
---*/
var global = this;
var result = false;
function callbackfn(val, idx, obj) {
result = (this === fnGlobalObject());
result = (this === global);
}
[11].forEach(callbackfn, fnGlobalObject());
[11].forEach(callbackfn, this);
assert(result, 'result !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.18-7-c-i-23
description: >
Array.prototype.forEach - This object is an global object which
contains index property
includes: [fnGlobalObject.js]
---*/
var testResult = false;
@ -17,10 +16,10 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1;
var oldLen = this.length;
this[0] = 11;
this.length = 1;
Array.prototype.forEach.call(fnGlobalObject(), callbackfn);
Array.prototype.forEach.call(this, callbackfn);
assert(testResult, 'testResult !== true');

View File

@ -4,11 +4,10 @@
/*---
es5id: 15.4.4.14-1-17
description: Array.prototype.indexOf applied to the global object
includes: [fnGlobalObject.js]
---*/
var oldLen = fnGlobalObject().length;
fnGlobalObject()[1] = true;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[1] = true;
this.length = 2;
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), true), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), true)');
assert.sameValue(Array.prototype.indexOf.call(this, true), 1, 'Array.prototype.indexOf.call(this, true)');

View File

@ -4,19 +4,18 @@
/*---
es5id: 15.4.4.14-2-15
description: Array.prototype.indexOf - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
var targetObj = {};
var oldLen = fnGlobalObject().length;
fnGlobalObject().length = 2;
var oldLen = this.length;
this.length = 2;
fnGlobalObject()[1] = targetObj;
this[1] = targetObj;
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), 1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)');
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), 1, 'Array.prototype.indexOf.call(this, targetObj)');
fnGlobalObject()[1] = {};
fnGlobalObject()[2] = targetObj;
this[1] = {};
this[2] = targetObj;
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), -1, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)');
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), -1, 'Array.prototype.indexOf.call(this, targetObj)');

View File

@ -4,17 +4,16 @@
/*---
es5id: 15.4.4.14-9-b-i-23
description: Array.prototype.indexOf - This object is the global object
includes: [fnGlobalObject.js]
---*/
var targetObj = {};
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = targetObj;
fnGlobalObject()[100] = "100";
fnGlobalObject()[200] = "200";
fnGlobalObject().length = 200;
var oldLen = this.length;
this[0] = targetObj;
this[100] = "100";
this[200] = "200";
this.length = 200;
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), targetObj), 0, 'Array.prototype.indexOf.call(fnGlobalObject(), targetObj)');
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), "100"), 100, 'Array.prototype.indexOf.call(fnGlobalObject(), "100")');
assert.sameValue(Array.prototype.indexOf.call(fnGlobalObject(), "200"), -1, 'Array.prototype.indexOf.call(fnGlobalObject(), "200")');
assert.sameValue(Array.prototype.indexOf.call(this, targetObj), 0, 'Array.prototype.indexOf.call(this, targetObj)');
assert.sameValue(Array.prototype.indexOf.call(this, "100"), 100, 'Array.prototype.indexOf.call(this, "100")');
assert.sameValue(Array.prototype.indexOf.call(this, "200"), -1, 'Array.prototype.indexOf.call(this, "200")');

View File

@ -4,13 +4,12 @@
/*---
es5id: 15.4.4.15-1-17
description: Array.prototype.lastIndexOf applied to the global object
includes: [fnGlobalObject.js]
---*/
var targetObj = ["global"];
var oldLen = fnGlobalObject().length;
fnGlobalObject()[1] = targetObj;
fnGlobalObject().length = 3;
var oldLen = this.length;
this[1] = targetObj;
this.length = 3;
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), 1, 'Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj)');
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 1, 'Array.prototype.lastIndexOf.call(this, targetObj)');

View File

@ -6,19 +6,18 @@ es5id: 15.4.4.15-2-15
description: >
Array.prototype.lastIndexOf - 'length' is property of the global
object
includes: [fnGlobalObject.js]
---*/
var targetObj = {};
var oldLen = fnGlobalObject().length;
fnGlobalObject().length = 2;
var oldLen = this.length;
this.length = 2;
fnGlobalObject()[1] = targetObj;
this[1] = targetObj;
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), 1);
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 1);
fnGlobalObject()[1] = {};
fnGlobalObject()[2] = targetObj;
this[1] = {};
this[2] = targetObj;
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), -1);
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), -1);

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.15-3-19
description: >
Array.prototype.lastIndexOf - value of 'length' is an Object which
has an own toString method
includes: [fnGlobalObject.js]
---*/
// objects inherit the default valueOf() method from Object
@ -15,7 +14,7 @@ includes: [fnGlobalObject.js]
// to a number by calling its toString() method and converting the
// resulting string to a number.
var targetObj = fnGlobalObject();
var targetObj = this;
var obj = {
1: targetObj,
2: 2,

View File

@ -4,17 +4,16 @@
/*---
es5id: 15.4.4.15-8-b-i-23
description: Array.prototype.lastIndexOf - This object is the global object
includes: [fnGlobalObject.js]
---*/
var targetObj = {};
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = targetObj;
fnGlobalObject()[100] = "100";
fnGlobalObject()[200] = "200";
fnGlobalObject().length = 200;
var oldLen = this.length;
this[0] = targetObj;
this[100] = "100";
this[200] = "200";
this.length = 200;
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj), 0, 'Array.prototype.lastIndexOf.call(fnGlobalObject(), targetObj)');
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), "100"), 100, 'Array.prototype.lastIndexOf.call(fnGlobalObject(), "100")');
assert.sameValue(Array.prototype.lastIndexOf.call(fnGlobalObject(), "200"), -1, 'Array.prototype.lastIndexOf.call(fnGlobalObject(), "200")');
assert.sameValue(Array.prototype.lastIndexOf.call(this, targetObj), 0, 'Array.prototype.lastIndexOf.call(this, targetObj)');
assert.sameValue(Array.prototype.lastIndexOf.call(this, "100"), 100, 'Array.prototype.lastIndexOf.call(this, "100")');
assert.sameValue(Array.prototype.lastIndexOf.call(this, "200"), -1, 'Array.prototype.lastIndexOf.call(this, "200")');

View File

@ -6,18 +6,17 @@ es5id: 15.4.4.19-2-15
description: >
Array.prototype.map - when 'length' is property of the global
object
includes: [fnGlobalObject.js]
---*/
function callbackfn(val, idx, obj) {
return val > 10;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
var testResult = Array.prototype.map.call(fnGlobalObject(), callbackfn);
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
var testResult = Array.prototype.map.call(this, callbackfn);
assert.sameValue(testResult.length, 2, 'testResult.length');

View File

@ -5,10 +5,9 @@
es5id: 15.4.4.19-5-1
description: Array.prototype.map - thisArg not passed
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/
fnGlobalObject()._15_4_4_19_5_1 = true;
this._15_4_4_19_5_1 = true;
(function() {
var _15_4_4_19_5_1 = false;

View File

@ -4,13 +4,13 @@
/*---
es5id: 15.4.4.19-5-21
description: Array.prototype.map - the global object can be used as thisArg
includes: [fnGlobalObject.js]
---*/
var global = this;
function callbackfn(val, idx, obj) {
return this === fnGlobalObject();
return this === global;
}
var testResult = [11].map(callbackfn, fnGlobalObject());
var testResult = [11].map(callbackfn, this);
assert.sameValue(testResult[0], true, 'testResult[0]');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.19-8-c-i-23
description: >
Array.prototype.map - This object is the global object which
contains index property
includes: [fnGlobalObject.js]
---*/
var kValue = "abc";
@ -18,10 +17,10 @@ includes: [fnGlobalObject.js]
return false;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = kValue;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = kValue;
this.length = 2;
var testResult = Array.prototype.map.call(fnGlobalObject(), callbackfn);
var testResult = Array.prototype.map.call(this, callbackfn);
assert.sameValue(testResult[0], true, 'testResult[0]');

View File

@ -4,17 +4,16 @@
/*---
es5id: 15.4.4.21-2-15
description: Array.prototype.reduce - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
function callbackfn(prevVal, curVal, idx, obj) {
return (obj.length === 2);
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
assert.sameValue(Array.prototype.reduce.call(fnGlobalObject(), callbackfn, 1), true, 'Array.prototype.reduce.call(fnGlobalObject(), callbackfn, 1)');
assert.sameValue(Array.prototype.reduce.call(this, callbackfn, 1), true, 'Array.prototype.reduce.call(this, callbackfn, 1)');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.21-8-b-iii-1-23
description: >
Array.prototype.reduce - This object is the global object which
contains index property
includes: [fnGlobalObject.js]
---*/
var testResult = false;
@ -16,12 +15,12 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 0;
fnGlobalObject()[1] = 1;
fnGlobalObject()[2] = 2;
fnGlobalObject().length = 3;
var oldLen = this.length;
this[0] = 0;
this[1] = 1;
this[2] = 2;
this.length = 3;
Array.prototype.reduce.call(fnGlobalObject(), callbackfn);
Array.prototype.reduce.call(this, callbackfn);
assert(testResult, 'testResult !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.21-9-c-i-23
description: >
Array.prototype.reduce - This object is the global object which
contains index property
includes: [fnGlobalObject.js]
---*/
var testResult = false;
@ -17,11 +16,11 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 0;
fnGlobalObject()[1] = 1;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = 0;
this[1] = 1;
this.length = 2;
Array.prototype.reduce.call(fnGlobalObject(), callbackfn, initialValue);
Array.prototype.reduce.call(this, callbackfn, initialValue);
assert(testResult, 'testResult !== true');

View File

@ -6,16 +6,16 @@ es5id: 15.4.4.21-9-c-ii-37
description: >
Array.prototype.reduce - the global object can be used as
accumulator
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
return prevVal === fnGlobalObject();
return prevVal === global;
}
var obj = { 0: 11, length: 1 };
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, fnGlobalObject()), true, 'Array.prototype.reduce.call(obj, callbackfn, fnGlobalObject())');
assert.sameValue(Array.prototype.reduce.call(obj, callbackfn, this), true, 'Array.prototype.reduce.call(obj, callbackfn, this)');
assert(accessed, 'accessed !== true');

View File

@ -6,21 +6,21 @@ es5id: 15.4.4.22-2-15
description: >
Array.prototype.reduceRight - 'length' is property of the global
object
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
return obj.length === fnGlobalObject().length;
return obj.length === global.length;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 12;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 9;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = 12;
this[1] = 11;
this[2] = 9;
this.length = 2;
assert(Array.prototype.reduceRight.call(fnGlobalObject(), callbackfn, 111), 'Array.prototype.reduceRight.call(fnGlobalObject(), callbackfn, 111) !== true');
assert(Array.prototype.reduceRight.call(this, callbackfn, 111), 'Array.prototype.reduceRight.call(this, callbackfn, 111) !== true');
assert(accessed, 'accessed !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.22-8-b-iii-1-23
description: >
Array.prototype.reduceRight - This object is the global object
which contains index property
includes: [fnGlobalObject.js]
---*/
var testResult = false;
@ -16,12 +15,12 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 0;
fnGlobalObject()[1] = 1;
fnGlobalObject()[2] = 2;
fnGlobalObject().length = 3;
var oldLen = this.length;
this[0] = 0;
this[1] = 1;
this[2] = 2;
this.length = 3;
Array.prototype.reduceRight.call(fnGlobalObject(), callbackfn);
Array.prototype.reduceRight.call(this, callbackfn);
assert(testResult, 'testResult !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.22-9-c-i-23
description: >
Array.prototype.reduceRight - This object is an global object
which contains index property
includes: [fnGlobalObject.js]
---*/
var testResult = false;
@ -16,12 +15,12 @@ includes: [fnGlobalObject.js]
}
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 0;
fnGlobalObject()[1] = 1;
fnGlobalObject()[2] = 2;
fnGlobalObject().length = 3;
var oldLen = this.length;
this[0] = 0;
this[1] = 1;
this[2] = 2;
this.length = 3;
Array.prototype.reduceRight.call(fnGlobalObject(), callbackfn, "initialValue");
Array.prototype.reduceRight.call(this, callbackfn, "initialValue");
assert(testResult, 'testResult !== true');

View File

@ -6,16 +6,16 @@ es5id: 15.4.4.22-9-c-ii-37
description: >
Array.prototype.reduceRight - the global object can be used as
accumulator
includes: [fnGlobalObject.js]
---*/
var global = this;
var accessed = false;
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
return prevVal === fnGlobalObject();
return prevVal === global;
}
var obj = { 0: 11, length: 1 };
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, fnGlobalObject()), true, 'Array.prototype.reduceRight.call(obj, callbackfn, fnGlobalObject())');
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, this), true, 'Array.prototype.reduceRight.call(obj, callbackfn, this)');
assert(accessed, 'accessed !== true');

View File

@ -4,7 +4,6 @@
/*---
es5id: 15.4.4.17-2-15
description: Array.prototype.some - 'length' is property of the global object
includes: [fnGlobalObject.js]
---*/
function callbackfn1(val, idx, obj) {
@ -15,11 +14,11 @@ includes: [fnGlobalObject.js]
return val > 11;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 9;
fnGlobalObject()[1] = 11;
fnGlobalObject()[2] = 12;
fnGlobalObject().length = 2;
var oldLen = this.length;
this[0] = 9;
this[1] = 11;
this[2] = 12;
this.length = 2;
assert(Array.prototype.some.call(fnGlobalObject(), callbackfn1), 'Array.prototype.some.call(fnGlobalObject(), callbackfn1) !== true');
assert.sameValue(Array.prototype.some.call(fnGlobalObject(), callbackfn2), false, 'Array.prototype.some.call(fnGlobalObject(), callbackfn2)');
assert(Array.prototype.some.call(this, callbackfn1), 'Array.prototype.some.call(this, callbackfn1) !== true');
assert.sameValue(Array.prototype.some.call(this, callbackfn2), false, 'Array.prototype.some.call(this, callbackfn2)');

View File

@ -4,11 +4,11 @@
/*---
es5id: 15.4.4.17-5-21
description: Array.prototype.some - the global object can be used as thisArg
includes: [fnGlobalObject.js]
---*/
var global = this;
function callbackfn(val, idx, obj) {
return this === fnGlobalObject();
return this === global;
}
assert([11].some(callbackfn, fnGlobalObject()), '[11].some(callbackfn, fnGlobalObject()) !== true');
assert([11].some(callbackfn, this), '[11].some(callbackfn, global) !== true');

View File

@ -6,7 +6,6 @@ es5id: 15.4.4.17-7-c-i-23
description: >
Array.prototype.some - This object is an global object which
contains index property
includes: [fnGlobalObject.js]
---*/
function callbackfn(val, idx, obj) {
@ -16,8 +15,8 @@ includes: [fnGlobalObject.js]
return false;
}
var oldLen = fnGlobalObject().length;
fnGlobalObject()[0] = 11;
fnGlobalObject().length = 1;
var oldLen = this.length;
this[0] = 11;
this.length = 1;
assert(Array.prototype.some.call(fnGlobalObject(), callbackfn), 'Array.prototype.some.call(fnGlobalObject(), callbackfn) !== true');
assert(Array.prototype.some.call(this, callbackfn), 'Array.prototype.some.call(this, callbackfn) !== true');

View File

@ -6,11 +6,11 @@ es5id: 15.4.4.17-7-c-iii-26
description: >
Array.prototype.some - return value of callbackfn is the global
object
includes: [fnGlobalObject.js]
---*/
var global = this;
function callbackfn(val, idx, obj) {
return fnGlobalObject();
return global;
}
assert([11].some(callbackfn), '[11].some(callbackfn) !== true');

View File

@ -8,13 +8,13 @@ description: >
non-strict function (strict function declaration called by
Function.prototype.apply(globalObject))
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { "use strict"; gNonStrict();};
assert.throws(TypeError, function() {
f.apply(fnGlobalObject());
f.apply(global);
});
function gNonStrict() {

View File

@ -8,13 +8,13 @@ description: >
non-strict function (strict function declaration called by
Function.prototype.call(globalObject))
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { "use strict"; gNonStrict();};
assert.throws(TypeError, function() {
f.call(fnGlobalObject());
f.call(this);
});
function gNonStrict() {

View File

@ -8,13 +8,13 @@ description: >
non-strict function (strict function declaration called by
Function.prototype.bind(globalObject)())
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { "use strict"; gNonStrict();};
assert.throws(TypeError, function() {
f.bind(fnGlobalObject())();
f.bind(global)();
});
function gNonStrict() {

View File

@ -9,11 +9,11 @@ description: >
strict Function.prototype.apply(globalObject))
flags: [noStrict]
features: [caller]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { return gNonStrict();};
(function () {"use strict"; f.apply(fnGlobalObject()); })();
(function () {"use strict"; f.apply(global); })();
function gNonStrict() {

View File

@ -9,11 +9,11 @@ description: >
strict Function.prototype.call(globalObject))
flags: [noStrict]
features: [caller]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { return gNonStrict();};
(function () {"use strict"; f.call(fnGlobalObject()); })();
(function () {"use strict"; f.call(global); })();
function gNonStrict() {

View File

@ -9,11 +9,11 @@ description: >
strict Function.prototype.bind(globalObject)())
flags: [noStrict]
features: [caller]
includes: [fnGlobalObject.js]
---*/
var global = this;
function f() { return gNonStrict();};
(function () {"use strict"; f.bind(fnGlobalObject())(); })();
(function () {"use strict"; f.bind(global)(); })();
function gNonStrict() {

View File

@ -6,10 +6,9 @@ es5id: 15.1.1.2-0
description: >
Global.Infinity is a data property with default attribute values
(false)
includes: [fnGlobalObject.js]
---*/
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), 'Infinity');
var desc = Object.getOwnPropertyDescriptor(this, 'Infinity');
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');

View File

@ -5,11 +5,11 @@
info: The Infinity is ReadOnly
es5id: 15.1.1.2_A2_T1
description: Checking typeof Functions
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotWritable(fnGlobalObject(), "Infinity", null, true);
verifyNotWritable(this, "Infinity", null, true);
if (typeof(Infinity) === "boolean") {
$ERROR('#1: Infinity = true; typeof(Infinity) !== "boolean". Actual: ' + (typeof(Infinity)));
}

View File

@ -5,14 +5,14 @@
info: The Infinity is DontDelete
es5id: 15.1.1.2_A3_T1
description: Use delete
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotConfigurable(fnGlobalObject(), "Infinity");
verifyNotConfigurable(this, "Infinity");
try {
if (delete fnGlobalObject().Infinity !== false) {
if (delete this.Infinity !== false) {
$ERROR('#1: delete Infinity === false.');
}
} catch (e) {

View File

@ -4,10 +4,9 @@
/*---
es5id: 15.1.1.1-0
description: Global.NaN is a data property with default attribute values (false)
includes: [fnGlobalObject.js]
---*/
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), 'NaN');
var desc = Object.getOwnPropertyDescriptor(this, 'NaN');
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');

View File

@ -5,11 +5,11 @@
info: The NaN is ReadOnly
es5id: 15.1.1.1_A2_T1
description: Checking typeof Functions
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotWritable(fnGlobalObject(), "NaN", null, true);
verifyNotWritable(this, "NaN", null, true);
if (typeof(NaN) === "boolean") {
$ERROR('#1: NaN = true; typeof(NaN) !== "boolean". Actual: ' + (typeof(NaN)));
}

View File

@ -5,14 +5,14 @@
info: The NaN is DontDelete
es5id: 15.1.1.2_A3_T1
description: Use delete
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
// CHECK#1
verifyNotConfigurable(fnGlobalObject(), "NaN");
verifyNotConfigurable(this, "NaN");
try {
if (delete fnGlobalObject().NaN !== false) {
if (delete this.NaN !== false) {
$ERROR('#1: delete NaN === false.');
}
} catch (e) {

View File

@ -7,13 +7,12 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'configurable'
property (8.10.5 step 4.a)
includes: [fnGlobalObject.js]
---*/
fnGlobalObject().configurable = true;
this.configurable = true;
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
var result1 = newObj.hasOwnProperty("prop");

View File

@ -6,12 +6,11 @@ es5id: 15.2.3.5-4-149
description: >
Object.create - 'configurable' property of one property in
'Properties' is the global object (8.10.5 step 4.b)
includes: [fnGlobalObject.js]
---*/
var newObj = Object.create({}, {
prop: {
configurable: fnGlobalObject()
configurable: this
}
});

View File

@ -7,13 +7,12 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a)
includes: [fnGlobalObject.js]
---*/
fnGlobalObject().value = "GlobalValue";
this.value = "GlobalValue";
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
assert.sameValue(newObj.prop, "GlobalValue", 'newObj.prop');

View File

@ -7,13 +7,12 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'writable'
property (8.10.5 step 6.a)
includes: [fnGlobalObject.js]
---*/
fnGlobalObject().writable = true;
this.writable = true;
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
var beforeWrite = (newObj.hasOwnProperty("prop") && typeof (newObj.prop) === "undefined");

View File

@ -6,12 +6,11 @@ es5id: 15.2.3.5-4-228
description: >
Object.create - 'writable' property of one property in
'Properties' is the global object (8.10.5 step 6.b)
includes: [fnGlobalObject.js]
---*/
var newObj = Object.create({}, {
prop: {
writable: fnGlobalObject()
writable: this
}
});
var hasProperty = newObj.hasOwnProperty("prop");

View File

@ -7,15 +7,14 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'get' property
(8.10.5 step 7.a)
includes: [fnGlobalObject.js]
---*/
fnGlobalObject().get = function () {
this.get = function () {
return "VerifyGlobalObject";
};
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
assert.sameValue(newObj.prop, "VerifyGlobalObject", 'newObj.prop');

View File

@ -7,17 +7,16 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'set' property
(8.10.5 step 8.a)
includes: [fnGlobalObject.js]
---*/
var data = "data";
fnGlobalObject().set = function (value) {
this.set = function (value) {
data = value;
};
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
var hasProperty = newObj.hasOwnProperty("prop");

View File

@ -6,14 +6,14 @@ es5id: 15.2.3.5-4-300
description: >
Object.create - 'set' property of one property in 'Properties' is
a host object that isn't callable (8.10.5 step 8.b)
includes: [fnGlobalObject.js]
---*/
var global = this;
assert.throws(TypeError, function() {
Object.create({}, {
prop: {
set: fnGlobalObject()
set: global
}
});
});

View File

@ -7,15 +7,14 @@ description: >
Object.create - one property in 'Properties' is the global object
that uses Object's [[Get]] method to access the 'enumerable'
property (8.10.5 step 3.a)
includes: [fnGlobalObject.js]
---*/
var accessed = false;
fnGlobalObject().enumerable = true;
this.enumerable = true;
var newObj = Object.create({}, {
prop: fnGlobalObject()
prop: this
});
for (var property in newObj) {
if (property === "prop") {

View File

@ -6,14 +6,13 @@ es5id: 15.2.3.5-4-96
description: >
Object.create - 'enumerable' property of one property in
'Properties' is the global object (8.10.5 step 3.b)
includes: [fnGlobalObject.js]
---*/
var accessed = false;
var newObj = Object.create({}, {
prop: {
enumerable: fnGlobalObject()
enumerable: this
}
});
for (var property in newObj) {

View File

@ -6,28 +6,28 @@ es5id: 15.2.3.7-2-18
description: >
Object.defineProperties - argument 'Properties' is the global
object
includes: [fnGlobalObject.js]
---*/
var global = this;
var obj = {};
var result = false;
try {
Object.defineProperty(fnGlobalObject(), "prop", {
Object.defineProperty(this, "prop", {
get: function () {
result = (this === fnGlobalObject());
result = (this === global);
return {};
},
enumerable: true,
configurable:true
});
Object.defineProperties(obj, fnGlobalObject());
Object.defineProperties(obj, this);
} catch (e) {
if (!(e instanceof TypeError)) throw e;
result = true;
} finally {
delete fnGlobalObject().prop;
delete this.prop;
}
assert(result, 'result !== true');

View File

@ -6,14 +6,13 @@ es5id: 15.2.3.7-5-b-109
description: >
Object.defineProperties - value of 'configurable' property of
'descObj' is the global object (8.10.5 step 4.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
Object.defineProperties(obj, {
property: {
configurable: fnGlobalObject()
configurable: this
}
});
var preCheck = obj.hasOwnProperty("property");

View File

@ -7,15 +7,14 @@ description: >
Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'value' property (8.10.5
step 5.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().value = "global";
this.value = "global";
Object.defineProperties(obj, {
property: fnGlobalObject()
property: this
});
assert.sameValue(obj.property, "global", 'obj.property');

View File

@ -7,18 +7,16 @@ description: >
Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'writable' property
(8.10.5 step 6.a)
includes:
- propertyHelper.js
- fnGlobalObject.js
includes: [propertyHelper.js]
---*/
var obj = {};
fnGlobalObject().writable = false;
this.writable = false;
Object.defineProperties(obj, {
property: fnGlobalObject()
property: this
});
assert(obj.hasOwnProperty("property"));

View File

@ -6,14 +6,13 @@ es5id: 15.2.3.7-5-b-188
description: >
Object.defineProperties - value of 'writable' property of
'descObj' is the global object (8.10.5 step 6.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
Object.defineProperties(obj, {
property: {
writable: fnGlobalObject()
writable: this
}
});

View File

@ -7,17 +7,16 @@ description: >
Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'get' property (8.10.5
step 7.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().get = function () {
this.get = function () {
return "global";
};
Object.defineProperties(obj, {
property: fnGlobalObject()
property: this
});
assert.sameValue(obj.property, "global", 'obj.property');

View File

@ -7,16 +7,15 @@ description: >
Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'enumerable' property
(8.10.5 step 3.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
var accessed = false;
fnGlobalObject().enumerable = true;
this.enumerable = true;
Object.defineProperties(obj, {
prop: fnGlobalObject()
prop: this
});
for (var property in obj) {
if (property === "prop") {

View File

@ -6,7 +6,6 @@ es5id: 15.2.3.7-5-b-56
description: >
Object.defineProperties - value of 'enumerable' property of
'descObj' is the global object (8.10.5 step 3.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
@ -14,7 +13,7 @@ includes: [fnGlobalObject.js]
Object.defineProperties(obj, {
prop: {
enumerable: fnGlobalObject()
enumerable: this
}
});
for (var property in obj) {

View File

@ -7,15 +7,14 @@ description: >
Object.defineProperties - 'descObj' is the global object which
implements its own [[Get]] method to get 'configurable' property
(8.10.5 step 4.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().configurable = true;
this.configurable = true;
Object.defineProperties(obj, {
prop: fnGlobalObject()
prop: this
});
var result1 = obj.hasOwnProperty("prop");

View File

@ -7,29 +7,29 @@ description: >
Object.defineProperties - 'O' is the global object which
implements its own [[GetOwnProperty]] method to get 'P' (8.12.9
step 1 )
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
Object.defineProperty(fnGlobalObject(), "prop", {
Object.defineProperty(this, "prop", {
value: 11,
writable: true,
enumerable: true,
configurable: true
});
Object.defineProperties(fnGlobalObject(), {
Object.defineProperties(this, {
prop: {
value: 12
}
});
verifyEqualTo(fnGlobalObject(), "prop", 12);
verifyEqualTo(this, "prop", 12);
verifyWritable(fnGlobalObject(), "prop");
verifyWritable(this, "prop");
verifyEnumerable(fnGlobalObject(), "prop");
verifyEnumerable(this, "prop");
verifyConfigurable(fnGlobalObject(), "prop");
verifyConfigurable(this, "prop");
delete fnGlobalObject().prop;
delete this.prop;

View File

@ -6,13 +6,12 @@ es5id: 15.2.3.6-3-123
description: >
Object.defineProperty - 'configurable' property in 'Attributes' is
the global object (8.10.5 step 4.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
var attr = {
configurable: fnGlobalObject()
configurable: this
};
Object.defineProperty(obj, "property", attr);

View File

@ -7,13 +7,12 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'value' property
(8.10.5 step 5.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().value = "global";
this.value = "global";
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
assert.sameValue(obj.property, "global", 'obj.property');

View File

@ -7,14 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'writable' property
(8.10.5 step 6.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().writable = true;
this.writable = true;
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
var beforeWrite = obj.hasOwnProperty("property");

View File

@ -6,13 +6,12 @@ es5id: 15.2.3.6-3-202
description: >
Object.defineProperty - 'writable' property in 'Attributes' is the
global object (8.10.5 step 6.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
Object.defineProperty(obj, "property", {
writable: fnGlobalObject()
writable: this
});
var beforeWrite = obj.hasOwnProperty("property");

View File

@ -7,15 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'get' property (8.10.5
step 7.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().get = function () {
this.get = function () {
return "globalGetProperty";
};
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
assert.sameValue(obj.property, "globalGetProperty", 'obj.property');

View File

@ -7,17 +7,16 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'set' property (8.10.5
step 8.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
var data = "data";
fnGlobalObject().set = function (value) {
this.set = function (value) {
data = value;
};
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
obj.property = "overrideData";
assert(obj.hasOwnProperty("property"), 'obj.hasOwnProperty("property") !== true');

View File

@ -7,15 +7,14 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'enumerable' property
(8.10.5 step 3.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
var accessed = false;
fnGlobalObject().enumerable = true;
this.enumerable = true;
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
for (var prop in obj) {
if (prop === "property") {

View File

@ -6,13 +6,12 @@ es5id: 15.2.3.6-3-70
description: >
Object.defineProperty - value of 'enumerable' property in
'Attributes' is the global object (8.10.5 step 3.b)
includes: [fnGlobalObject.js]
---*/
var obj = {};
var accessed = false;
Object.defineProperty(obj, "property", { enumerable: fnGlobalObject() });
Object.defineProperty(obj, "property", { enumerable: this });
for (var prop in obj) {
if (prop === "property") {

View File

@ -7,14 +7,13 @@ description: >
Object.defineProperty - 'Attributes' is the global object that
uses Object's [[Get]] method to access the 'configurable' property
(8.10.5 step 4.a)
includes: [fnGlobalObject.js]
---*/
var obj = {};
fnGlobalObject().configurable = true;
this.configurable = true;
Object.defineProperty(obj, "property", fnGlobalObject());
Object.defineProperty(obj, "property", this);
var beforeDeleted = obj.hasOwnProperty("property");

View File

@ -8,11 +8,11 @@ description: >
property successfully when [[Configurable]] attribute is true and
[[Writable]] attribute is false, 'O' is the global object (8.12.9
- step Note)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
try {
Object.defineProperty(obj, "0", {

View File

@ -8,7 +8,7 @@ description: >
property 'P' successfully when [[Configurable]] attribute is true
and [[Writable]] attribute is false, 'A' is an Array object
(8.12.9 step - Note)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/

View File

@ -7,11 +7,11 @@ description: >
Object.defineProperty will update [[Value]] attribute successfully
when [[Configurable]] attribute is true and [[Writable]] attribute
is false, 'O' is the global object (8.12.9 - step Note)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
try {
Object.defineProperty(obj, "property", {

View File

@ -7,12 +7,10 @@ description: >
ES5 Attributes - property 'P' with attributes [[Writable]]: false,
[[Enumerable]]: true, [[Configurable]]: true is non-writable using
simple assignment, 'O' is the global object
includes:
- propertyHelper.js
- fnGlobalObject.js
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
Object.defineProperty(obj, "prop", {
value: 2010,

View File

@ -8,12 +8,10 @@ description: >
[[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true
to an accessor property, 'O' is the global object (8.12.9 - step
9.b.i)
includes:
- propertyHelper.js
- fnGlobalObject.js
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
Object.defineProperty(obj, "prop", {
value: 2010,

View File

@ -8,14 +8,14 @@ description: >
attributes are [[Writable]]: false, [[Enumerable]]: true,
[[Configurable]]: true to an accessor property, 'O' is the global
object (8.12.9 - step 9.b.i)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
function getFunc() {
return 20;
}
var obj = fnGlobalObject();
var obj = this;
try {
Object.defineProperty(obj, "0", {
value: 2010,

View File

@ -6,16 +6,15 @@ es5id: 15.2.3.6-4-399
description: >
ES5 Attributes - [[Value]] attribute of data property is the
global object
includes: [fnGlobalObject.js]
---*/
var obj = {};
Object.defineProperty(obj, "prop", {
value: fnGlobalObject()
value: this
});
var desc = Object.getOwnPropertyDescriptor(obj, "prop");
assert.sameValue(obj.prop, fnGlobalObject(), 'obj.prop');
assert.sameValue(desc.value, fnGlobalObject(), 'desc.value');
assert.sameValue(obj.prop, this, 'obj.prop');
assert.sameValue(desc.value, this, 'desc.value');

View File

@ -7,18 +7,18 @@ description: >
Object.defineProperty - 'O' is the global object that uses
Object's [[GetOwnProperty]] method to access the 'name' property
(8.12.9 step 1)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
Object.defineProperty(fnGlobalObject(), "foo", {
Object.defineProperty(this, "foo", {
value: 12,
configurable: true
});
verifyEqualTo(fnGlobalObject(), "foo", 12);
verifyEqualTo(this, "foo", 12);
verifyNotWritable(fnGlobalObject(), "foo");
verifyNotWritable(this, "foo");
verifyNotEnumerable(fnGlobalObject(), "foo");
verifyNotEnumerable(this, "foo");
verifyConfigurable(fnGlobalObject(), "foo");
verifyConfigurable(this, "foo");

View File

@ -8,11 +8,11 @@ description: >
of indexed accessor property 'P' successfully when
[[Configurable]] attribute is true, 'O' is the global object
(8.12.9 step 11)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
try {
obj.verifySetFunction = "data";
Object.defineProperty(obj, "0", {

View File

@ -7,10 +7,9 @@ description: >
ES5 Attributes - Updating an indexed accessor property 'P' using
simple assignment is successful, 'O' is the global object (8.12.5
step 5.b)
includes: [fnGlobalObject.js]
---*/
var obj = fnGlobalObject();
var obj = this;
obj.verifySetFunc = "data";
var setFunc = function (value) {

View File

@ -7,11 +7,11 @@ description: >
Object.defineProperty will update [[Get]] and [[Set]] attributes
of named accessor property 'P' successfully when [[Configurable]]
attribute is true, 'O' is the global object (8.12.9 step 11)
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
try {
obj.verifySetFunction = "data";
Object.defineProperty(obj, "property", {

View File

@ -7,12 +7,10 @@ description: >
ES5 Attributes - Updating a named accessor property 'P' without
[[Set]] using simple assignment is failed, 'O' is the global
object (8.12.5 step 5.b)
includes:
- propertyHelper.js
- fnGlobalObject.js
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
obj.verifySetFunc = "data";
var getFunc = function () {

View File

@ -7,10 +7,10 @@ description: >
ES5 Attributes - Updating a named accessor property 'P' whose
[[Configurable]] attribute is true to a data property is
successful, 'O' is the global object
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
obj.verifySetFunc = "data";
var getFunc = function () {

View File

@ -7,10 +7,10 @@ description: >
ES5 Attributes - Updating an indexed accessor property 'P' whose
[[Configurable]] attribute is true to a data property is
successful, 'O' is the global object
includes: [propertyHelper.js, fnGlobalObject.js]
includes: [propertyHelper.js]
---*/
var obj = fnGlobalObject();
var obj = this;
obj.verifySetFunc = "data";
var getFunc = function () {

View File

@ -6,10 +6,9 @@ es5id: 15.2.3.3-4-10
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.decodeURIComponent)
includes: [fnGlobalObject.js]
---*/
var global = fnGlobalObject();
var global = this;
var desc = Object.getOwnPropertyDescriptor(global, "decodeURIComponent");
assert.sameValue(desc.value, global.decodeURIComponent, 'desc.value');

View File

@ -6,10 +6,9 @@ es5id: 15.2.3.3-4-11
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.encodeURIComponent)
includes: [fnGlobalObject.js]
---*/
var global = fnGlobalObject();
var global = this;
var desc = Object.getOwnPropertyDescriptor(global, "encodeURIComponent");
assert.sameValue(desc.value, global.encodeURIComponent, 'desc.value');

View File

@ -6,11 +6,10 @@ es5id: 15.2.3.3-4-178
description: >
Object.getOwnPropertyDescriptor returns data desc (all false) for
properties on built-ins (Global.NaN)
includes: [fnGlobalObject.js]
---*/
// in non-strict mode, 'this' is bound to the global object.
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), "NaN");
var desc = Object.getOwnPropertyDescriptor(this, "NaN");
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');

View File

@ -6,11 +6,10 @@ es5id: 15.2.3.3-4-179
description: >
Object.getOwnPropertyDescriptor returns data desc (all false) for
properties on built-ins (Global.Infinity)
includes: [fnGlobalObject.js]
---*/
// in non-strict mode, 'this' is bound to the global object.
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), "Infinity");
var desc = Object.getOwnPropertyDescriptor(this, "Infinity");
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');

View File

@ -6,11 +6,10 @@ es5id: 15.2.3.3-4-180
description: >
Object.getOwnPropertyDescriptor returns data desc (all false) for
properties on built-ins (Global.undefined)
includes: [fnGlobalObject.js]
---*/
// in non-strict mode, 'this' is bound to the global object.
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), "undefined");
var desc = Object.getOwnPropertyDescriptor(this, "undefined");
assert.sameValue(desc.writable, false, 'desc.writable');
assert.sameValue(desc.enumerable, false, 'desc.enumerable');

View File

@ -6,10 +6,9 @@ es5id: 15.2.3.3-4-4
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.eval)
includes: [fnGlobalObject.js]
---*/
var global = fnGlobalObject();
var global = this;
var desc = Object.getOwnPropertyDescriptor(global, "eval");
assert.sameValue(desc.value, global.eval, 'desc.value');

View File

@ -6,10 +6,9 @@ es5id: 15.2.3.3-4-5
description: >
Object.getOwnPropertyDescriptor returns data desc for functions on
built-ins (Global.parseInt)
includes: [fnGlobalObject.js]
---*/
var global = fnGlobalObject();
var global = this;
var desc = Object.getOwnPropertyDescriptor(global, "parseInt");
assert.sameValue(desc.value, global.parseInt, 'desc.value');

Some files were not shown because too many files have changed in this diff Show More