// GENERATED, DO NOT EDIT // file: assert.js // Copyright (C) 2017 Ecma International. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| Collectionofassertionfunctionsusedthroughouttest262 defines: -assert -formatIdentityFreeValue -formatSimpleValue -isNegativeZero -isPrimitive
---*/
function isNegativeZero(value) { return value === 0 && 1 / value === -Infinity;
}
function isPrimitive(value) { return !value || (typeof value !== 'object' && typeof value !== 'function');
}
if (typeof message === 'symbol') {
message = message.toString();
}
if (isPrimitive(actual)) { assert(false, "Actual argument [" + actual + "] shouldn't be primitive. " + String(message));
} elseif (isPrimitive(expected)) { assert(false, "Expected argument [" + expected + "] shouldn't be primitive. " + String(message));
} var result = compareArray(actual, expected); if (result) return;
var format = compareArray.format; assert(false, "Actual " + format(actual) + " and expected " + format(expected) + " should have the same contents. " + String(message));
};
function compareArray(a, b) { if (b.length !== a.length) { returnfalse;
} for (var i = 0; i < a.length; i++) { if (!assert._isSameValue(b[i], a[i])) { returnfalse;
}
} returntrue;
}
// file: compareArray.js // Copyright (C) 2017 Ecma International. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| DeprecatednowthatcompareArrayisdefinedinassert.js. defines:[compareArray]
---*/
// file: propertyHelper.js // Copyright (C) 2017 Ecma International. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| Collectionoffunctionsusedtosafelyverifythecorrectnessof propertydescriptors. defines: -verifyProperty -verifyCallableProperty -verifyAccessorProperty -verifyEqualTo#deprecated -verifyWritable#deprecated -verifyNotWritable#deprecated -verifyEnumerable#deprecated -verifyNotEnumerable#deprecated -verifyConfigurable#deprecated -verifyNotConfigurable#deprecated -verifyPrimordialProperty -verifyPrimordialCallableProperty -verifyPrimordialAccessorProperty
---*/
// @ts-check
// Capture primordial functions and receiver-uncurried primordial methods that // are used in verification but might be destroyed *by* that process itself. var __isArray = Array.isArray; var __defineProperty = Object.defineProperty; var __getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var __getOwnPropertyNames = Object.getOwnPropertyNames; var __join = Function.prototype.call.bind(Array.prototype.join); var __push = Function.prototype.call.bind(Array.prototype.push); var __hasOwnProperty = Function.prototype.call.bind(Object.prototype.hasOwnProperty); var __propertyIsEnumerable = Function.prototype.call.bind(Object.prototype.propertyIsEnumerable); var nonIndexNumericPropertyName = Math.pow(2, 32) - 1;
/** *@param{object}obj *@param{string|symbol}name *@param{PropertyDescriptor|undefined}desc *@param{object}[options] *@param{boolean}[options.label] *@param{boolean}[options.restore]revertmutationsfromverifyingwritable/configurable
*/ function verifyProperty(obj, name, desc, options) { assert(
arguments.length > 2, 'verifyProperty should receive at least 3 arguments: obj, name, and descriptor'
); var label = options && options.label || String(name);
var originalDesc = __getOwnPropertyDescriptor(obj, name);
// Allows checking for undefined descriptor if it's explicitly given. if (desc === undefined) { assert.sameValue(
originalDesc,
undefined,
label + " descriptor should be undefined"
);
// desc and originalDesc are both undefined, problem solved; returntrue;
}
assert(__hasOwnProperty(obj, name), label + " should be an own property");
assert.notSameValue(
desc, null, "The desc argument should be an object or undefined, null"
);
assert.sameValue( typeof desc, "object", "The desc argument should be an object or undefined, " + String(desc)
);
if (__hasOwnProperty(desc, 'value')) { if (!isSameValue(desc.value, originalDesc.value)) {
__push(failures, label + " descriptor value should be " + String(desc.value));
} if (!isSameValue(desc.value, obj[name])) {
__push(failures, label + " value should be " + String(desc.value));
}
}
function isEnumerable(obj, name) { var stringCheck = false;
if (typeof name === "string") { for (var x in obj) { if (x === name) {
stringCheck = true; break;
}
}
} else { // skip it if name is not string, works for Symbol names.
stringCheck = true;
}
function isSameValue(a, b) { if (a === 0 && b === 0) return1 / a === 1 / b; if (a !== a && b !== b) returntrue;
return a === b;
}
function isWritable(obj, name, verifyProp, value) { var unlikelyValue = __isArray(obj) && name === "length" ?
nonIndexNumericPropertyName : "unlikelyValue"; var newValue = value || unlikelyValue; var hadValue = __hasOwnProperty(obj, name); var oldValue = obj[name]; var writeSucceeded;
// Revert the change only if it was successful (in other cases, reverting // is unnecessary and may trigger exceptions for certain property // configurations) if (writeSucceeded) { if (hadValue) {
obj[name] = oldValue;
} else { delete obj[name];
}
}
/** *Verifythatthereisanaccessorpropertyassociatedwith`obj[name]`and *followingtheconventionsforbuilt-inobjects. * *@param{object}obj *@param{string|symbol}name *@param{object}desc *@param{boolean}[desc.enumerable]defaultstoaccessorpropertyconventions(non-enumerable) *@param{boolean}[desc.configurable]defaultstoaccessorpropertyconventions(configurable) *@param{undefined|Function|{name?:string|symbol,length?:number}}[desc.get]ifanobject, *absentfieldsdefaulttogetterconventions(namederivedfromthepropertykeywitha"get" *prefix,length0) *@param{undefined|Function|{name?:string|symbol,length?:number}}[desc.set]ifanobject, *absentfieldsdefaulttogetterconventions(namederivedfromthepropertykeywitha"set" *prefix,length1) *@param{object}[options] *@param{boolean}[options.label] *@param{typeofverifyProperty}[options.verifyProperty] *@param{typeofverifyCallableProperty}[options.verifyCallableProperty] *@param{boolean}[options.restore]revertmutationsfromverifyingpropertyattributes
*/ function verifyAccessorProperty(obj, name, desc, options) { var checkGet = __hasOwnProperty(desc, "get"); var checkSet = __hasOwnProperty(desc, "set"); assert(
checkGet || checkSet, 'verifyAccessorProperty requires at least one of "get" and "set"'
); var label = options && options.label || String(name); var propertyVerifier = options && options.verifyProperty || verifyProperty; var callabilityVerifier = options && options.verifyCallableProperty || verifyCallableProperty;
var originalDesc = __getOwnPropertyDescriptor(obj, name);
// Every built-in function object, including constructors, has a "name" // property whose value is a String. Unless otherwise specified, this value is // the name that is given to the function in this specification. Functions // that are identified as anonymous functions use the empty String as the // value of the "name" property. For functions that are specified as // properties of objects, the name value is the property name string used to // access the function. Functions that are specified as get or set accessor // functions of built-in properties have "get" or "set" (respectively) passed // to the prefix parameter when calling CreateBuiltinFunction. // // The value of the "name" property is explicitly specified for each built-in // functions whose property key is a Symbol value. If such an explicitly // specified value starts with the prefix "get " or "set " and the function // for which it is specified is a get or set accessor function of a built-in // property, the value without the prefix is passed to the name parameter, and // the value "get" or "set" (respectively) is passed to the prefix parameter // when calling CreateBuiltinFunction. // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html if (checkGet) { var expectGetter = desc.get; var getterLabel = label + " getter"; if (expectGetter === undefined || typeof expectGetter === "function") { assert.sameValue(originalDesc.get, expectGetter, getterLabel);
} else { var getterName = expectGetter.name; if (getterName === undefined) {
getterName = "get " + (typeof name === "symbol" ? "[" + name.description + "]" : name);
} var getterLength = expectGetter.length !== undefined ? expectGetter.length : 0; var getterOptions = { label: getterLabel };
callabilityVerifier(originalDesc, "get", getterName, getterLength, {}, getterOptions);
}
} if (checkSet) { var expectSetter = desc.set; var setterLabel = label + " setter"; if (expectSetter === undefined || typeof expectSetter === "function") { assert.sameValue(originalDesc.set, expectSetter, setterLabel);
} else { var setterName = expectSetter.name; if (setterName === undefined) {
setterName = "set " + (typeof name === "symbol" ? "[" + name.description + "]" : name);
} var setterLength = expectSetter.length !== undefined ? expectSetter.length : 1; var setterOptions = { label: setterLabel };
callabilityVerifier(originalDesc, "set", setterName, setterLength, {}, setterOptions);
}
}
// Every accessor property described in clauses 19 through 28 and in Annex B.2 // has the attributes { [[Enumerable]]: false, [[Configurable]]: true } unless // otherwise specified. // https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html var resolvedDesc = { get: originalDesc.get, set: originalDesc.set }; if (!__hasOwnProperty(desc, "enumerable")) {
resolvedDesc.enumerable = false;
} elseif (desc.enumerable !== undefined) {
resolvedDesc.enumerable = desc.enumerable;
} if (!__hasOwnProperty(desc, "configurable")) {
resolvedDesc.configurable = true;
} elseif (desc.configurable !== undefined) {
resolvedDesc.configurable = desc.configurable;
}
propertyVerifier(obj, name, resolvedDesc, options);
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyEqualTo(obj, name, value) { if (!isSameValue(obj[name], value)) { thrownew Test262Error("Expected obj[" + String(name) + "] to equal " + value + ", actually " + obj[name]);
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyWritable(obj, name, verifyProp, value) { if (!verifyProp) { assert(__getOwnPropertyDescriptor(obj, name).writable, "Expected obj[" + String(name) + "] to have writable:true.");
} if (!isWritable(obj, name, verifyProp, value)) { thrownew Test262Error("Expected obj[" + String(name) + "] to be writable, but was not.");
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyNotWritable(obj, name, verifyProp, value) { if (!verifyProp) { assert(!__getOwnPropertyDescriptor(obj, name).writable, "Expected obj[" + String(name) + "] to have writable:false.");
} if (isWritable(obj, name, verifyProp)) { thrownew Test262Error("Expected obj[" + String(name) + "] NOT to be writable, but was.");
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyEnumerable(obj, name) { assert(__getOwnPropertyDescriptor(obj, name).enumerable, "Expected obj[" + String(name) + "] to have enumerable:true."); if (!isEnumerable(obj, name)) { thrownew Test262Error("Expected obj[" + String(name) + "] to be enumerable, but was not.");
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyNotEnumerable(obj, name) { assert(!__getOwnPropertyDescriptor(obj, name).enumerable, "Expected obj[" + String(name) + "] to have enumerable:false."); if (isEnumerable(obj, name)) { thrownew Test262Error("Expected obj[" + String(name) + "] NOT to be enumerable, but was.");
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyConfigurable(obj, name) { assert(__getOwnPropertyDescriptor(obj, name).configurable, "Expected obj[" + String(name) + "] to have configurable:true."); if (!isConfigurable(obj, name)) { thrownew Test262Error("Expected obj[" + String(name) + "] to be configurable, but was not.");
}
}
/** *Deprecated;pleaseuse`verifyProperty`innewtests.
*/ function verifyNotConfigurable(obj, name) { assert(!__getOwnPropertyDescriptor(obj, name).configurable, "Expected obj[" + String(name) + "] to have configurable:false."); if (isConfigurable(obj, name)) { thrownew Test262Error("Expected obj[" + String(name) + "] NOT to be configurable, but was.");
}
}
/** *Usethisfunctiontoverifythepropertiesofaprimordialobject. *Fornon-primordialobjects,useverifyProperty. *See:https://github.com/tc39/how-we-work/blob/main/terminology.md#primordial
*/ var verifyPrimordialProperty = verifyProperty;
// file: sta.js // Copyright (c) 2012 Ecma International. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description:| Providesboth:
function Test262Error(message) { if (!(thisinstanceof Test262Error)) returnnew Test262Error(message); this.message = message || "";
}
Test262Error.prototype.toString = function () { return"Test262Error: " + this.message;
};
Test262Error.thrower = function (message) { thrownew Test262Error(message);
};
function $DONOTEVALUATE() { throw"Test262: This statement should not be evaluated.";
}
// file: test262-host.js // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Save built-in functions and constructors. var FunctionToString = global.Function.prototype.toString; var ReflectApply = global.Reflect.apply; var Atomics = global.Atomics; var Error = global.Error; var SharedArrayBuffer = global.SharedArrayBuffer; var Int32Array = global.Int32Array;
// Save built-in shell functions. var NewGlobal = global.newGlobal; var setSharedArrayBuffer = global.setSharedArrayBuffer; var getSharedArrayBuffer = global.getSharedArrayBuffer; var evalInWorker = global.evalInWorker; var monotonicNow = global.monotonicNow; var gc = global.gc; var clearKeptObjects = global.clearKeptObjects;
var hasCreateIsHTMLDDA = "createIsHTMLDDA" in global; var hasThreads = ("helperThreadCount" in global ? global.helperThreadCount() > 0 : true); var hasMailbox = typeof setSharedArrayBuffer === "function" && typeof getSharedArrayBuffer === "function"; var hasEvalInWorker = typeof evalInWorker === "function";
if (!hasCreateIsHTMLDDA && !("document" in global && "all" in global.document)) thrownew Error("no [[IsHTMLDDA]] object available for testing");
var IsHTMLDDA = hasCreateIsHTMLDDA
? global.createIsHTMLDDA()
: global.document.all;
// The $262.agent framework is not appropriate for browsers yet, and some // test cases can't work in browsers (they block the main thread).
var shellCode = hasMailbox && hasEvalInWorker; var sabTestable = Atomics && SharedArrayBuffer && hasThreads && shellCode;
// SpiderMonkey complication: With run-time argument --no-threads // our test runner will not properly filter test cases that can't be // run because agents can't be started, and so we do a little // filtering here: We will quietly succeed and exit if an agent test // should not have been run because threads cannot be started. // // Firefox complication: The test cases that use $262.agent can't // currently work in the browser, so for now we rely on them not // being run at all.
if (!sabTestable) {
let {reportCompare, quit} = global;
function notAvailable() { // See comment above. if (!hasThreads && shellCode) {
reportCompare(0, 0);
quit(0);
} thrownew Error("Agents not available");
}
// The SpiderMonkey implementation uses a designated shared buffer _ia // for coordination, and spinlocks for everything except sleeping.
var _MSG_LOC = 0; // Low bit set: broadcast available; High bits: seq # var _ID_LOC = 1; // ID sent with broadcast var _ACK_LOC = 2; // Worker increments this to ack that broadcast was received var _RDY_LOC = 3; // Worker increments this to ack that worker is up and running var _LOCKTXT_LOC = 4; // Writer lock for the text buffer: 0=open, 1=closed var _NUMTXT_LOC = 5; // Count of messages in text buffer var _NEXT_LOC = 6; // First free location in the buffer var _SLEEP_LOC = 7; // Used for sleeping
var _FIRST = 10; // First location of first message
var _ia = new Int32Array(new SharedArrayBuffer(65536));
_ia[_NEXT_LOC] = _FIRST;
var _worker_prefix = // BEGIN WORKER PREFIX
`if (typeof $262 === 'undefined')
$262 = {};
$262.agent = (function (global) { var ReflectApply = global.Reflect.apply; var StringCharCodeAt = global.String.prototype.charCodeAt; var {
add: Atomics_add,
compareExchange: Atomics_compareExchange,
load: Atomics_load,
store: Atomics_store,
wait: Atomics_wait,
} = global.Atomics;
var {getSharedArrayBuffer} = global;
var _finished = { done: false };
var _ia = new Int32Array(getSharedArrayBuffer()); var agent = {
receiveBroadcast(receiver) { var k; while (((k = Atomics_load(_ia, ${_MSG_LOC})) & 1) === 0)
; var received_sab = getSharedArrayBuffer(); var received_id = Atomics_load(_ia, ${_ID_LOC});
Atomics_add(_ia, ${_ACK_LOC}, 1); while (Atomics_load(_ia, ${_MSG_LOC}) === k)
;
receiver(received_sab, received_id);
waitForDone(_finished);
},
report(msg) { while (Atomics_compareExchange(_ia, ${_LOCKTXT_LOC}, 0, 1) === 1)
;
msg = "" + msg; var i = _ia[${_NEXT_LOC}];
_ia[i++] = msg.length; for ( let j=0 ; j < msg.length ; j++ )
_ia[i++] = ReflectApply(StringCharCodeAt, msg, [j]);
_ia[${_NEXT_LOC}] = i;
Atomics_add(_ia, ${_NUMTXT_LOC}, 1);
Atomics_store(_ia, ${_LOCKTXT_LOC}, 0);
},
getReport() { if (_numReports === Atomics_load(_ia, _NUMTXT_LOC)) returnnull; var s = ""; var i = _reportPtr; var len = _ia[i++]; for ( let j=0 ; j < len ; j++ )
s += StringFromCharCode(_ia[i++]);
_reportPtr = i;
_numReports++; return s;
},
var $mozAsyncTestDone = false; function $DONE(failure) { // This function is generally called from within a Promise handler, so any // exception thrown by this method will be swallowed and most likely // ignored by the Promise machinery. if ($mozAsyncTestDone) {
reportFailure("$DONE() already called"); return;
}
$mozAsyncTestDone = true;
if (failure)
reportFailure(failure); else
reportCompare(0, 0);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.