Did a bit of refactoring on the test262 directory structure and propagated changes from

website\* out to test\*:
- Removed test\harness\ECMA-262-TOC.xml.  The casing on this file was incorrect, but
  more importantly it's a static file not generated by the harness
- Populated test\harness with the contents of website\resources\scripts\global\.  In
  the future, we need to update test\harness\* and propagate these changes out to
  website\*
- Test\suite\ietestcenter is now a verbatim copy of the IE Test Center tests that
  WERE under website\resources\scripts\testcases\*
- Moved all Sputnik tests from website\resources\scripts\testcases\* out to
  test\suite\sputnik_converted
- Moved website\resources\scripts\testcases\excludelist.xml out to test\config\*.  This
  particular file was only used for the test conversion process to XML, and is not actually
  needed by the website as best as I can tell
- Website\resources\scripts\testcases now only contains the XMLized test cases.  This is
  the right thing to do as the *.js files here weren't actually being used by the website
  and the general public can now peruse the test cases directly via Mercurial
This commit is contained in:
David Fugate 2010-11-15 21:23:35 -08:00
parent 1063159ce0
commit 35450e9e80
7626 changed files with 1155 additions and 107803 deletions

View File

@ -0,0 +1,20 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
var HoursPerDay = 24;
var MinutesPerHour = 60;
var SecondsPerMinute = 60;
var msPerDay = 86400000;
var msPerSecond = 1000;
var msPerMinute = 60000;
var msPerHour = 3600000;
var date_1899_end = -2208988800001;
var date_1900_start = -2208988800000;
var date_1969_end = -1;
var date_1970_start = 0;
var date_1999_end = 946684799999;
var date_2000_start = 946684800000;
var date_2099_end = 4102444799999;
var date_2100_start = 4102444800000;

View File

@ -0,0 +1,341 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
//15.9.1.2 Day Number and Time within Day
function Day(t) {
return Math.floor(t/msPerDay);
}
function TimeWithinDay(t) {
return t%msPerDay;
}
//15.9.1.3 Year Number
function DaysInYear(y){
if(y%4 != 0) return 365;
if(y%4 == 0 && y%100 != 0) return 366;
if(y%100 == 0 && y%400 != 0) return 365;
if(y%400 == 0) return 366;
}
function DayFromYear(y) {
return (365*(y-1970)
+ Math.floor((y-1969)/4)
- Math.floor((y-1901)/100)
+ Math.floor((y-1601)/400));
}
function TimeFromYear(y){
return msPerDay*DayFromYear(y);
}
function YearFromTime(t) {
t = Number(t);
var sign = ( t < 0 ) ? -1 : 1;
var year = ( sign < 0 ) ? 1969 : 1970;
for(var time = 0;;year += sign){
time = TimeFromYear(year);
if(sign > 0 && time > t){
year -= sign;
break;
}
else if(sign < 0 && time <= t){
break;
}
};
return year;
}
function InLeapYear(t){
if(DaysInYear(YearFromTime(t)) == 365)
return 0;
if(DaysInYear(YearFromTime(t)) == 366)
return 1;
}
function DayWithinYear(t) {
return Day(t)-DayFromYear(YearFromTime(t));
}
//15.9.1.4 Month Number
function MonthFromTime(t){
var day = DayWithinYear(t);
var leap = InLeapYear(t);
if((0 <= day) && (day < 31)) return 0;
if((31 <= day) && (day < (59+leap))) return 1;
if(((59+leap) <= day) && (day < (90+leap))) return 2;
if(((90+leap) <= day) && (day < (120+leap))) return 3;
if(((120+leap) <= day) && (day < (151+leap))) return 4;
if(((151+leap) <= day) && (day < (181+leap))) return 5;
if(((181+leap) <= day) && (day < (212+leap))) return 6;
if(((212+leap) <= day) && (day < (243+leap))) return 7;
if(((243+leap) <= day) && (day < (273+leap))) return 8;
if(((273+leap) <= day) && (day < (304+leap))) return 9;
if(((304+leap) <= day) && (day < (334+leap))) return 10;
if(((334+leap) <= day) && (day < (365+leap))) return 11;
}
//15.9.1.5 Date Number
function DateFromTime(t) {
var day = DayWithinYear(t);
var month = MonthFromTime(t);
var leap = InLeapYear(t);
if(month == 0) return day+1;
if(month == 1) return day-30;
if(month == 2) return day-58-leap;
if(month == 3) return day-89-leap;
if(month == 4) return day-119-leap;
if(month == 5) return day-150-leap;
if(month == 6) return day-180-leap;
if(month == 7) return day-211-leap;
if(month == 8) return day-242-leap;
if(month == 9) return day-272-leap;
if(month == 10) return day-303-leap;
if(month == 11) return day-333-leap;
}
//15.9.1.6 Week Day
function WeekDay(t) {
var weekday = (Day(t)+4)%7;
return (weekday < 0 ? 7+weekday : weekday);
}
//15.9.1.9 Daylight Saving Time Adjustment
var LocalTZA = $LocalTZ*msPerHour;
function DaysInMonth(m, leap) {
m = m%12;
//April, June, Sept, Nov
if(m == 3 || m == 5 || m == 8 || m == 10 ) {
return 30;
}
//Jan, March, May, July, Aug, Oct, Dec
if(m == 0 || m == 2 || m == 4 || m == 6 || m == 7 || m == 9 || m == 11){
return 31;
}
//Feb
return 28+leap;
}
function GetSundayInMonth(t, m, count){
var year = YearFromTime(t);
var leap = InLeapYear(t);
var day = 0;
if(m >= 1) day += DaysInMonth(0, leap);
if(m >= 2) day += DaysInMonth(1, leap);
if(m >= 3) day += DaysInMonth(2, leap);
if(m >= 4) day += DaysInMonth(3, leap);
if(m >= 5) day += DaysInMonth(4, leap);
if(m >= 6) day += DaysInMonth(5, leap);
if(m >= 7) day += DaysInMonth(6, leap);
if(m >= 8) day += DaysInMonth(7, leap);
if(m >= 9) day += DaysInMonth(8, leap);
if(m >= 10) day += DaysInMonth(9, leap);
if(m >= 11) day += DaysInMonth(10, leap);
var month_start = TimeFromYear(year)+day*msPerDay;
var sunday = 0;
if(count === "last"){
for(var last_sunday = month_start+DaysInMonth(m, leap)*msPerDay;
WeekDay(last_sunday)>0;
last_sunday -= msPerDay
){};
sunday = last_sunday;
}
else {
for(var first_sunday = month_start;
WeekDay(first_sunday)>0;
first_sunday += msPerDay
){};
sunday = first_sunday+7*msPerDay*(count-1);
}
return sunday;
}
function DaylightSavingTA(t) {
t = t-LocalTZA;
var DST_start = GetSundayInMonth(t, $DST_start_month, $DST_start_sunday)
+$DST_start_hour*msPerHour
+$DST_start_minutes*msPerMinute;
var k = new Date(DST_start);
var DST_end = GetSundayInMonth(t, $DST_end_month, $DST_end_sunday)
+$DST_end_hour*msPerHour
+$DST_end_minutes*msPerMinute;
if ( t >= DST_start && t < DST_end ) {
return msPerHour;
} else {
return 0;
}
}
//15.9.1.9 Local Time
function LocalTime(t){
return t+LocalTZA+DaylightSavingTA(t);
}
function UTC(t) {
return t-LocalTZA-DaylightSavingTA(t-LocalTZA);
}
//15.9.1.10 Hours, Minutes, Second, and Milliseconds
function HourFromTime(t){
return Math.floor(t/msPerHour)%HoursPerDay;
}
function MinFromTime(t){
return Math.floor(t/msPerMinute)%MinutesPerHour;
}
function SecFromTime(t){
return Math.floor(t/msPerSecond)%SecondsPerMinute;
}
function msFromTime(t){
return t%msPerSecond;
}
//15.9.1.11 MakeTime (hour, min, sec, ms)
function MakeTime(hour, min, sec, ms){
if ( !isFinite(hour) || !isFinite(min) || !isFinite(sec) || !isFinite(ms)) {
return Number.NaN;
}
hour = ToInteger(hour);
min = ToInteger(min);
sec = ToInteger(sec);
ms = ToInteger(ms);
return ((hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms);
}
//15.9.1.12 MakeDay (year, month, date)
function MakeDay(year, month, date) {
if ( !isFinite(year) || !isFinite(month) || !isFinite(date)) {
return Number.NaN;
}
year = ToInteger(year);
month = ToInteger(month);
date = ToInteger(date );
var result5 = year + Math.floor(month/12);
var result6 = month%12;
var sign = ( year < 1970 ) ? -1 : 1;
var t = ( year < 1970 ) ? 1 : 0;
var y = ( year < 1970 ) ? 1969 : 1970;
if( sign == -1 ){
for ( y = 1969; y >= year; y += sign ) {
t += sign * DaysInYear(y)*msPerDay;
}
} else {
for ( y = 1970 ; y < year; y += sign ) {
t += sign * DaysInYear(y)*msPerDay;
}
}
var leap = 0;
for ( var m = 0; m < month; m++ ) {
//if year is changed, than we need to recalculate leep
leap = InLeapYear(t);
t += DaysInMonth(m, leap)*msPerDay;
}
if ( YearFromTime(t) != result5 ) {
return Number.NaN;
}
if ( MonthFromTime(t) != result6 ) {
return Number.NaN;
}
if ( DateFromTime(t) != 1 ) {
return Number.NaN;
}
return Day(t)+date-1;
}
//15.9.1.13 MakeDate (day, time)
function MakeDate( day, time ) {
if(!isFinite(day) || !isFinite(time)) {
return Number.NaN;
}
return day*msPerDay+time;
}
//15.9.1.14 TimeClip (time)
function TimeClip(time) {
if(!isFinite(time) || Math.abs(time) > 8.64e15){
return Number.NaN;
}
return ToInteger(time);
}
//Test Functions
function ConstructDate(year, month, date, hours, minutes, seconds, ms){
/*
* 1. Call ToNumber(year)
* 2. Call ToNumber(month)
* 3. If date is supplied use ToNumber(date); else use 1
* 4. If hours is supplied use ToNumber(hours); else use 0
* 5. If minutes is supplied use ToNumber(minutes); else use 0
* 6. If seconds is supplied use ToNumber(seconds); else use 0
* 7. If ms is supplied use ToNumber(ms); else use 0
* 8. If Result(1) is not NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is
* 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1)
* 9. Compute MakeDay(Result(8), Result(2), Result(3))
* 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7))
* 11. Compute MakeDate(Result(9), Result(10))
* 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11)))
*/
var r1 = Number(year);
var r2 = Number(month);
var r3 = ((date && arguments.length > 2) ? Number(date) : 1);
var r4 = ((hours && arguments.length > 3) ? Number(hours) : 0);
var r5 = ((minutes && arguments.length > 4) ? Number(minutes) : 0);
var r6 = ((seconds && arguments.length > 5) ? Number(seconds) : 0);
var r7 = ((ms && arguments.length > 6) ? Number(ms) : 0);
var r8 = r1;
if(!isNaN(r1) && (0 <= ToInteger(r1)) && (ToInteger(r1) <= 99))
r8 = 1900+r1;
var r9 = MakeDay(r8, r2, r3);
var r10 = MakeTime(r4, r5, r6, r7);
var r11 = MakeDate(r9, r10);
return TimeClip(UTC(r11));
}
//the following values are normally generated by the sputnik.py driver
// for now, we'll just use 0 for everything
/*
var $LocalTZ=-8;
var $DST_start_month=2;
var $DST_start_sunday='first';
var $DST_start_hour=2;
var $DST_start_minutes=0;
var $DST_end_month=10;
var $DST_end_sunday='first';
var $DST_end_hour=2;
var $DST_end_minutes=0;
*/

View File

@ -1,297 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<esSpec name="ECMA-262" version="5">
<sec id="7" name="Lexical Conventions">
<sec id="7.1" name="Unicode Format-Control Characters"/>
<sec id="7.2" name="White Space"/>
<sec id="7.3" name="Line Terminators"/>
<sec id="7.4" name="Comments"/>
<sec id="7.5" name="Tokens"/>
<sec id="7.6" name="Identifier Names and Identifiers">
<sec id="7.6.1" name="Reserved Words"/>
</sec>
<sec id="7.7" name="Punctuators"/>
<sec id="7.8" name="Literals">
<sec id="7.8.1" name="Null Literals"/>>
<sec id="7.8.2" name="Boolean Literals"/>
<sec id="7.8.3" name="Numeric Literals"/>
<sec id="7.8.4" name="String Literals"/>
<sec id="7.8.5" name="Regular Expression Literals"/>
</sec>
<sec id="7.9" name="Automatic Semicolon Insertion">
<sec id="7.9.1" name="Rules of Automatic Semicolon Insertion"/>
<sec id="7.9.2" name="Examples of Automatic Semicolon Insertion"/>
</sec>
</sec>
<sec id="8" name="Types">
<sec id="8.1" name="The Undefined Type"/>
<sec id="8.2" name="The Null Type"/>
<sec id="8.3" name="The Boolean Type"/>
<sec id="8.4" name="The String Type"/>
<sec id="8.5" name="The Number Type"/>
<sec id="8.6" name="The Object Type">
<sec id="8.6.1" name="Property Attributes"/>
<sec id="8.6.2" name="Object Internal Properties and Methods"/>
</sec>
<sec id="8.7" name="The Reference Specification Type">
<sec id="8.7.1" name="GetValue (V)"/>
<sec id="8.7.2" name="PutValue (V, W)"/>
</sec>
<sec id="8.8" name="The List Specification Type"/>
<sec id="8.9" name="The Completion Specification Type"/>
<sec id="8.10" name="The Property Descriptor and Property Identifier Specification Types">
<sec id="8.10.1" name="IsAccessorDescriptor ( Desc )"/>
<sec id="8.10.2" name="IsDataDescriptor ( Desc )"/>
<sec id="8.10.3" name="IsGenericDescriptor ( Desc )"/>
<sec id="8.10.4" name="FromPropertyDescriptor ( Desc )"/>
<sec id="8.10.5" name="ToPropertyDescriptor ( Obj )"/>
</sec>
<sec id="8.11" name="The Lexical Environment and Environment Record Specification Types"/>
<sec id="8.12" name="Algorithms for Object Internal Methods">
<sec id="8.12.1" name="[[GetOwnProperty]] (P)"/>
<sec id="8.12.2" name="[[GetProperty]] (P)"/>
<sec id="8.12.3" name="[[Get]] (P)"/>
<sec id="8.12.4" name="[[CanPut]] (P)"/>
<sec id="8.12.5" name="[[Put]] ( P, V, Throw )"/>
<sec id="8.12.6" name="[[HasProperty]] (P)"/>
<sec id="8.12.7" name="[[Delete]] (P, Throw)"/>
<sec id="8.12.8" name="[[DefaultValue]] (hint)"/>
<sec id="8.12.9" name="[[DefineOwnProperty]] (P, Desc, Throw)"/>
</sec>
</sec>
<sec id="9" name="Type Conversion and Testing">
<sec id="9.1" name="ToPrimitive"/>
<sec id="9.2" name="ToBoolean"/>
<sec id="9.3" name="ToNumber">
<sec id="9.3.1" name="ToNumber Applied to the String Type"/>
</sec>
<sec id="9.4" name="ToInteger"/>
<sec id="9.5" name="ToInt32: (Signed 32 Bit Integer)"/>
<sec id="9.6" name="ToUint32: (Unsigned 32 Bit Integer)"/>
<sec id="9.7" name="ToUint16: (Unsigned 16 Bit Integer)"/>
<sec id="9.8" name="ToString">
<sec id="9.8.1" name="ToString Applied to the Number Type"/>
</sec>
<sec id="9.9" name="ToObject"/>
<sec id="9.10" name="CheckObjectCoercible"/>
<sec id="9.11" name="IsCallable"/>
<sec id="9.12" name="The SameValue Algorithm"/>
</sec>
<sec id="10" name="Executable Code and Execution Contexts">
<sec id="10.1" name="Types of Executable Code">
<sec id="10.1.1" name="Strict Mode Code"/>
</sec>
<sec id="10.2" name="Lexical Environments">
<sec id="10.2.1" name="Environment Records"/>
<sec id="10.2.2" name="Lexical Environment Operations"/>
<sec id="10.2.3" name="The Global Environment"/>
</sec>
<sec id="10.3" name="Execution Contexts">
<sec id="10.3.1" name="Identifier Resolution"/>
</sec>
<sec id="10.4" name="Establishing an Execution Context">
<sec id="10.4.1" name="Entering Global Code"/>
<sec id="10.4.2" name="Entering Eval Code"/>
<sec id="10.4.3" name="Entering Function Code"/>
</sec>
<sec id="10.5" name="Declaration Binding Instantiation"/>
<sec id="10.6" name="Arguments Object"/>
</sec>
<sec id="11" name="Expressions">
<sec id="11.1" name="Primary Expressions">
<sec id="11.1.1" name="The this Keyword"/>
<sec id="11.1.2" name="Identifier Reference"/>
<sec id="11.1.3" name="Literal Reference"/>
<sec id="11.1.4" name="Array Initialiser"/>
<sec id="11.1.5" name="Object Initialiser"/>
<sec id="11.1.6" name="The Grouping Operator"/>
</sec>
<sec id="11.2" name="Left-Hand-Side Expressions">
<sec id="11.2.1" name="Property Accessors"/>
<sec id="11.2.2" name="The new Operator"/>
<sec id="11.2.3" name="Function Calls"/>
<sec id="11.2.4" name="Argument Lists"/>
<sec id="11.2.5" name="Function Expressions"/>
</sec>
<sec id="11.3" name="Postfix Expressions">
<sec id="11.3.1" name="Postfix Increment Operator"/>
<sec id="11.3.2" name="Postfix Decrement Operator"/>
</sec>
<sec id="11.4" name="Unary Operators">
<sec id="11.4.1" name="The delete Operator"/>
<sec id="11.4.2" name="The void Operator"/>
<sec id="11.4.3" name="The typeof Operator"/>
<sec id="11.4.4" name="Prefix Increment Operator"/>
<sec id="11.4.5" name="Prefix Decrement Operator"/>
<sec id="11.4.6" name="Unary + Operator"/>
<sec id="11.4.7" name="Unary - Operator"/>
<sec id="11.4.8" name="Bitwise NOT Operator ( ~ )"/>
<sec id="11.4.9" name="Logical NOT Operator ( ! )"/>
</sec>
<sec id="11.5" name="Multiplicative Operators">
<sec id="11.5.1" name="Applying the * Operator"/>
<sec id="11.5.2" name="Applying the / Operator"/>
<sec id="11.5.3" name="Applying the % Operator"/>
</sec>
<sec id="11.6" name="Additive Operators">
<sec id="11.6.1" name="The Addition operator ( + )"/>
<sec id="11.6.2" name="The Subtraction Operator ( - )"/>
<sec id="11.6.3" name="Applying the Additive Operators to Numbers"/>
</sec>
<sec id="11.7" name="Bitwise Shift Operators">
<sec id="11.7.1" name="The Left Shift Operator"/>
<sec id="11.7.2" name="The Signed Right Shift Operator ( >> )"/>
<sec id="11.7.3" name="The Unsigned Right Shift Operator ( >>> )"/>
</sec>
<sec id="11.8" name="Relational Operators">
<sec id="11.8.1" name="The Less-than Operator"/>
<sec id="11.8.2" name="The Greater-than Operator"/>
<sec id="11.8.3" name="The Less-than-or-equal Operator"/>
<sec id="11.8.4" name="The Greater-than-or-equal Operator"/>
<sec id="11.8.5" name="The Abstract Relational Comparison Algorithm"/>
<sec id="11.8.6" name="The instanceof operator"/>
<sec id="11.8.7" name="The in operator"/>
</sec>
<sec id="11.9" name="Equality Operators">
<sec id="11.9.1" name="The Equals Operator ( == )"/>
<sec id="11.9.2" name="The Does-not-equals Operator ( != )"/>
<sec id="11.9.3" name="The Abstract Equality Comparison Algorithm"/>
<sec id="11.9.4" name="The Strict Equals Operator ( === )"/>
<sec id="11.9.5" name="The Strict Does-not-equal Operator ( !== )"/>
<sec id="11.9.6" name="The Strict Equality Comparison Algorithm"/>
</sec>
<sec id="11.10" name="Binary Bitwise Operators"/>
<sec id="11.11" name="Binary Logical Operators"/>
<sec id="11.12" name="Conditional Operator ( ? : )"/>
<sec id="11.13" name="Assignment Operators">
<sec id="11.13.1" name="Simple Assignment ( = )"/>
<sec id="11.13.2" name="Compound Assignment ( op= )"/>
</sec>
<sec id="11.14" name="Comma Operator ( , )"/>
</sec>
<sec id="12" name="Statements">
<sec id="12.1" name="Block"/>
<sec id="12.2" name="Variable Statement">
<sec id="12.2.1" name="Strict Mode Restrictions"/>
</sec>
<sec id="12.3" name="Empty Statement"/>
<sec id="12.4" name="Expression Statement"/>
<sec id="12.5" name="The if Statement"/>
<sec id="12.6" name="Iteration Statements">
<sec id="12.6.1" name="The do-while Statement"/>
<sec id="12.6.2" name="The while Statement"/>
<sec id="12.6.3" name="The for Statement"/>
<sec id="12.6.4" name="The for-in Statement"/>
</sec>
<sec id="12.7" name="The continue Statement"/>
<sec id="12.8" name="The break Statement"/>
<sec id="12.9" name="The return Statement"/>
<sec id="12.10" name="The with Statement">
<sec id="12.10.1" name="Strict Mode Restrictions"/>
</sec>
<sec id="12.11" name="The switch Statement"/>
<sec id="12.12" name="Labelled Statements"/>
<sec id="12.13" name="The throw Statement"/>
<sec id="12.14" name="The try Statement">
<sec id="12.14.1" name="Strict Mode Restrictions">
</sec>
<sec id="12.15" name="The debugger statement"/>
</sec>
</sec>
<sec id="13" name="Function Definition">
<sec id="13.1" name="Strict Mode Restrictions"/>
<sec id="13.2" name="Creating Function Objects">
<sec id="13.2.1" name="[[Call]]"/>
<sec id="13.2.2" name="[[Construct]]"/>
<sec id="13.2.3" name="The [[ThrowTypeError]] Function Object"/>
</sec>
</sec>
<sec id="14" name="Program">
<sec id="14.1" name="Directive Prologues and the Use Strict Directive"/>
</sec>
<sec id="15" name="Standard Built-in ECMAScript Objects">
<sec id="15.1" name="The Global Object">
<sec id="15.1.1" name="Value Properties of the Global Object"/>
<sec id="15.1.2" name="Function Properties of the Global Object"/>
<sec id="15.1.3" name="URI Handling Function Properties"/>
<sec id="15.1.4" name="Constructor Properties of the Global Object"/>
<sec id="15.1.5" name="Other Properties of the Global Object"/>
</sec>
<sec id="15.2" name="Object Objects">
<sec id="15.2.1" name="The Object Constructor Called as a Function"/>
<sec id="15.2.2" name="The Object Constructor"/>
<sec id="15.2.3" name="Properties of the Object Constructor"/>
<sec id="15.2.4" name="Properties of the Object Prototype Object"/>
<sec id="15.2.5" name="Properties of Object Instances"/>
</sec>
<sec id="15.3" name="Function Objects">
<sec id="15.3.1" name="The Function Constructor Called as a Function"/>
<sec id="15.3.2" name="The Function Constructor"/>
<sec id="15.3.3" name="Properties of the Function Constructor"/>
<sec id="15.3.4" name="Properties of the Function Prototype Object"/>
<sec id="15.3.5" name="Properties of Function Instances"/>
</sec>
<sec id="15.4" name="Array Objects">
<sec id="15.4.1" name="The Array Constructor Called as a Function"/>
<sec id="15.4.2" name="The Array Constructor"/>
<sec id="15.4.3" name="Properties of the Array Constructor"/>
<sec id="15.4.4" name="Properties of the Array Prototype Object"/>
<sec id="15.4.5" name="Properties of Array Instances"/>
</sec>
<sec id="15.5" name="String Objects">
<sec id="15.5.1" name="The String Constructor Called as a Function"/>
<sec id="15.5.2" name="The String Constructor"/>
<sec id="15.5.3" name="Properties of the String Constructor"/>
<sec id="15.5.4" name="Properties of the String Prototype Object"/>
<sec id="15.5.5" name="Properties of String Instances"/>
</sec>
<sec id="15.6" name="Boolean Objects">
<sec id="15.6.1" name="The Boolean Constructor Called as a Function"/>
<sec id="15.6.2" name="The Boolean Constructor"/>
<sec id="15.6.3" name="Properties of the Boolean Constructor"/>
<sec id="15.6.4" name="Properties of the Boolean Prototype Object"/>
<sec id="15.6.5" name="Properties of Boolean Instances"/>
</sec>
<sec id="15.7" name="Number Objects">
<sec id="15.7.1" name="The Number Constructor Called as a Function"/>
<sec id="15.7.2" name="The Number Constructor"/>
<sec id="15.7.3" name="Properties of the Number Constructor"/>
<sec id="15.7.4" name="Properties of the Number Prototype Object"/>
<sec id="15.7.5" name="Properties of Number Instances"/>
</sec>
<sec id="15.8" name="The Math Object">
<sec id="15.8.1" name="Value Properties of the Math Object"/>
<sec id="15.8.2" name="Function Properties of the Math Object"/>
</sec>
<sec id="15.9" name="Date Objects">
<sec id="15.9.1" name="Overview of Date Objects and Definitions of Abstract Operators"/>
<sec id="15.9.2" name="The Date Constructor Called as a Function"/>
<sec id="15.9.3" name="The Date Constructor"/>
<sec id="15.9.4" name="Properties of the Date Constructor"/>
<sec id="15.9.5" name="Properties of the Date Prototype Object"/>
<sec id="15.9.6" name="Properties of Date Instances"/>
</sec>
<sec id="15.10" name="RegExp (Regular Expression) Objects">
<sec id="15.10.1" name="Patterns"/>
<sec id="15.10.2" name="Pattern Semantics"/>
<sec id="15.10.3" name="The RegExp Constructor Called as a Function"/>
<sec id="15.10.4" name="The RegExp Constructor"/>
<sec id="15.10.5" name="Properties of the RegExp Constructor"/>
<sec id="15.10.6" name="Properties of the RegExp Prototype Object"/>
<sec id="15.10.7" name="Properties of RegExp Instances"/>
</sec>
<sec id="15.11" name="Error Objects">
<sec id="15.11.1" name="The Error Constructor Called as a Function"/>
<sec id="15.11.2" name="The Error Constructor"/>
<sec id="15.11.3" name="Properties of the Error Constructor"/>
<sec id="15.11.4" name="Properties of the Error Prototype Object"/>
<sec id="15.11.5" name="Properties of Error Instances"/>
<sec id="15.11.6" name="Native Error Types Used in This Standard"/>
<sec id="15.11.7" name="NativeError Object Structure"/>
</sec>
<sec id="15.12" name="The JSON Object">
<sec id="15.12.1" name="The JSON Grammar"/>
<sec id="15.12.2" name="parse ( text [ , reviver ] )"/>
<sec id="15.12.3" name="stringify ( value [ , replacer [ , space ] ] )"/>
</sec>
</sec>
</esSpec>

View File

View File

@ -1,226 +1,158 @@
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$(function () {
pageHelper.init();
$('.content-home').show();
// Adding attribute to the tabs (e.g. Home, Run etc.) and attaching the click event on buttons (e.g. Reset, Start etc.)
$('.nav-link').each(function (index) {
//Adding "targetDiv" attribute to the header tab and on that basis the div related to header tabs are displayed
if (index === 0) {
$(this).attr('targetDiv', '.content-home');
} else if (index === 1) {
$(this).attr('targetDiv', '.content-tests');
} else if (index === 2) {
$(this).attr('targetDiv', '.content-results');
$(this).attr('testRunning', 'false');
} else if (index === 3) {
$(this).attr('targetDiv', '.content-dev');
}
else {
$(this).attr('targetDiv', '.content-browsers');
}
/* Handles updating the page with information from the runner. */
function Presenter() {
var altStyle = '',
logger,
progressBar,
date,
version,
table,
backLink,
//Attaching the click event to the header tab that shows the respective div of header
$(this).click(function () {
var target = $(this).attr('targetDiv');
//If clicked tab is Result, it generates the results.
if ($(target).hasClass('content-results')) {
if ($(this).attr('testRunning') === 'true') { return; }
pageHelper.generateReportTable();
}
$('#contentContainer > div:visible').hide();
$('.navBar .selected').toggleClass('selected');
$(this).addClass('selected');
$(target).show();
//If clicked tab is Browsers Report, it shows the reports
if (target === '.content-browsers') {
$("body").addClass("busy");
setTimeout(function () {
buildTable();
}, 500);
}
});
});
globalSection = new Section(null, "0", "ECMA-262"),
currentSection = globalSection,
tests = {},
totalTests = 0;
//Attach the click event to the start button. It starts, stops and pauses the tests
$('.button-start').click(function () {
$('#testsToRun').text(ES5Harness.getTotalTestsToRun());
$('#totalCounter').text(0);
$('#Pass').text(0);
$('#Fail').text(0);
$('#totalFailedCounter').text(0);
$('#failedToLoadCounter1').text(0);
$('#failedToLoadCounter').text(0);
//It stores the state of the test case in the data of button, whether running, paused or stopped. That is used later to get the present state
var testStatus = $(this).data('testStatus');
TOCFILEPATH = "resources/scripts/global/ecma-262-toc.xml";
switch (testStatus) {
case undefined:
case "stopped":
ES5Harness.stop("stopped");
pageHelper.logger.find('tr').remove();
if (!ES5Harness.setChapter(pageHelper.update)) {
return false;
}
$(this).data('testStatus', "running");
ES5Harness.startTesting(pageHelper.update, "reset");
$(this).attr('src', 'resources/images/pause.png');
pageHelper.configureReportLink(true);
break;
case "running":
$(this).data('testStatus', "paused");
ES5Harness.stop("paused");
$(this).attr('src', 'resources/images/resume.png');
pageHelper.configureReportLink(false);
break;
case "paused":
$(this).data('testStatus', "running");
$(this).attr('src', 'resources/images/pause.png');
ES5Harness.startTesting(pageHelper.update, "resume");
pageHelper.configureReportLink(true);
break;
}
});
/* Load the table of contents xml to populate the sections. */
function loadSections() {
var sectionsLoader = new XMLHttpRequest();
sectionsLoader.open("GET", TOCFILEPATH, false);
sectionsLoader.send();
var xmlDoc = sectionsLoader.responseXML;
var nodes = xmlDoc.documentElement.childNodes;
//Attach the click event to the reset button. It reset all the test to zero
$('.button-reset').click(
/*function () {
pageHelper.configureReportLink(false);
$('.button-start').data('testStatus', "stopped").attr('src', 'resources/images/start.png');
pageHelper.logger.find('tr').remove();
ES5Harness.stop("reset");
ES5Harness.resetSections();
$('#failedToLoadCounter1').text(0);
$('#failedToLoadCounter').text(0);
$('#totalFailedCounter').text(0);
pageHelper.failedToLoad = 0;
resetResults();
$('#nextActivity').text("");
} */
function () {
location.replace(location.protocol + '//' + location.host + '/default.html?run');
addSectionsFromXML(nodes, globalSection);
}
);
//Attaching the click event to the "Download results as XML" link
$('#ancGenXMLReport').click(function (e) {
pageHelper.generateReportXml();
return false;
});
//load xml testcase path list when page loads
ES5Harness && ES5Harness.loadTestList();
pageHelper.selectTab();
});
/* Recursively parses the TOC xml, producing nested sections. */
function addSectionsFromXML(nodes, parentSection){
var subsection;
var pageHelper = {
//constants
XML_TARGETTESTSUITENAME: 'ECMAScript Test262 Site',
XML_TARGETTESTSUITEVERSION: '',
XML_TARGETTESTSUITEDATE: '',
RED_LIMIT: 50,
YELLOW_LIMIT: 75,
GREEN_LIMIT: 99.9,
logger: undefined,
loggerParent: undefined,
progressBar: undefined,
failedToLoad: 0,
init: function () {
this.logger = $('#tableLogger');
this.loggerParent = this.logger.parent();
this.progressBar = $('#progressbar');
this.failedToLoad = 0;
},
//It sets the tab on the basis of url e.g. if URL is <domain name>\default.html?result, Result tab will be selected
selectTab: function () {
var queryStr = location.search.toLowerCase();
if (queryStr.indexOf("run") > 0) {
$("#run").click();
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].nodeName === "sec") {
subsection = new Section(parentSection, nodes[i].getAttribute('id'), nodes[i].getAttribute('name'));
parentSection.subsections[subsection.id.match(/\d+$/)] = subsection;
addSectionsFromXML(nodes[i].childNodes, subsection);
}
}
else if (queryStr.indexOf("result") > 0) {
$("#results").click();
}
else if (queryStr.indexOf("development") > 0) {
$("#development").click();
}
else if (queryStr.indexOf("browser") > 0) {
$("#browsers").click();
}
},
}
setVersionAndDate: function () {
//Set the version and date
$(".targetTestSuiteVersion").text(pageHelper.XML_TARGETTESTSUITEVERSION);
$(".targetTestSuiteDate").text(pageHelper.XML_TARGETTESTSUITEDATE);
},
//It sets title to the Results tab when tests are running
configureReportLink: function (executing) {
var reportLink = $('.test-report-link');
if (executing) {
reportLink.attr('testRunning', 'true');
reportLink.parent().attr('title', 'Please wait till the test run is completed or stop the test run before viewing the report.');
/* Renders the current section into the report window. */
function renderCurrentSection() {
renderBreadcrumbs();
if(globalSection.totalTests === 0) {
$('#resultMessage').show();
} else {
reportLink.parent().attr('title', '');
reportLink.attr('testRunning', 'false');
}
},
//This is used as callback function for passing in sth.js
update: function (detailsObj) {
$('#testsToRun').text(detailsObj.totalTestsToRun);
if (!isNaN(detailsObj.totalTestsRun)) {
$('#totalCounter').text(detailsObj.totalTestsRun);
$('#resultMessage').hide();
}
$('#Pass').text(detailsObj.totalTestsPassed);
$('#Fail').text(detailsObj.totalTestsFailed);
$('#failedToLoadCounter1').text(pageHelper.failedToLoad);
$('#failedToLoadCounter').text(pageHelper.failedToLoad);
$('#nextActivity').text(detailsObj.nextActivity);
if (detailsObj.completed) {
var btnStart = $('#btnStart').attr('src', 'resources/images/start.png');
btnStart.data('testStatus', "stopped");
$('#totalFailedCounter').text(pageHelper.failedToLoad);
pageHelper.configureReportLink(false);
$('#nextActivity').text("");
$('.totalCases').text(currentSection.totalTests);
$('.passedCases').text(currentSection.totalPassed);
$('.failedCases').text(currentSection.totalFailed);
$('#failedToLoadCounterDetails').text(currentSection.totalFailedToLoad);
table.empty();
table.append(currentSection.toHTML());
// Observe section selection and show source links
$('a.section', table).click(sectionSelected);
$('a.showSource', table).click(openSourceWindow);
}
/* Renders the breadcrumbs for report navigation. */
function renderBreadcrumbs() {
var container = $('div.crumbContainer div.crumbs');
var sectionChain = [];
var current = currentSection;
// Walk backwards until we reach the global section.
while(current !== globalSection && current.parentSection !== globalSection) {
sectionChain.push(current);
current = current.parentSection;
}
var altStyle = (pageHelper.logger.children().length % 2) === 0 ? ' ' : 'alternate';
var appendStr = '';
var length = 0;
if (detailsObj.failedTestCases && detailsObj.failedTestCases.length > 0) {
length = detailsObj.failedTestCases.length;
var testObj;
while (length--) {
altStyle = (altStyle !== ' ') ? ' ' : 'alternate';
testObj = detailsObj.failedTestCases.shift();
appendStr += '<tbody><tr class=\"' + altStyle + '\"><td width=\"20%\">' + testObj.id + '</td><td>' + testObj.description + '</td><td align="right"><span class=\"Fail\">Fail</span></td></tr></tbody>';
}
pageHelper.logger.append(appendStr);
// Reverse the array since we want to print earlier sections first.
sectionChain.reverse();
// Empty any existing breadcrumbs.
container.empty();
// Static first link to go back to the root.
var link = $("<a href='#0' class='setBlack'>Test Report &gt; </a>");
link.bind('click', {sectionId: 0}, sectionSelected)
container.append(link);
for(var i = 0; i < sectionChain.length;i++) {
link = $("<a href='#" + sectionChain[i].id + "' class='setBlack'>Section " + sectionChain[i].id + ": " + sectionChain[i].name + " &gt; </a>");
link.bind('click', sectionSelected)
container.append(link);
}
var testCasesPaths = this.ES5Harness.getFailToLoad();
appendStr = '';
if (testCasesPaths.length > 0) {
length = testCasesPaths.length;
while (length--) {
testObj = testCasesPaths.shift();
altStyle = (altStyle !== ' ') ? ' ' : 'alternate';
appendStr += '<tbody><tr class=\"' + altStyle + '\"><td width=\"20%\">' + testObj + '</td><td>' + '' + '</td><td align="right"><span class=\"Fail\">Not Loaded</span></td></tr></tbody>';
pageHelper.failedToLoad++;
}
pageHelper.logger.append(appendStr);
// If we can go back, show the back link.
if(sectionChain.length > 0) {
backLink.show();
} else {
backLink.hide();
}
pageHelper.loggerParent.attr("scrollTop", pageHelper.loggerParent.attr("scrollHeight"));
pageHelper.progressBar.reportprogress(detailsObj.totalTestsRun, detailsObj.totalTestCasesForProgressBar);
},
}
//This is used to generate the xml for the results
generateReportXml: function () {
/* Opens a window with a test's source code. */
function openSourceWindow(e) {
var test = tests[e.target.href.match(/#(.+)$/)[1]],
popWnd = window.open("", "", "scrollbars=1, resizable=1"),
innerHTML = '';
innerHTML += '<b>Test </b>';
innerHTML += '<b>' + test.id + '</b> <br /><br />';
if (test.description) {
innerHTML += '<b>Description</b>';
innerHTML += '<pre>' + test.description.replace(/</g, '&lt;').replace(/>/g, '&gt;'); +' </pre>';
}
innerHTML += '<br /><br /><br /><b>Testcase</b>';
innerHTML += '<pre>' + test.code + '</pre>';
if (test.pre) {
innerHTML += '<b>Precondition</b>';
innerHTML += '<pre>' + test.pre + '</pre>';
}
innerHTML += '<b>Path</b>';
innerHTML += '<pre>' + test.path + ' </pre>&nbsp';
popWnd.document.write(innerHTML);
}
/* Pops up a window with an xml dump of the results of a test. */
function createXMLReportWindow() {
var reportWindow; //window that will output the xml data
var xmlData; //array instead of string concatenation
var dateNow;
@ -233,414 +165,157 @@ var pageHelper = {
'<browserName>REPLACE WITH BROWSERNAME BEFORE PUSHING TO HG</browserName>\r\n' +
'<Date>' + dateNow.toDateString() + '</Date>\r\n' +
'<Submitter> ADD SUBMITTER</Submitter>\r\n' +
'<targetTestSuiteName>' + this.XML_TARGETTESTSUITENAME + '</targetTestSuiteName>\r\n' +
'<targetTestSuiteVersion>' + this.XML_TARGETTESTSUITEVERSION + '</targetTestSuiteVersion>\r\n' +
'<targetTestSuiteDate>' + this.XML_TARGETTESTSUITEDATE + '</targetTestSuiteDate>\r\n' +
'<targetTestSuiteName>ECMAScript Test262 Site</targetTestSuiteName>\r\n' +
'<targetTestSuiteVersion>' + version + '</targetTestSuiteVersion>\r\n' +
'<targetTestSuiteDate>' + date + '</targetTestSuiteDate>\r\n' +
' <Tests>\r\n\r\n';
reportWindow = window.open();
reportWindow.document.writeln("<title>ECMAScript Test262 XML</title>");
if (ES5Harness.getTotalTestsRun() !== parseInt(ES5Harness.getTotalTestsToRun())) {
reportWindow.document.writeln("<div><b>Test Results file cannot be generated because execution is not completed</b></div>");
}
else {
reportWindow.document.writeln("<div><br/></div>");
reportWindow.document.write("<textarea id='results' style='width: 100%; height: 800px;'>");
reportWindow.document.write(xml);
xml = "";
function parseSection(section) {
xml += "<section id='" + section.id + "' name='" + section.name + "'>\r\n";
for (var i = 0; i < section.testCaseArray.length; i++) {
xml += '<test>\r\n' +
' <testId>' + section.testCaseArray[i].id + '</testId>\r\n' +
' <res>' + section.testCaseArray[i].res + '</res>\r\n' +
'</test>\r\n';
}
if (section.subSections !== undefined) {
for (var i = 0; i < section.subSections.length; i++) {
parseSection(section.subSections[i]);
xml += '</section>\r\n';
}
}
}
for (var index = 0; index < sections.length; index++) {
parseSection(sections[index]);
xml += '</section>\r\n';
}
reportWindow.document.write(xml);
reportWindow.document.write('</Tests>\r\n</testRun>\r\n</textarea>\r\n');
reportWindow.document.close();
}
},
htmlEscape: function (str) {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
},
numTests: function (section) {
nTest = 0;
for (var subSectionIndex = 0; subSectionIndex < section.subSections.length; subSectionIndex++) {
if (section.subSections[subSectionIndex].total !== 0) {
nTest++;
}
}
return nTest;
},
//It generates the report that is displayed in results tab
generateReportTable: function () {
var bResultsdisplayed = false;
$('#backlinkDiv').hide();
//define local scope to sections array
var sections = window.sections;
var dataTable = $('.results-data-table');
$('.results-data-table').find("tr").remove();
//set the total, pass and fail count
$('.totalCases').text(ES5Harness.getTotalTestsRun());
$('.passedCases').text(ES5Harness.getTotalTestsPassed());
$('.failedCases').text(ES5Harness.getTotalTestsFailed());
$('#failedToLoadCounterDetails').text(pageHelper.failedToLoad);
try {
$('.crumbs #link1').remove();
$('.crumbs #link2').remove();
$('.crumbs #link3').remove();
}
catch (e) {
$('.crumbs #link1').text("");
$('.crumbs #link2').text("");
$('.crumbs #link3').text("");
}
//set the navigation bar
var anc1 = $('<a id="link1">Test Report ></a>');
anc1.attr('href', 'javascript:pageHelper.generateReportTable();');
$('.crumbs').append(anc1);
$('.crumbs #link1').removeClass().addClass("setBlack");
var totalSubSectionPassed = 0;
for (var sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
if (pageHelper.numTests(sections[sectionIndex]) !== 0) {
bResultsdisplayed = true;
dataTable.append('<tbody><tr><td class="tblHeader" colspan="2">' + 'Chapter ' + sections[sectionIndex].id + '- ' + sections[sectionIndex].name + '</td></tr></tbody>');
var mainSectionPercentageStyle = "reportRed";
// if there are any cases directly inside the chapter instead of in subsections
if (sections[sectionIndex].testCaseArray.length > 0) {
for (var index = 0; index < sections[sectionIndex].subSections.length; index++) {
totalSubSectionPassed = totalSubSectionPassed + sections[sectionIndex].subSections[index].passed;
}
var calculatedLimit = (sections[sectionIndex].passed - totalSubSectionPassed) / sections[sectionIndex].testCaseArray.length * 100;
if (calculatedLimit >= pageHelper.GREEN_LIMIT) {
mainSectionPercentageStyle = "reportGreen";
}
else if (Math.round(calculatedLimit) >= pageHelper.YELLOW_LIMIT) {
mainSectionPercentageStyle = "reportLightGreen";
}
else if (Math.round(calculatedLimit) >= pageHelper.RED_LIMIT) {
mainSectionPercentageStyle = "reportYellow";
}
else {
mainSectionPercentageStyle = "reportRed";
}
dataTable.append('<tbody><tr><td><a href="javascript:pageHelper.generateDetailedReportTable(' + sectionIndex + ',-1);">' + "In Chapter " + sections[sectionIndex].id + '</a></td><td class="' + mainSectionPercentageStyle + '">' + (Math.round(calculatedLimit)) + '%' + '</td></tr></tbody>');
}
}
for (var subSectionIndex = 0; subSectionIndex < sections[sectionIndex].subSections.length; subSectionIndex++) {
var styleClass;
if (sections[sectionIndex].subSections[subSectionIndex].total !== 0) {
var passedPercentage = 0;
//If there are subsections in subsection along with direct test cases, calculation is done like below
if (sections[sectionIndex].subSections[subSectionIndex].subSections) {
var totalPassedSubSections = sections[sectionIndex].subSections[subSectionIndex].passed;
var totalSubSections = sections[sectionIndex].subSections[subSectionIndex].total;
for (var subSubSectionIndex = 0; subSubSectionIndex < sections[sectionIndex].subSections[subSectionIndex].subSections.length; subSubSectionIndex++) {
totalPassedSubSections = totalPassedSubSections + sections[sectionIndex].subSections[subSectionIndex].subSections[subSubSectionIndex].passed;
totalSubSections = totalSubSections + sections[sectionIndex].subSections[subSectionIndex].subSections[subSubSectionIndex].total;
}
passedPercentage = totalPassedSubSections / totalSubSections * 100;
}
else {
passedPercentage = sections[sectionIndex].subSections[subSectionIndex].getPassPercentage();
}
if (passedPercentage >= pageHelper.GREEN_LIMIT) {
styleClass = "reportGreen";
}
else if (passedPercentage >= pageHelper.YELLOW_LIMIT) {
styleClass = "reportLightGreen";
}
else if (passedPercentage >= pageHelper.RED_LIMIT) {
styleClass = "reportYellow";
}
else {
styleClass = "reportRed";
}
dataTable.append('<tbody><tr><td class="sectionName"><a href="javascript:pageHelper.generateSubSectionReportTable(' + sectionIndex + ',' + subSectionIndex + ');">' + sections[sectionIndex].subSections[subSectionIndex].name + '</a></td><td class="' + styleClass + '">' + (Math.round(passedPercentage)) + '%' + '</td></tr></tbody>');
bResultsdisplayed = true;
}
}
totalSubSectionPassed = 0;
}
// append the legend if results have been displayed
if (bResultsdisplayed) {
$('#legend').show();
}
//Disappear the note if there are records in the result
if ($.trim(dataTable.text()) !== "")
$("#resultMessage").hide();
else
$("#resultMessage").show();
},
//It shows the sub section of the results
generateSubSectionReportTable: function (sectionIndex, subSectionIndex) {
var sections = window.sections;
var dataTable = $('.results-data-table');
$('.results-data-table').find("tr").remove();
var styleClass;
var totalSubSectionPassed = 0;
var totalSubSectionFailed = 0;
// if there is no subsections under a section(say 7.1) then directly display the detailed test report
if (!sections[sectionIndex].subSections[subSectionIndex].subSections) {
pageHelper.generateDetailedReportTable(sectionIndex, subSectionIndex);
}
else {
try {
$('.crumbs #link2').remove();
}
catch (e) {
$('.crumbs #link2').text("");
}
var anc2 = $("<a id='link2'>" + " Chapter " + sections[sectionIndex].id.toString() + ": " + sections[sectionIndex].name + ": " + sections[sectionIndex].subSections[subSectionIndex].name + " > " + "</a>");
anc2.attr('href', 'javascript:pageHelper.generateSubSectionReportTable(' + sectionIndex + ',' + subSectionIndex + ');');
$('.crumbs').append(anc2);
$('.crumbs #link2').removeClass().addClass("setBlack");
$('.crumbs #link1').removeClass().addClass("setBlue");
var anc = $('.crumbs').find('a');
anc.click(function () {
$(this).next('a').remove();
});
try {
$('.crumbs #link3').remove();
}
catch (e) {
$('.crumbs #link3').text("");
}
for (var index = 0; index < sections[sectionIndex].subSections[subSectionIndex].subSections.length; index++) {
totalSubSectionPassed = totalSubSectionPassed + sections[sectionIndex].subSections[subSectionIndex].subSections[index].passed;
totalSubSectionFailed = totalSubSectionFailed + sections[sectionIndex].subSections[subSectionIndex].subSections[index].failed;
}
var totalCasesInSection = sections[sectionIndex].subSections[subSectionIndex].total - totalSubSectionPassed - totalSubSectionFailed;
var totalPassedCasesInSection = sections[sectionIndex].subSections[subSectionIndex].passed - totalSubSectionPassed;
var totalFailedCasesInSection = sections[sectionIndex].subSections[subSectionIndex].failed - totalSubSectionFailed;
$('.totalCases').text(sections[sectionIndex].subSections[subSectionIndex].total);
$('.passedCases').text(sections[sectionIndex].subSections[subSectionIndex].passed);
$('.failedCases').text(sections[sectionIndex].subSections[subSectionIndex].failed);
if (sections[sectionIndex].subSections[subSectionIndex].testCaseArray.length > 0) {
// var calculatedLimit = Math.round((sections[sectionIndex].subSections[subSectionIndex].passed) / sections[sectionIndex].subSections[subSectionIndex].testCaseArray.length * 100);
var calculatedLimit = Math.round((totalPassedCasesInSection / totalCasesInSection) * 100);
if (calculatedLimit >= 75) {
styleClass = "reportGreen";
}
else if (calculatedLimit >= 50) {
styleClass = "reportYellow";
}
else {
styleClass = "reportRed";
}
dataTable.append('<tbody><tr><td class="tblSectionHeader"><a href="javascript:pageHelper.generateDetailedReportTable(' + sectionIndex + ',' + subSectionIndex + ');">' + "Section: " + sections[sectionIndex].subSections[subSectionIndex].id + " cases" + '</a></td><td class="' + styleClass + '">' + calculatedLimit + '%' + '</td></tr></tbody>');
}
if (sections[sectionIndex].subSections[subSectionIndex].subSections) {
for (var objIndex = 0; objIndex < sections[sectionIndex].subSections[subSectionIndex].subSections.length; objIndex++) {
if (sections[sectionIndex].subSections[subSectionIndex].subSections[objIndex].total !== 0) {
var passedPercentage = sections[sectionIndex].subSections[subSectionIndex].subSections[objIndex].getPassPercentage();
if (passedPercentage >= pageHelper.YELLOW_LIMIT) {
styleClass = "reportGreen";
}
else if (passedPercentage >= pageHelper.RED_LIMIT) {
styleClass = "reportYellow";
}
else {
styleClass = "reportRed";
}
dataTable.append('<tbody><tr><td class="tblSectionHeader"><a href="javascript:pageHelper.generateDetailedReportTable(' + sectionIndex + ',' + subSectionIndex + ',' + objIndex + ');">' + sections[sectionIndex].subSections[subSectionIndex].subSections[objIndex].name + '</a></td><td class="' + styleClass + '">' + (Math.round(passedPercentage)) + '%' + '</td></tr></tbody>');
}
}
}
}
pageHelper.doBackButtonTasks();
},
generateDetailedReportTable: function (sectionIndex, subSectionIndex, subInnerSectionIndex) {
var sections = window.sections;
var dataTable = $('.results-data-table');
$('.results-data-table').find("tr").remove();
var mainSectionPassed = 0;
var mainSectionfailed = 0;
var subSectionPassed = 0;
var subSectionfailed = 0;
var resultStyle = "pass";
var subSectionObj;
// sub sections
if (subSectionIndex !== -1) {
// if there is only one level of subsections example: 7.1
if (!sections[sectionIndex].subSections[subSectionIndex].subSections) {
subSectionObj = sections[sectionIndex].subSections[subSectionIndex];
$('.totalCases').text(subSectionObj.total);
$('.passedCases').text(subSectionObj.passed);
$('.failedCases').text(subSectionObj.failed);
}
// cases directly under sub-subsections example: 7.1.1
else if (sections[sectionIndex].subSections[subSectionIndex].subSections.length > 0 && subInnerSectionIndex !== undefined) {
subSectionObj = sections[sectionIndex].subSections[subSectionIndex].subSections[subInnerSectionIndex];
$('.sectionId').text("section: " + subSectionObj.id);
$('.totalCases').text(subSectionObj.total);
$('.passedCases').text(subSectionObj.passed);
$('.failedCases').text(subSectionObj.failed);
}
// cases directly under subsections example: 7.1
else if (sections[sectionIndex].subSections[subSectionIndex].testCaseArray.length > 0) {
subSectionObj = sections[sectionIndex].subSections[subSectionIndex];
$('.totalCases').text(subSectionObj.total);
$('.passedCases').text(subSectionObj.passed);
$('.failedCases').text(subSectionObj.failed);
}
var anc3 = $('<a id="link3">' + " Section: " + subSectionObj.id + " " + subSectionObj.name + '</a>');
$('.crumbs').append(anc3);
$('.crumbs #link3').removeClass().addClass("setBlack");
$('.crumbs #link2').removeClass().addClass("setBlue");
$('.crumbs #link1').removeClass().addClass("setBlue");
for (var objIndex = 0; objIndex < subSectionObj.testCaseArray.length; objIndex++) {
if (subSectionObj.testCaseArray[objIndex].res.toLowerCase() === 'pass') {
resultStyle = "pass";
}
else {
resultStyle = "fail";
}
var path = subSectionObj.testCaseArray[objIndex].path.indexOf('resources/') === -1 ? 'resources/scripts/' + subSectionObj.testCaseArray[objIndex].path : subSectionObj.testCaseArray[objIndex].path;
dataTable.append('<tbody><tr><td>' + subSectionObj.testCaseArray[objIndex].id + '</td><td>' + subSectionObj.testCaseArray[objIndex].description + '</td><td class="' + resultStyle + '">' + subSectionObj.testCaseArray[objIndex].res + '</td><td><a href="javascript:ES5Harness.openSourceWindow(' + subSectionObj.testCaseArray[objIndex].registrationIndex + ');">[source]</a></td></tr></tbody>');
}
}
// testcases directly under a chapter when there are no sections in a chapter
else {
anc3 = $('<a id="link3">' + " Chapter: " + sections[sectionIndex].id + ": " + sections[sectionIndex].name + '</a>');
$('.crumbs').append(anc3);
$('.crumbs #link3').removeClass().addClass("setBlack");
$('.crumbs #link2').removeClass().addClass("setBlue");
$('.crumbs #link1').removeClass().addClass("setBlue");
$('.sectionId').text("section: " + sections[sectionIndex].id);
for (var subSectionIndex = 0; subSectionIndex < sections[sectionIndex].subSections.length; subSectionIndex++) {
mainSectionPassed = mainSectionPassed + sections[sectionIndex].subSections[subSectionIndex].passed;
mainSectionfailed = mainSectionfailed + sections[sectionIndex].subSections[subSectionIndex].failed;
}
$('.totalCases').text(sections[sectionIndex].total - mainSectionPassed - mainSectionfailed);
$('.passedCases').text(sections[sectionIndex].passed - mainSectionPassed);
$('.failedCases').text(sections[sectionIndex].failed - mainSectionfailed);
$('.detailedResult').text("Total tests: " + sections[sectionIndex].testCaseArray.length + " Passed: " + (sections[sectionIndex].passed - mainSectionPassed) + " Failed: " + (sections[sectionIndex].failed - mainSectionfailed));
for (var arrayIndex = 0; arrayIndex < sections[sectionIndex].testCaseArray.length; arrayIndex++) {
if (sections[sectionIndex].testCaseArray[arrayIndex].res.toLowerCase() === 'pass') {
resultStyle = "pass";
}
else {
resultStyle = "fail";
}
path = sections[sectionIndex].testCaseArray[arrayIndex].path.indexOf('resources/') === -1 ? 'resources/scripts/' + sections[sectionIndex].testCaseArray[arrayIndex].path : sections[sectionIndex].testCaseArray[arrayIndex].path;
dataTable.append('<tbody><tr><td>' + sections[sectionIndex].testCaseArray[arrayIndex].id + '</td><td>' + sections[sectionIndex].testCaseArray[arrayIndex].description + '</td><td class="' + resultStyle + '">' + sections[sectionIndex].testCaseArray[arrayIndex].res + '</td><td><a href="javascript:ES5Harness.openSourceWindow(' + sections[sectionIndex].testCaseArray[arrayIndex].registrationIndex + ');">[source]</a></td></tr></tbody>');
}
}
pageHelper.doBackButtonTasks();
},
//It shows the back link
doBackButtonTasks: function () {
$('#backlinkDiv').show();
//The below logic is applied because .remove() is giving object error in the function "generateReportTable" that I could not find the reason.
//That is why I am keeping the links (#link1, #link2 and #link3) blank if any error .
var anchors = [];
$('.crumbs a').each(function (index, anchor) {
if ($(anchor).text() !== "") {
anchors[anchors.length] = anchor;
}
});
var contextAnchor = anchors[anchors.length - 2];
$('#backlinkDiv').attr('href', contextAnchor.href);
reportWindow.document.writeln("<div>Instructions: Update the BROWSERNAME value and submit to Hg. Send email to the <a href='mailto:body@ecmascript.org' >list</a> for assistance.</div>");
reportWindow.document.write("<textarea id='results' style='width: 100%; height: 800px;'>");
reportWindow.document.write(xml);
reportWindow.document.write(globalSection.toXML());
reportWindow.document.write('</Tests>\r\n</testRun>\r\n</textarea>\r\n');
reportWindow.document.close();
}
};
//Extend the array type
getArrayCloneOfObject = function (oldObject)
{
var tempClone = {};
if (typeof (oldObject) === "object")
{
for (prop in oldObject)
{
if ((typeof (oldObject[prop]) === "object") && (oldObject[prop]).__isArray)
{
tempClone[prop] = getArrayCloneOfObject(oldObject[prop]);
}
else if (typeof (oldObject[prop]) === "object")
{
tempClone[prop] = getArrayCloneOfObject(oldObject[prop]);
}
else
{
tempClone[prop] = oldObject[prop];
/* Callback for when the user clicks on a section in the report table. */
function sectionSelected(e) {
e.preventDefault();
currentSection = getSectionById(e.target.href.match(/#(.+)$/)[1]);
renderCurrentSection();
table.attr("scrollTop", 0);
}
/* Go back to the previous section */
function goBack(e) {
e.preventDefault();
if(currentSection === globalSection)
return;
currentSection = currentSection.parentSection;
// Since users click directly on sub-chapters of the main chapters, don't go back to main
// chapters.
if(currentSection.parentSection === globalSection)
currentSection = globalSection;
renderCurrentSection();
}
/* Returns the section object for the specified section id (eg. "7.1" or "15.4.4.12"). */
function getSectionById(id) {
if(id == 0)
return globalSection;
var match = id.match(/\d+/g);
var section = globalSection;
for(var i = 0; i < match.length; i++) {
if(typeof section.subsections[match[i]] !== "undefined") {
section = section.subsections[match[i]];
} else {
break;
}
}
return section;
}
/* Update the page with current status */
function updateCounts() {
$('#Pass').text(globalSection.totalPassed);
$('#Fail').text(globalSection.totalFailed);
$('#totalCounter').text(globalSection.totalTests);
$('#failedToLoadCounter1').text(globalSection.totalFailedToLoad);
$('#failedToLoadCounter').text(globalSection.totalFailedToLoad);
progressBar.reportprogress(globalSection.totalTests, totalTests);
}
/* Append a result to the run page's result log. */
function logResult(test) {
altStyle = (altStyle !== ' ') ? ' ' : 'alternate';
var appendStr = '<tbody><tr class=\"' + altStyle + '\"><td width=\"20%\">' + test.id + '</td><td>' + test.description + '</td><td align="right"><span class=\"Fail\">' + test.result + '</span></td></tr></tbody>';
logger.append(appendStr);
logger.parent().attr("scrollTop", logger.parent().attr("scrollHeight"));
}
// Load the sections.
loadSections();
this.setTotalTests = function(tests) {
totalTests = tests;
$('#testsToRun').text(tests);
}
this.setVersion = function(v) {
version = v;
$(".targetTestSuiteVersion").text(v);
}
this.setDate = function(d) {
date = d;
$(".targetTestSuiteDate").text(d);
}
/* Updates progress with the given test, which should have its results in it as well. */
this.addTestResult = function(test) {
tests[test.id] = test;
getSectionById(test.id).addTest(test);
updateCounts();
if(test.result === 'fail')
logResult(test);
}
this.started = function () {
$('.button-start').attr('src', 'resources/images/pause.png');
}
this.paused = function () {
$('.button-start').attr('src', 'resources/images/resume.png');
}
this.reset = function() {
globalSection.reset();
updateCounts();
logger.empty();
currentSection = globalSection;
renderCurrentSection();
}
this.finished = function() {
$('.button-start').attr('src', 'resources/images/start.png');
activityBar.text('');
}
/* Refresh display of the report */
this.refresh = function() {
renderCurrentSection();
}
/* Write status to the activity bar. */
this.updateStatus = function(str) {
activityBar.text(str);
}
/* Do some setup tasks. */
this.setup = function() {
backLink = $('#backlinkDiv');
backLink.click(goBack);
table = $('.results-data-table');
logger = $("#tableLogger");
progressBar = $('#progressbar');
activityBar = $('#nextActivity');
$('#ancGenXMLReport').click(createXMLReportWindow);
}
return tempClone;
}
CloneArray = function (arrayObj)
{
var tempClone = [];
for (var arrIndex = 0; arrIndex <= arrayObj.length; arrIndex++)
{
if (typeof (arrayObj[arrIndex]) === "object")
{
tempClone.push(getArrayCloneOfObject(arrayObj[arrIndex]));
} else
{
tempClone.push(arrayObj[arrIndex]);
}
}
return tempClone;
}
var presenter = new Presenter();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
var prec;
function isEqual(num1, num2)
{
if ((num1 === Infinity)&&(num2 === Infinity))
{
return(true);
}
if ((num1 === -Infinity)&&(num2 === -Infinity))
{
return(true);
}
prec = getPrecision(Math.min(Math.abs(num1), Math.abs(num2)));
return(Math.abs(num1 - num2) <= prec);
//return(num1 === num2);
}

View File

@ -0,0 +1,13 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function getPrecision(num)
{
//TODO: Create a table of prec's,
// because using Math for testing Math isn't that correct.
log2num = Math.log(Math.abs(num))/Math.LN2;
pernum = Math.ceil(log2num);
return(2 * Math.pow(2, -52 + pernum));
//return(0);
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function ToInteger(p) {
x = Number(p);
if(isNaN(x)){
return +0;
}
if((x === +0)
|| (x === -0)
|| (x === Number.POSITIVE_INFINITY)
|| (x === Number.NEGATIVE_INFINITY)){
return x;
}
var sign = ( x < 0 ) ? -1 : 1;
return (sign*Math.floor(Math.abs(x)));
}

View File

@ -12,6 +12,15 @@ var xslTestList = loadXMLDoc(TEST_REPORT_INDIV_TESTS_TABLE_XSL);
// Populate fileList array by reading all xml files in "/enginereports/testresults" directory on server
function loadTestResultList() {
if (fileList.length === 0) {
var tempList = ["chrome.xml", "firefox.xml", "ie.xml", "safari.xml"];
for (var i = 0; i < tempList.length; i++) {
fileList.push(TEST_RESULT_PATH + tempList[i]);
}
}
/*TODO - fix this once we have nginx.conf setup properly for TEST_RESULT_PATH listings
on the deployment server
if (fileList.length === 0) {
var httpRequest = new XMLHttpRequest();
httpRequest.open("GET", TEST_RESULT_PATH, false);
@ -29,6 +38,7 @@ function loadTestResultList() {
}
}
}
*/
}
function createTestReportFile(fileList) {

View File

@ -1,131 +1,163 @@
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var SECTION_TOC_OFFSET = 7;
//represents the class template for sections
function Section(id, name, subSections) {
/* A section of the spec. Stores test results and subsections and some rolled up stats on how many tests passed or
* failed under that section
*/
function Section(parentSection, id, name) {
this.parentSection = parentSection;
this.id = id;
this.name = name;
this.passed = 0;
this.failed = 0;
this.total = 0;
this.subSections = subSections;
this.testCaseArray = [];
this.getPassPercentage = function () {
if (this.total > 0) {
return (this.passed / this.total) * 100;
this.subsections = {};
this.tests = [];
this.totalTests = 0;
this.totalPassed = 0;
this.totalFailed = 0;
this.totalFailedToLoad = 0;
var section = this,
RED_LIMIT = 50,
YELLOW_LIMIT = 75,
GREEN_LIMIT = 99.9;
/* Get the class for a result cell given the pass percent. */
function rollupCellClass(passPercent) {
if(passPercent >= GREEN_LIMIT) {
return "reportGreen";
} else if (passPercent >= YELLOW_LIMIT) {
return "reportLightGreen";
} else if (passPercent >= RED_LIMIT) {
return "reportYellow";
}
else {
return "reportRed";
}
/* Calculate pass percent */
this.passPercent = function() {
if(this.totalTests === 0) {
return 0;
}
};
}
function resetResults() {
return Math.round((this.totalPassed / this.totalTests) * 100);
}
for (var secInd = 0; secInd < sections.length; secInd++) {
for (var subSecInd = 0; subSecInd < sections[secInd].subSections.length; subSecInd++) {
sections[secInd].subSections[subSecInd].total = 0;
sections[secInd].subSections[subSecInd].passed = 0;
sections[secInd].subSections[subSecInd].failed = 0;
/* Add a test result to this section. Pushes the result to the test array and passes the result to addTestResult to
* tabulate pass/fail numbers*/
this.addTest = function(test) {
this.tests.push(test);
this.addTestResult(test);
}
/* Increments the various rollup counters for this section and all parent sections */
this.addTestResult = function(test) {
this.totalTests++;
if(test.result === "pass")
this.totalPassed++;
else
this.totalFailed++;
if(test.error === 'Failed to Load')
this.totalFailedToLoad++;
if(this.parentSection !== null)
this.parentSection.addTestResult(test);
}
/* Renders this section as HTML. Used for the report page.*/
this.toHTML = function(options) {
var defaultOptions = {header: false, renderSubsections: true};
if (typeof options === undefined) {
options = defaultOptions;
} else {
options = $.extend(defaultOptions, options);
}
}
}
//array to hold the sections data
var sections = [];
// Add a node from TOC xml as a section into sections array
function addSection(node, nodeSections) {
// Populate subsections
var tocSubSections = [];
var nodes = node.childNodes;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].nodeName === "sec") {
addSection(nodes[i], tocSubSections);
var html = '<tbody id="section_' + this.id.replace(/\./g, "_") + '">';
if(options.header) {
html += "<tr><td class='tblHeader' colspan='3'>Chapter " + this.id + " - " + this.name + "</td>" +
"<td class='" + rollupCellClass(this.passPercent()) + "'>" + this.passPercent() + "%</td></tr>";
}
for(var i = 0; i < this.tests.length;i++) {
test = this.tests[i];
html += "<tr><td>" + test.id + "</td>" +
"<td>" + test.description + "</td>" +
"<td><a class='showSource' href='#" + test.id + "'>[source]</a></td>" +
"<td class='" + test.result + "'>" + test.result + "</td></tr>"
}
for(var sectionId in this.subsections) {
var section = this.subsections[sectionId];
if(section.totalTests > 0) {
if(options.renderSubsections) {
html += section.toHTML({header: true, renderSubsections: false})
} else {
html += "<tr><td colspan='3'><a class='section' href='#" + section.id + "'>Chapter " + section.id + " - " + section.name + "</a></td>" +
"<td class='" + rollupCellClass(section.passPercent()) + "'>" + section.passPercent() + "%</td></tr>";
}
}
}
return html + "</tbody>";
}
// Add into section
if (tocSubSections.length > 0) {
nodeSections[nodeSections.length] = new Section(node.getAttribute('id').toString(), node.getAttribute('name'), tocSubSections);
} else {
nodeSections[nodeSections.length] = new Section(node.getAttribute('id').toString(), node.getAttribute('name'));
/* Render this section as XML. Used for the report page. */
this.toXML = function() {
var xml = "";
if(this.id != 0) {
xml += "<section id='" + this.id + "' name='" + this.name + "'>\r\n";
for (var i = 0; i < this.tests.length; i++) {
xml += '<test>\r\n' +
' <testId>' + this.tests[i].id + '</testId>\r\n' +
' <res>' + this.tests[i].result + '</res>\r\n' +
'</test>\r\n';
}
}
for (var subsection in this.subsections) {
xml += this.subsections[subsection].toXML();
}
if(this.id != 0) {
xml += '</section>\r\n';
}
return xml;
}
}
// Load all sections from TOC xml
function loadSections() {
// Constant for TOC file path
var TOCFILEPATH = "resources/scripts/global/ecma-262-toc.xml";
/* Reset counts and remove tests. */
this.reset = function() {
this.tests = [];
this.totalTests = 0;
this.totalPassed = 0;
this.totalFailed = 0;
this.totalFailedToLoad = 0;
// Load TOC from xml
var sectionsLoader = new XMLHttpRequest();
sectionsLoader.open("GET", TOCFILEPATH, false);
sectionsLoader.send();
var xmlDoc = sectionsLoader.responseXML;
var nodes = xmlDoc.documentElement.childNodes;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].nodeName === "sec") {
addSection(nodes[i], sections);
for(var subsection in this.subsections) {
this.subsections[subsection].reset();
}
}
}
function existsSection(section) {
var retValue = false;
holdArray = section.split(".");
//subtract SECTION_TOC_OFFSET, since sections start from SECTION_TOC_OFFSET and section array from 0
chapterId = holdArray[0] - SECTION_TOC_OFFSET;
if (holdArray.length > 0) {
retValue = sections[chapterId] !== undefined ? true : false;
}
if (retValue && (holdArray.length > 1)) {
retValue = ((sections[chapterId].subSections !== undefined) && (sections[chapterId].subSections[holdArray[1] - 1] !== undefined)) ? true : false;
}
if (retValue && (holdArray.length > 2)) {
retValue = ((sections[chapterId].subSections !== undefined) && (sections[chapterId].subSections[holdArray[1] - 1].subSections !== undefined) && (sections[chapterId].subSections[holdArray[1] - 1].subSections[holdArray[2] - 1] !== undefined)) ? true : false;
}
return retValue;
}
function addCountToSection(section, type) {
holdArray = section.split(".");
//subtract SECTION_TOC_OFFSET, since sections start from SECTION_TOC_OFFSET and section array from 0
chapterId = holdArray[0] - SECTION_TOC_OFFSET;
switch (type) {
case 'total':
sections[chapterId].total++;
if (holdArray.length === 2 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].total++;
}
if (holdArray.length === 3 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].total++;
sections[chapterId].subSections[holdArray[1] - 1].subSections[holdArray[2] - 1].total++;
}
break;
case 'passed':
sections[chapterId].passed++;
if (holdArray.length === 2 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].passed++;
}
if (holdArray.length === 3 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].passed++;
sections[chapterId].subSections[holdArray[1] - 1].subSections[holdArray[2] - 1].passed++;
}
break;
case 'failed':
sections[chapterId].failed++;
if (holdArray.length === 2 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].failed++;
}
if (holdArray.length === 3 & existsSection(section)) {
sections[chapterId].subSections[holdArray[1] - 1].failed++;
sections[chapterId].subSections[holdArray[1] - 1].subSections[holdArray[2] - 1].failed++;
}
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -34,8 +34,6 @@ test: function testcase() {
return true;
} ();
}
//Test262 Change
} // added, missing
});

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