aboutsummaryrefslogtreecommitdiffstats
path: root/console/harness
diff options
context:
space:
mode:
authorDavid Fugate <dfugate@microsoft.com>2012-02-29 14:23:47 -0800
committerDavid Fugate <dfugate@microsoft.com>2012-02-29 14:23:47 -0800
commit0612ad7bb307ed5e1203616197af7a702ec60518 (patch)
tree42b9e45e71b30a9efe2e601f1b3827a6440168bd /console/harness
parentc3b41309c7810ec2e9edbffc4438c2c31d07bfae (diff)
Added a LICENSE file to the root of the enlistment.
All Microsoft-contributed *.js and *.py sources now have Ecma's copyright header.
Diffstat (limited to 'console/harness')
-rw-r--r--console/harness/cth.js24
-rw-r--r--console/harness/ed.js30
-rw-r--r--console/harness/gs.js24
-rw-r--r--console/harness/helper.js64
-rw-r--r--console/harness/sections.js24
-rw-r--r--console/harness/sta.js89
-rw-r--r--console/harness/sth.js113
7 files changed, 166 insertions, 202 deletions
diff --git a/console/harness/cth.js b/console/harness/cth.js
index de7eb49ca..c741b0f8a 100644
--- a/console/harness/cth.js
+++ b/console/harness/cth.js
@@ -1,22 +1,8 @@
-/// Copyright (c) 2011 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
function testRun(id, path, description, codeString, result, error) {
if (result!=="pass") {
diff --git a/console/harness/ed.js b/console/harness/ed.js
index e2a27c6a3..89d0dfc1c 100644
--- a/console/harness/ed.js
+++ b/console/harness/ed.js
@@ -1,28 +1,14 @@
-/// Copyright (c) 2011 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
//Error Detector
if (this.window!==undefined) { //for console support
- window.onerror = function(errorMsg, url, lineNumber) {
- window.iframeError = errorMsg;
- }
+ this.window.onerror = function(errorMsg, url, lineNumber) {
+ this.window.iframeError = errorMsg;
+ };
}
//This doesn't work with early errors in current versions of Opera
diff --git a/console/harness/gs.js b/console/harness/gs.js
index bd9a66cd5..210c08548 100644
--- a/console/harness/gs.js
+++ b/console/harness/gs.js
@@ -1,22 +1,8 @@
-/// Copyright (c) 2011 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
//Global Scope Test Case Validator
diff --git a/console/harness/helper.js b/console/harness/helper.js
index ba150c432..d44f3c329 100644
--- a/console/harness/helper.js
+++ b/console/harness/helper.js
@@ -1,22 +1,8 @@
-/// 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
/* Handles updating the page with information from the runner. */
function Presenter() {
@@ -148,21 +134,23 @@ function Presenter() {
innerHTML = '';
innerHTML += '<b>Test </b>';
- innerHTML += '<b>' + test.id + '</b> <br /><br />';
+ innerHTML += '<b>' + test.id + '</b> <br /><br />\n';
if (test.description) {
innerHTML += '<b>Description</b>';
innerHTML += '<pre>' +
test.description.replace(/</g, '&lt;').replace(/>/g, '&gt;') +
- ' </pre>';
+ ' </pre>\n';
}
innerHTML += '<br /><br /><br /><b>Testcase</b>';
- innerHTML += '<pre>' + test.code + '</pre>';
-
- innerHTML += '<b>Path</b>';
- innerHTML += '<pre>' + test.path + ' </pre>&nbsp';
+ innerHTML += '<pre>' + test.code + '</pre>\n';
+ innerHTML += '<br /><b>Path</b>';
+ innerHTML += '<pre>' + test.path + '</pre>';
+ innerHTML += '<br /><a href="javascript:void(window.open(\'http://hg.ecmascript.org/tests/test262/file/tip/test/suite'
+ innerHTML += test.path.replace("TestCases", "") + '\'));">' + 'Hg source' + '</a> (might be newer than the testcase source shown above)\n'
+
popWnd.document.write(innerHTML);
}
@@ -172,14 +160,33 @@ function Presenter() {
popWnd = window.open("", "", "scrollbars=1, resizable=1"),
innerHTML = '';
+ var bugDetails = "";
+ bugDetails += "DESCRIPTION\n*Please insert your description here!*\n\n";
+ bugDetails += "------------------\n";
+ bugDetails += "TEST: " + test.path + "\n";
+ bugDetails += "SOURCE: http://hg.ecmascript.org/tests/test262/file/tip/test/suite" + test.path.replace("TestCases", "") + "\n";
+ bugDetails += "TEST SUITE DATE: " + date + "\n";
+ bugDetails += "PLATFORM: " + navigator.userAgent + "\n";
+ bugDetails += "ERROR: " + test.error + "\n\n";
+
+
+ var bugTemplate = 'https://bugs.ecmascript.org/enter_bug.cgi?product=Test262&amp;bug_severity=normal&amp;component=Tests&amp;short_desc=';
+ bugTemplate += encodeURIComponent('Invalid test? ' + test.id) + "&amp;comment=";
+ bugTemplate += encodeURIComponent(bugDetails);
+
innerHTML += '<b>Test </b>';
- innerHTML += '<b>' + test.id + '</b> <br /><br />';
+ innerHTML += '<b>' + test.id + '</b> <br /><br />\n';
innerHTML += '<b>Failure</b>';
- innerHTML += '<pre>' + test.error + '</pre>';
+ innerHTML += '<pre>' + test.error + '</pre>\n';
innerHTML += '<br /><br /><b>Testcase</b>';
- innerHTML += '<pre>' + test.code + '</pre>';
+ innerHTML += '<pre>' + test.code + '</pre>\n';
+
+ innerHTML += '<br /><br /><b>Broken test?</b>';
+ innerHTML += '<p>If you have reason to believe the JavaScript engine being tested<br />\n';
+ innerHTML += 'is actually OK and there\'s instead something wrong with the test<br />\n';
+ innerHTML += 'itself, please <a href="' + bugTemplate + '" onclick="window.moveTo(0,0);window.resizeTo(screen.width, screen.height);">file a bug.</a></p>\n'
popWnd.document.write(innerHTML);
}
@@ -218,7 +225,6 @@ function Presenter() {
function logResult(test) {
var appendStr = "";
altStyle = (altStyle !== ' ') ? ' ' : 'alternate';
-
if (test.result==="fail") {
appendStr += '<tbody>';
appendStr += '<tr class=\"' + altStyle + '\">';
diff --git a/console/harness/sections.js b/console/harness/sections.js
index 075c612a4..2d9348fae 100644
--- a/console/harness/sections.js
+++ b/console/harness/sections.js
@@ -1,22 +1,8 @@
-/// 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
/* 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
diff --git a/console/harness/sta.js b/console/harness/sta.js
index c25198cb5..dbbf77075 100644
--- a/console/harness/sta.js
+++ b/console/harness/sta.js
@@ -1,22 +1,8 @@
-/// 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
//-----------------------------------------------------------------------------
function compareArray(aExpected, aActual) {
@@ -335,8 +321,8 @@ 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);
+ var log2num = Math.log(Math.abs(num)) / Math.LN2;
+ var pernum = Math.ceil(log2num);
return (2 * Math.pow(2, -52 + pernum));
//return(0);
}
@@ -364,7 +350,7 @@ function isEqual(num1, num2) {
// This code is governed by the BSD license found in the LICENSE file.
function ToInteger(p) {
- x = Number(p);
+ var x = Number(p);
if (isNaN(x)) {
return +0;
@@ -437,7 +423,7 @@ var $LocalTZ,
current = new Date(current.getTime() + 1);
}
return current;
- }
+ };
var juneDate = new Date(2000, 5, 20, 0, 0, 0, 0);
var decemberDate = new Date(2000, 11, 20, 0, 0, 0, 0);
@@ -446,7 +432,7 @@ var $LocalTZ,
var isSouthernHemisphere = (juneOffset > decemberOffset);
var winterTime = isSouthernHemisphere ? juneDate : decemberDate;
var summerTime = isSouthernHemisphere ? decemberDate : juneDate;
-
+
var dstStart = findNearestDateBefore(winterTime, function (date) {
return date.getTimezoneOffset() == summerTime.getTimezoneOffset();
});
@@ -454,7 +440,7 @@ var $LocalTZ,
$DST_start_sunday = dstStart.getDate() > 15 ? '"last"' : '"first"';
$DST_start_hour = dstStart.getHours();
$DST_start_minutes = dstStart.getMinutes();
-
+
var dstEnd = findNearestDateBefore(summerTime, function (date) {
return date.getTimezoneOffset() == winterTime.getTimezoneOffset();
});
@@ -462,7 +448,7 @@ var $LocalTZ,
$DST_end_sunday = dstEnd.getDate() > 15 ? '"last"' : '"first"';
$DST_end_hour = dstEnd.getHours();
$DST_end_minutes = dstEnd.getMinutes();
-
+
return;
})();
@@ -503,10 +489,10 @@ 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;
@@ -517,11 +503,11 @@ function YearFromTime(t) {
};
return year;
}
-
+
function InLeapYear(t){
if(DaysInYear(YearFromTime(t)) == 365)
return 0;
-
+
if(DaysInYear(YearFromTime(t)) == 366)
return 1;
}
@@ -584,7 +570,7 @@ 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;
@@ -601,13 +587,14 @@ function DaysInMonth(m, leap) {
function GetSundayInMonth(t, m, count){
var year = YearFromTime(t);
-
+ var tempDate;
+
if (count==='"first"') {
for (var d=1; d <= DaysInMonth(m, InLeapYear(t)); d++) {
tempDate = new Date(year, m, d);
if (tempDate.getDay()===0) {
return tempDate.valueOf();
- }
+ }
}
} else if(count==='"last"') {
for (var d=DaysInMonth(m, InLeapYear(t)); d>0; d--) {
@@ -624,7 +611,7 @@ 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);
@@ -636,25 +623,25 @@ function GetSundayInMonth(t, m, count){
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;
+ 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;
+ for(var first_sunday = month_start;
WeekDay(first_sunday)>0;
first_sunday += msPerDay
){};
sunday = first_sunday+7*msPerDay*(count-1);
}
-
+
return sunday;
}*/
@@ -662,11 +649,11 @@ function DaylightSavingTA(t) {
// t = t-LocalTZA;
var DST_start = GetSundayInMonth(t, $DST_start_month, $DST_start_sunday) +
- $DST_start_hour*msPerHour +
+ $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;
@@ -770,7 +757,7 @@ function MakeDate( day, time ) {
if(!isFinite(day) || !isFinite(time)) {
return Number.NaN;
}
-
+
return day*msPerDay+time;
}
@@ -803,20 +790,20 @@ function ConstructDate(year, month, date, hours, minutes, seconds, ms){
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 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));
}
@@ -905,6 +892,6 @@ return attribs
//--Test case registration-----------------------------------------------------
function runTestCase(testcase) {
if (testcase() !== true) {
- $ERROR("Test case returned non-true value!")
+ $ERROR("Test case returned non-true value!");
}
}
diff --git a/console/harness/sth.js b/console/harness/sth.js
index 8d2658d86..029a2cff0 100644
--- a/console/harness/sth.js
+++ b/console/harness/sth.js
@@ -1,22 +1,8 @@
-/// 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.
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
// Do not cache any JSON files - see
// https://bugs.ecmascript.org/show_bug.cgi?id=87
@@ -43,21 +29,21 @@ function BrowserRunner() {
globalScopeContents,
harnessDir = "harness/";
- $.ajax({async: false,
- dataType: "text",
- success: function(data){errorDetectorFileContents = data;},
+ $.ajax({async: false,
+ dataType: "text",
+ success: function(data){errorDetectorFileContents = data;},
url:harnessDir+"ed.js"});
-
- $.ajax({async: false,
- dataType: "text",
- success: function(data){simpleTestAPIContents = data;},
+
+ $.ajax({async: false,
+ dataType: "text",
+ success: function(data){simpleTestAPIContents = data;},
url:harnessDir+"sta.js"});
-
- $.ajax({async: false,
- dataType: "text",
- success: function(data){globalScopeContents = data;},
+
+ $.ajax({async: false,
+ dataType: "text",
+ success: function(data){globalScopeContents = data;},
url:harnessDir+"gs.js"});
-
+
/* Called by the child window to notify that the test has
* finished. This function call is put in a separate script block
* at the end of the page so errors in the test script block
@@ -99,6 +85,45 @@ function BrowserRunner() {
/* Run the test. */
this.run = function (test, code) {
+
+ //--Detect proper window.onerror support
+ if (instance.supportsWindowOnerror===undefined) {
+ var iframePrereqs = document.createElement("iframe");
+ iframePrereqs.setAttribute("id", "prereqsIframe");
+ if (!/firefox/i.test(navigator.userAgent)) {
+ iframePrereqs.setAttribute("style", "display:none");
+ }
+ document.body.appendChild(iframePrereqs);
+
+ var iwinPrereqs = iframePrereqs.contentWindow;
+ var idocPrereqs = iwinPrereqs.document;
+ idocPrereqs.open();
+
+ iwinPrereqs.failCount = 0;
+
+ var stuff = [
+ "window.onerror = function(a, b, c) { this.failCount++; }",
+ "va xyz =",
+ "throw Error();"
+ ];
+
+ for(var i in stuff) {
+ idocPrereqs.writeln("<script type='text/javascript'>");
+ idocPrereqs.writeln(stuff[i]);
+ idocPrereqs.writeln("</script>");
+ }
+ idocPrereqs.close();
+
+ //TODO - 500ms *should* be a sufficient delay
+ setTimeout(function() {
+ instance.supportsWindowOnerror = iwinPrereqs.failCount === 2;
+ //alert(iwinPrereqs.failCount);
+ document.body.removeChild(iframePrereqs);
+ instance.run(test, code);
+ }, 500);
+ return;
+ }
+
currentTest = {};
for (var tempIndex in test) {
if (test.hasOwnProperty(tempIndex)) {
@@ -106,6 +131,8 @@ function BrowserRunner() {
}
}
currentTest.code = code;
+
+
iframe = document.createElement("iframe");
iframe.setAttribute("id", "runnerIframe");
@@ -167,7 +194,7 @@ function BrowserRunner() {
//Run the code
idoc.writeln("<script type='text/javascript'>");
- if (/opera/i.test(navigator.userAgent)) { //Opera doesn't support window.onerror
+ if (! instance.supportsWindowOnerror) {
idoc.writeln("try {eval(\"" + this.convertForEval(code) + "\");} catch(e) {window.onerror(e.toString(), null, null);}");
} else {
idoc.writeln(code);
@@ -180,8 +207,8 @@ function BrowserRunner() {
idoc.writeln(globalScopeContents);
idoc.writeln("</script>");
idoc.close();
- }
-
+ };
+
//--Helper functions-------------------------------------------------------
this.convertForEval = function(txt) {
txt = txt.replace(/\\/g,"\\\\");
@@ -190,7 +217,7 @@ function BrowserRunner() {
txt = txt.replace(/\r/g,"\\r");
txt = txt.replace(/\n/g,"\\n");
return txt;
- }
+ };
}
/* Loads tests from the sections specified in testcases.json.
@@ -264,7 +291,7 @@ function TestLoader() {
function getIdFromPath (path) {
//path is of the form "a/b/c.js"
-
+
var id = path.split("/");
//id is now of the form ["a", "b", "c.js"];
@@ -307,9 +334,9 @@ function TestLoader() {
currentTestIndex = 0;
testGroupIndex = 0;
};
-
-
-
+
+
+
}
/* Controls test generation and running, and sends results to the presenter. */
@@ -326,8 +353,8 @@ function Controller() {
this.implementerHook = {
//Adds a test result
addTestResult: function (test) { },
-
- //Called whenever all tests have finished running. Provided with the
+
+ //Called whenever all tests have finished running. Provided with the
//elapsed time in milliseconds.
finished: function(elapsed) { }
};
@@ -337,7 +364,7 @@ function Controller() {
try {
controller.implementerHook.addTestResult(test);
} catch(e) { /*no-op*/}
-
+
if(state === 'running')
setTimeout(loader.getNextTest, 10);
};
@@ -366,7 +393,7 @@ function Controller() {
try {
controller.implementerHook.finished(elapsed);
} catch(e) { /*no-op*/}
- }
+ };
this.start = function() {
state = 'running';