OLD | NEW |
---|---|
(Empty) | |
1 if (this.importScripts) | |
2 importScripts('../resources/js-test-pre.js'); | |
3 | |
4 description("Test to ensure that global constructors in workers environment have the right attributes"); | |
5 | |
6 function descriptorShouldBe(object, property, expected) { | |
7 var test = "Object.getOwnPropertyDescriptor(" + object + ", " + property + " )"; | |
8 if ("writable" in expected) { | |
9 shouldBe(test + ".value", "" + expected.value); | |
10 shouldBeFalse(test + ".hasOwnProperty('get')"); | |
11 shouldBeFalse(test + ".hasOwnProperty('set')"); | |
12 } else { | |
13 shouldBe(test + ".get", "" + expected.get); | |
14 shouldBe(test + ".set", "" + expected.set); | |
15 shouldBeFalse(test + ".hasOwnProperty('value')"); | |
16 shouldBeFalse(test + ".hasOwnProperty('writable')"); | |
17 } | |
18 shouldBe(test + ".enumerable", "" + expected.enumerable); | |
19 shouldBe(test + ".configurable", "" + expected.configurable); | |
20 } | |
21 | |
22 var global = this; | |
23 | |
24 descriptorShouldBe("global", "'DataView'", {writable: true, enumerable: false, c onfigurable: true, value:"DataView"}); | |
25 descriptorShouldBe("global", "'EventSource'", {writable: true, enumerable: false , configurable: true, value:"EventSource"}); | |
26 descriptorShouldBe("global", "'FileReaderSync'", {writable: true, enumerable: fa lse, configurable: true, value:"FileReaderSync"}); | |
27 descriptorShouldBe("global", "'Float64Array'", {writable: true, enumerable: fals e, 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
| |
28 descriptorShouldBe("global", "'MessageChannel'", {writable: true, enumerable: fa lse, configurable: true, value:"MessageChannel"}); | |
29 descriptorShouldBe("global", "'WorkerLocation'", {writable: true, enumerable: fa lse, configurable: true, value:"WorkerLocation"}); | |
30 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: fa lse, configurable: true, value:"XMLHttpRequest"}); | |
31 | |
32 finishJSTest(); | |
OLD | NEW |