diff --git a/test/harness/sta.js b/test/harness/sta.js new file mode 100644 index 0000000000..90a8c6e0c1 --- /dev/null +++ b/test/harness/sta.js @@ -0,0 +1,276 @@ +/// 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. + +//Simple Test APIs +var SimpleTestAPIs = [] + +//----------------------------------------------------------------------------- +function compareArray(aExpected, aActual) { + if (aActual.length != aExpected.length) { + return false; + } + + aExpected.sort(); + aActual.sort(); + + var s; + for (var i = 0; i < aExpected.length; i++) { + if (aActual[i] !== aExpected[i]) { + return false; + } + } + return true; +} +SimpleTestAPIs.append(compareArray); + +//----------------------------------------------------------------------------- +function arrayContains(arr, expected) { + var found; + for (var i = 0; i < expected.length; i++) { + found = false; + for (var j = 0; j < arr.length; j++) { + if (expected[i] === arr[j]) { + found = true; + break; + } + } + if (!found) { + return false; + } + } + return true; +} +SimpleTestAPIs.append(arrayContains); + +//----------------------------------------------------------------------------- +var supportsArrayIndexGettersOnArrays = undefined; +function fnSupportsArrayIndexGettersOnArrays() { + if (typeof supportsArrayIndexGettersOnArrays !== "undefined") { + return supportsArrayIndexGettersOnArrays; + } + + supportsArrayIndexGettersOnArrays = false; + + if (fnExists(Object.defineProperty)) { + var arr = []; + Object.defineProperty(arr, "0", { + get: function() { + supportsArrayIndexGettersOnArrays = true; + return 0; + } + }); + var res = arr[0]; + } + + return supportsArrayIndexGettersOnArrays; +} +SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnArrays); + +//----------------------------------------------------------------------------- +var supportsArrayIndexGettersOnObjects = undefined; +function fnSupportsArrayIndexGettersOnObjects() { + if (typeof supportsArrayIndexGettersOnObjects !== "undefined") + return supportsArrayIndexGettersOnObjects; + + supportsArrayIndexGettersOnObjects = false; + + if (fnExists(Object.defineProperty)) { + var obj = {}; + Object.defineProperty(obj, "0", { + get: function() { + supportsArrayIndexGettersOnObjects = true; + return 0; + } + }); + var res = obj[0]; + } + + return supportsArrayIndexGettersOnObjects; +} +SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnObjects); + +//----------------------------------------------------------------------------- +function ConvertToFileUrl(pathStr) { + return "file:" + pathStr.replace(/\\/g, "/"); +} +SimpleTestAPIs.append(ConvertToFileUrl); + +//----------------------------------------------------------------------------- +function fnExists(/*arguments*/) { + for (var i = 0; i < arguments.length; i++) { + if (typeof (arguments[i]) !== "function") return false; + } + return true; +} +SimpleTestAPIs.append(fnExists); + +//----------------------------------------------------------------------------- +var supportsStrict = undefined; +function fnSupportsStrict() { + "use strict"; + if (supportsStrict !== undefined) { + return supportsStrict; + } + + try { + eval('with ({}) {}'); + supportsStrict = false; + } catch (e) { + supportsStrict = true; + } + return supportsStrict; +} +SimpleTestAPIs.append(fnSupportsStrict); + +//----------------------------------------------------------------------------- +function fnGlobalObject() { + return (function() { return this }).call(null); +} +SimpleTestAPIs.append(fnGlobalObject); + +//----------------------------------------------------------------------------- +//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) { + var attributesCorrect = true; + + if (obj[name] !== value) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { + // keep empty + } else { + attributesCorrect = false; + } + } + + try { + if (obj[name] === "oldValue") { + obj[name] = "newValue"; + } else { + obj[name] = "OldValue"; + } + } catch (we) { + } + + var overwrited = false; + if (obj[name] !== value) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { + // keep empty + } else { + overwrited = true; + } + } + if (overwrited !== writable) { + attributesCorrect = false; + } + + var enumerated = false; + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === name) { + enumerated = true; + } + } + + if (enumerated !== enumerable) { + attributesCorrect = false; + } + + + var deleted = false; + + try { + delete obj[name]; + } catch (de) { + } + if (!obj.hasOwnProperty(name)) { + deleted = true; + } + if (deleted !== configurable) { + attributesCorrect = false; + } + + return attributesCorrect; +} +SimpleTestAPIs.append(dataPropertyAttributesAreCorrect); + +//----------------------------------------------------------------------------- +//Verify all attributes specified accessor property of given object: get, set, enumerable, configurable +//If all attribute values are expected, return true, otherwise, return false +function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelpProp, enumerable, configurable) { + var attributesCorrect = true; + + if (get !== undefined) { + if (obj[name] !== get()) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof get() === "number" && isNaN(get())) { + // keep empty + } else { + attributesCorrect = false; + } + } + } else { + if (obj[name] !== undefined) { + attributesCorrect = false; + } + } + + try { + var desc = Object.getOwnPropertyDescriptor(obj, name); + if (typeof desc.set === "undefined") { + if (typeof set !== "undefined") { + attributesCorrect = false; + } + } else { + obj[name] = "toBeSetValue"; + if (obj[setVerifyHelpProp] !== "toBeSetValue") { + attributesCorrect = false; + } + } + } catch (se) { + throw se; + } + + + var enumerated = false; + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === name) { + enumerated = true; + } + } + + if (enumerated !== enumerable) { + attributesCorrect = false; + } + + + var deleted = false; + try { + delete obj[name]; + } catch (de) { + throw de; + } + if (!obj.hasOwnProperty(name)) { + deleted = true; + } + if (deleted !== configurable) { + attributesCorrect = false; + } + + return attributesCorrect; +} +SimpleTestAPIs.append(accessorPropertyAttributesAreCorrect); \ No newline at end of file diff --git a/test/harness/sth.js b/test/harness/sth.js index a66e1e2bb7..35729e70a5 100644 --- a/test/harness/sth.js +++ b/test/harness/sth.js @@ -298,249 +298,6 @@ function Controller() { var controller = new Controller() - -function compareArray(aExpected, aActual) { - if (aActual.length != aExpected.length) { - return false; - } - - aExpected.sort(); - aActual.sort(); - - var s; - for (var i = 0; i < aExpected.length; i++) { - if (aActual[i] !== aExpected[i]) { - return false; - } - } - return true; -} - - -function arrayContains(arr, expected) { - var found; - for (var i = 0; i < expected.length; i++) { - found = false; - for (var j = 0; j < arr.length; j++) { - if (expected[i] === arr[j]) { - found = true; - break; - } - } - if (!found) { - return false; - } - } - return true; -} - -var supportsArrayIndexGettersOnArrays = undefined; -function fnSupportsArrayIndexGettersOnArrays() { - if (typeof supportsArrayIndexGettersOnArrays !== "undefined") { - return supportsArrayIndexGettersOnArrays; - } - - supportsArrayIndexGettersOnArrays = false; - - if (fnExists(Object.defineProperty)) { - var arr = []; - Object.defineProperty(arr, "0", { - get: function() { - supportsArrayIndexGettersOnArrays = true; - return 0; - } - }); - var res = arr[0]; - } - - return supportsArrayIndexGettersOnArrays; -} - -var supportsArrayIndexGettersOnObjects = undefined; -function fnSupportsArrayIndexGettersOnObjects() { - if (typeof supportsArrayIndexGettersOnObjects !== "undefined") - return supportsArrayIndexGettersOnObjects; - - supportsArrayIndexGettersOnObjects = false; - - if (fnExists(Object.defineProperty)) { - var obj = {}; - Object.defineProperty(obj, "0", { - get: function() { - supportsArrayIndexGettersOnObjects = true; - return 0; - } - }); - var res = obj[0]; - } - - return supportsArrayIndexGettersOnObjects; -} - - -// ---------------------------------------------- -// helpers that unittests can use (typically in -// their prereq function). -// ---------------------------------------------- -function ConvertToFileUrl(pathStr) { - return "file:" + pathStr.replace(/\\/g, "/"); -} - -function fnExists(/*arguments*/) { - for (var i = 0; i < arguments.length; i++) { - if (typeof (arguments[i]) !== "function") return false; - } - return true; -} - - -var supportsStrict = undefined; -function fnSupportsStrict() { - "use strict"; - if (supportsStrict !== undefined) { - return supportsStrict; - } - - try { - eval('with ({}) {}'); - supportsStrict = false; - } catch (e) { - supportsStrict = true; - } - return supportsStrict; -} - -function fnGlobalObject() { - return (function() { return this }).call(null); -} - -//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) { - var attributesCorrect = true; - - if (obj[name] !== value) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { - // keep empty - } else { - attributesCorrect = false; - } - } - - try { - if (obj[name] === "oldValue") { - obj[name] = "newValue"; - } else { - obj[name] = "OldValue"; - } - } catch (we) { - } - - var overwrited = false; - if (obj[name] !== value) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { - // keep empty - } else { - overwrited = true; - } - } - if (overwrited !== writable) { - attributesCorrect = false; - } - - var enumerated = false; - for (var prop in obj) { - if (obj.hasOwnProperty(prop) && prop === name) { - enumerated = true; - } - } - - if (enumerated !== enumerable) { - attributesCorrect = false; - } - - - var deleted = false; - - try { - delete obj[name]; - } catch (de) { - } - if (!obj.hasOwnProperty(name)) { - deleted = true; - } - if (deleted !== configurable) { - attributesCorrect = false; - } - - return attributesCorrect; -} - -//Verify all attributes specified accessor property of given object: get, set, enumerable, configurable -//If all attribute values are expected, return true, otherwise, return false -function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelpProp, enumerable, configurable) { - var attributesCorrect = true; - - if (get !== undefined) { - if (obj[name] !== get()) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof get() === "number" && isNaN(get())) { - // keep empty - } else { - attributesCorrect = false; - } - } - } else { - if (obj[name] !== undefined) { - attributesCorrect = false; - } - } - - try { - var desc = Object.getOwnPropertyDescriptor(obj, name); - if (typeof desc.set === "undefined") { - if (typeof set !== "undefined") { - attributesCorrect = false; - } - } else { - obj[name] = "toBeSetValue"; - if (obj[setVerifyHelpProp] !== "toBeSetValue") { - attributesCorrect = false; - } - } - } catch (se) { - throw se; - } - - - var enumerated = false; - for (var prop in obj) { - if (obj.hasOwnProperty(prop) && prop === name) { - enumerated = true; - } - } - - if (enumerated !== enumerable) { - attributesCorrect = false; - } - - - var deleted = false; - try { - delete obj[name]; - } catch (de) { - throw de; - } - if (!obj.hasOwnProperty(name)) { - deleted = true; - } - if (deleted !== configurable) { - attributesCorrect = false; - } - - return attributesCorrect; -} - - $(function () { presenter.setup(); diff --git a/website/default.html b/website/default.html index b86b5fc544..50e1763878 100644 --- a/website/default.html +++ b/website/default.html @@ -5,6 +5,7 @@ + @@ -151,7 +152,7 @@
diff --git a/website/resources/scripts/global/sta.js b/website/resources/scripts/global/sta.js new file mode 100644 index 0000000000..90a8c6e0c1 --- /dev/null +++ b/website/resources/scripts/global/sta.js @@ -0,0 +1,276 @@ +/// 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. + +//Simple Test APIs +var SimpleTestAPIs = [] + +//----------------------------------------------------------------------------- +function compareArray(aExpected, aActual) { + if (aActual.length != aExpected.length) { + return false; + } + + aExpected.sort(); + aActual.sort(); + + var s; + for (var i = 0; i < aExpected.length; i++) { + if (aActual[i] !== aExpected[i]) { + return false; + } + } + return true; +} +SimpleTestAPIs.append(compareArray); + +//----------------------------------------------------------------------------- +function arrayContains(arr, expected) { + var found; + for (var i = 0; i < expected.length; i++) { + found = false; + for (var j = 0; j < arr.length; j++) { + if (expected[i] === arr[j]) { + found = true; + break; + } + } + if (!found) { + return false; + } + } + return true; +} +SimpleTestAPIs.append(arrayContains); + +//----------------------------------------------------------------------------- +var supportsArrayIndexGettersOnArrays = undefined; +function fnSupportsArrayIndexGettersOnArrays() { + if (typeof supportsArrayIndexGettersOnArrays !== "undefined") { + return supportsArrayIndexGettersOnArrays; + } + + supportsArrayIndexGettersOnArrays = false; + + if (fnExists(Object.defineProperty)) { + var arr = []; + Object.defineProperty(arr, "0", { + get: function() { + supportsArrayIndexGettersOnArrays = true; + return 0; + } + }); + var res = arr[0]; + } + + return supportsArrayIndexGettersOnArrays; +} +SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnArrays); + +//----------------------------------------------------------------------------- +var supportsArrayIndexGettersOnObjects = undefined; +function fnSupportsArrayIndexGettersOnObjects() { + if (typeof supportsArrayIndexGettersOnObjects !== "undefined") + return supportsArrayIndexGettersOnObjects; + + supportsArrayIndexGettersOnObjects = false; + + if (fnExists(Object.defineProperty)) { + var obj = {}; + Object.defineProperty(obj, "0", { + get: function() { + supportsArrayIndexGettersOnObjects = true; + return 0; + } + }); + var res = obj[0]; + } + + return supportsArrayIndexGettersOnObjects; +} +SimpleTestAPIs.append(fnSupportsArrayIndexGettersOnObjects); + +//----------------------------------------------------------------------------- +function ConvertToFileUrl(pathStr) { + return "file:" + pathStr.replace(/\\/g, "/"); +} +SimpleTestAPIs.append(ConvertToFileUrl); + +//----------------------------------------------------------------------------- +function fnExists(/*arguments*/) { + for (var i = 0; i < arguments.length; i++) { + if (typeof (arguments[i]) !== "function") return false; + } + return true; +} +SimpleTestAPIs.append(fnExists); + +//----------------------------------------------------------------------------- +var supportsStrict = undefined; +function fnSupportsStrict() { + "use strict"; + if (supportsStrict !== undefined) { + return supportsStrict; + } + + try { + eval('with ({}) {}'); + supportsStrict = false; + } catch (e) { + supportsStrict = true; + } + return supportsStrict; +} +SimpleTestAPIs.append(fnSupportsStrict); + +//----------------------------------------------------------------------------- +function fnGlobalObject() { + return (function() { return this }).call(null); +} +SimpleTestAPIs.append(fnGlobalObject); + +//----------------------------------------------------------------------------- +//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) { + var attributesCorrect = true; + + if (obj[name] !== value) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { + // keep empty + } else { + attributesCorrect = false; + } + } + + try { + if (obj[name] === "oldValue") { + obj[name] = "newValue"; + } else { + obj[name] = "OldValue"; + } + } catch (we) { + } + + var overwrited = false; + if (obj[name] !== value) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { + // keep empty + } else { + overwrited = true; + } + } + if (overwrited !== writable) { + attributesCorrect = false; + } + + var enumerated = false; + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === name) { + enumerated = true; + } + } + + if (enumerated !== enumerable) { + attributesCorrect = false; + } + + + var deleted = false; + + try { + delete obj[name]; + } catch (de) { + } + if (!obj.hasOwnProperty(name)) { + deleted = true; + } + if (deleted !== configurable) { + attributesCorrect = false; + } + + return attributesCorrect; +} +SimpleTestAPIs.append(dataPropertyAttributesAreCorrect); + +//----------------------------------------------------------------------------- +//Verify all attributes specified accessor property of given object: get, set, enumerable, configurable +//If all attribute values are expected, return true, otherwise, return false +function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelpProp, enumerable, configurable) { + var attributesCorrect = true; + + if (get !== undefined) { + if (obj[name] !== get()) { + if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof get() === "number" && isNaN(get())) { + // keep empty + } else { + attributesCorrect = false; + } + } + } else { + if (obj[name] !== undefined) { + attributesCorrect = false; + } + } + + try { + var desc = Object.getOwnPropertyDescriptor(obj, name); + if (typeof desc.set === "undefined") { + if (typeof set !== "undefined") { + attributesCorrect = false; + } + } else { + obj[name] = "toBeSetValue"; + if (obj[setVerifyHelpProp] !== "toBeSetValue") { + attributesCorrect = false; + } + } + } catch (se) { + throw se; + } + + + var enumerated = false; + for (var prop in obj) { + if (obj.hasOwnProperty(prop) && prop === name) { + enumerated = true; + } + } + + if (enumerated !== enumerable) { + attributesCorrect = false; + } + + + var deleted = false; + try { + delete obj[name]; + } catch (de) { + throw de; + } + if (!obj.hasOwnProperty(name)) { + deleted = true; + } + if (deleted !== configurable) { + attributesCorrect = false; + } + + return attributesCorrect; +} +SimpleTestAPIs.append(accessorPropertyAttributesAreCorrect); \ No newline at end of file diff --git a/website/resources/scripts/global/sth.js b/website/resources/scripts/global/sth.js index a66e1e2bb7..35729e70a5 100644 --- a/website/resources/scripts/global/sth.js +++ b/website/resources/scripts/global/sth.js @@ -298,249 +298,6 @@ function Controller() { var controller = new Controller() - -function compareArray(aExpected, aActual) { - if (aActual.length != aExpected.length) { - return false; - } - - aExpected.sort(); - aActual.sort(); - - var s; - for (var i = 0; i < aExpected.length; i++) { - if (aActual[i] !== aExpected[i]) { - return false; - } - } - return true; -} - - -function arrayContains(arr, expected) { - var found; - for (var i = 0; i < expected.length; i++) { - found = false; - for (var j = 0; j < arr.length; j++) { - if (expected[i] === arr[j]) { - found = true; - break; - } - } - if (!found) { - return false; - } - } - return true; -} - -var supportsArrayIndexGettersOnArrays = undefined; -function fnSupportsArrayIndexGettersOnArrays() { - if (typeof supportsArrayIndexGettersOnArrays !== "undefined") { - return supportsArrayIndexGettersOnArrays; - } - - supportsArrayIndexGettersOnArrays = false; - - if (fnExists(Object.defineProperty)) { - var arr = []; - Object.defineProperty(arr, "0", { - get: function() { - supportsArrayIndexGettersOnArrays = true; - return 0; - } - }); - var res = arr[0]; - } - - return supportsArrayIndexGettersOnArrays; -} - -var supportsArrayIndexGettersOnObjects = undefined; -function fnSupportsArrayIndexGettersOnObjects() { - if (typeof supportsArrayIndexGettersOnObjects !== "undefined") - return supportsArrayIndexGettersOnObjects; - - supportsArrayIndexGettersOnObjects = false; - - if (fnExists(Object.defineProperty)) { - var obj = {}; - Object.defineProperty(obj, "0", { - get: function() { - supportsArrayIndexGettersOnObjects = true; - return 0; - } - }); - var res = obj[0]; - } - - return supportsArrayIndexGettersOnObjects; -} - - -// ---------------------------------------------- -// helpers that unittests can use (typically in -// their prereq function). -// ---------------------------------------------- -function ConvertToFileUrl(pathStr) { - return "file:" + pathStr.replace(/\\/g, "/"); -} - -function fnExists(/*arguments*/) { - for (var i = 0; i < arguments.length; i++) { - if (typeof (arguments[i]) !== "function") return false; - } - return true; -} - - -var supportsStrict = undefined; -function fnSupportsStrict() { - "use strict"; - if (supportsStrict !== undefined) { - return supportsStrict; - } - - try { - eval('with ({}) {}'); - supportsStrict = false; - } catch (e) { - supportsStrict = true; - } - return supportsStrict; -} - -function fnGlobalObject() { - return (function() { return this }).call(null); -} - -//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) { - var attributesCorrect = true; - - if (obj[name] !== value) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { - // keep empty - } else { - attributesCorrect = false; - } - } - - try { - if (obj[name] === "oldValue") { - obj[name] = "newValue"; - } else { - obj[name] = "OldValue"; - } - } catch (we) { - } - - var overwrited = false; - if (obj[name] !== value) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof value === "number" && isNaN(value)) { - // keep empty - } else { - overwrited = true; - } - } - if (overwrited !== writable) { - attributesCorrect = false; - } - - var enumerated = false; - for (var prop in obj) { - if (obj.hasOwnProperty(prop) && prop === name) { - enumerated = true; - } - } - - if (enumerated !== enumerable) { - attributesCorrect = false; - } - - - var deleted = false; - - try { - delete obj[name]; - } catch (de) { - } - if (!obj.hasOwnProperty(name)) { - deleted = true; - } - if (deleted !== configurable) { - attributesCorrect = false; - } - - return attributesCorrect; -} - -//Verify all attributes specified accessor property of given object: get, set, enumerable, configurable -//If all attribute values are expected, return true, otherwise, return false -function accessorPropertyAttributesAreCorrect(obj, name, get, set, setVerifyHelpProp, enumerable, configurable) { - var attributesCorrect = true; - - if (get !== undefined) { - if (obj[name] !== get()) { - if (typeof obj[name] === "number" && isNaN(obj[name]) && typeof get() === "number" && isNaN(get())) { - // keep empty - } else { - attributesCorrect = false; - } - } - } else { - if (obj[name] !== undefined) { - attributesCorrect = false; - } - } - - try { - var desc = Object.getOwnPropertyDescriptor(obj, name); - if (typeof desc.set === "undefined") { - if (typeof set !== "undefined") { - attributesCorrect = false; - } - } else { - obj[name] = "toBeSetValue"; - if (obj[setVerifyHelpProp] !== "toBeSetValue") { - attributesCorrect = false; - } - } - } catch (se) { - throw se; - } - - - var enumerated = false; - for (var prop in obj) { - if (obj.hasOwnProperty(prop) && prop === name) { - enumerated = true; - } - } - - if (enumerated !== enumerable) { - attributesCorrect = false; - } - - - var deleted = false; - try { - delete obj[name]; - } catch (de) { - throw de; - } - if (!obj.hasOwnProperty(name)) { - deleted = true; - } - if (deleted !== configurable) { - attributesCorrect = false; - } - - return attributesCorrect; -} - - $(function () { presenter.setup(); diff --git a/website/resources/scripts/testcases/testcaseslist.xml b/website/resources/scripts/testcases/testcaseslist.xml index be1d8c5f55..200f07005d 100644 --- a/website/resources/scripts/testcases/testcaseslist.xml +++ b/website/resources/scripts/testcases/testcaseslist.xml @@ -1,4 +1,4 @@ -