aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Fugate <dfugate@microsoft.com>2011-04-07 10:12:45 -0700
committerDavid Fugate <dfugate@microsoft.com>2011-04-07 10:12:45 -0700
commit08a7f7433a2db1e0329752d16561a745c2805b20 (patch)
tree5766aeb5f1e6daac69f30558d9d26db73de6876e
parent09186bafb48bf7a639052a1f6d6bafdeadf4459e (diff)
Few minor changes to sta.js and sth.js to support Strict Mode.
Renamed move_test.py to FixTestCasePlacement.py. Still a work in progress.
-rw-r--r--test/harness/sta.js14
-rw-r--r--test/harness/sth.js3
-rw-r--r--tools/misc/FixTestCasePlacement.py (renamed from tools/misc/move_test.py)0
3 files changed, 15 insertions, 2 deletions
diff --git a/test/harness/sta.js b/test/harness/sta.js
index fd3873438..19547c223 100644
--- a/test/harness/sta.js
+++ b/test/harness/sta.js
@@ -141,11 +141,23 @@ SimpleTestAPIs.push(fnSupportsStrict);
//-----------------------------------------------------------------------------
function fnGlobalObject() {
- return (function() { return this }).call(null);
+ return Function("return this")();
}
SimpleTestAPIs.push(fnGlobalObject);
//-----------------------------------------------------------------------------
+function fnSupportsStrict() {
+ "use strict";
+ try {
+ eval('with ({}) {}');
+ return false;
+ } catch (e) {
+ return true;
+ }
+}
+SimpleTestAPIs.push(fnSupportsStrict);
+
+//-----------------------------------------------------------------------------
//Verify all attributes specified data property of given object: value, writable, enumerable, configurable
//If all attribute values are expected, return true, otherwise, return false
function dataPropertyAttributesAreCorrect(obj, name, value, writable, enumerable, configurable) {
diff --git a/test/harness/sth.js b/test/harness/sth.js
index 5d533f974..fc83cfbf3 100644
--- a/test/harness/sth.js
+++ b/test/harness/sth.js
@@ -129,7 +129,8 @@ function BrowserRunner() {
" if(test.precondition && !test.precondition()) {" +
" testRun(test.id, test.path, test.description, test.test.toString(),typeof test.precondition !== 'undefined' ? test.precondition.toString() : '', 'fail', 'Precondition Failed');" +
" } else {" +
- " try { var res = test.test.call(window); } catch(e) { res = 'fail'; error = e; }" +
+ " var testThis = test.strict===undefined ? window : undefined;" +
+ " try { var res = test.test.call(testThis); } catch(e) { res = 'fail'; error = e; }" +
" var retVal = /^s/i.test(test.id) ? (res === true || typeof res === 'undefined' ? 'pass' : 'fail') : (res === true ? 'pass' : 'fail');" +
" testRun(test.id, test.path, test.description, test.test.toString(), typeof test.precondition !== 'undefined' ? test.precondition.toString() : '', retVal, error);" +
" }" +
diff --git a/tools/misc/move_test.py b/tools/misc/FixTestCasePlacement.py
index 4132eef86..4132eef86 100644
--- a/tools/misc/move_test.py
+++ b/tools/misc/FixTestCasePlacement.py