Chromium Code Reviews| Index: LayoutTests/fast/js/script-tests/global-constructors-attributes-worker.js |
| diff --git a/LayoutTests/fast/js/script-tests/global-constructors-attributes-worker.js b/LayoutTests/fast/js/script-tests/global-constructors-attributes-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b3552435f3ae5150fdb7235c6f192ff1e4cd56f2 |
| --- /dev/null |
| +++ b/LayoutTests/fast/js/script-tests/global-constructors-attributes-worker.js |
| @@ -0,0 +1,32 @@ |
| +if (this.importScripts) |
| + importScripts('../resources/js-test-pre.js'); |
| + |
| +description("Test to ensure that global constructors in workers environment have the right attributes"); |
| + |
| +function descriptorShouldBe(object, property, expected) { |
| + var test = "Object.getOwnPropertyDescriptor(" + object + ", " + property + ")"; |
| + if ("writable" in expected) { |
| + shouldBe(test + ".value", "" + expected.value); |
| + shouldBeFalse(test + ".hasOwnProperty('get')"); |
| + shouldBeFalse(test + ".hasOwnProperty('set')"); |
| + } else { |
| + shouldBe(test + ".get", "" + expected.get); |
| + shouldBe(test + ".set", "" + expected.set); |
| + shouldBeFalse(test + ".hasOwnProperty('value')"); |
| + shouldBeFalse(test + ".hasOwnProperty('writable')"); |
| + } |
| + shouldBe(test + ".enumerable", "" + expected.enumerable); |
| + shouldBe(test + ".configurable", "" + expected.configurable); |
| +} |
| + |
| +var global = this; |
| + |
| +descriptorShouldBe("global", "'DataView'", {writable: true, enumerable: false, configurable: true, value:"DataView"}); |
| +descriptorShouldBe("global", "'EventSource'", {writable: true, enumerable: false, configurable: true, value:"EventSource"}); |
| +descriptorShouldBe("global", "'FileReaderSync'", {writable: true, enumerable: false, configurable: true, value:"FileReaderSync"}); |
| +descriptorShouldBe("global", "'Float64Array'", {writable: true, enumerable: false, configurable: true, value:"Float64Array"}); |
|
haraken
2013/06/06 06:45:27
Aren't other typed arrays exposed on workers?
do-not-use
2013/06/06 06:53:26
They are. This test just tests a few of the expose
|
| +descriptorShouldBe("global", "'MessageChannel'", {writable: true, enumerable: false, configurable: true, value:"MessageChannel"}); |
| +descriptorShouldBe("global", "'WorkerLocation'", {writable: true, enumerable: false, configurable: true, value:"WorkerLocation"}); |
| +descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"}); |
| + |
| +finishJSTest(); |