OLD | NEW |
1 function collectProperties() | 1 function collectProperties() |
2 { | 2 { |
3 // Collect properties of the top-level window, since touching the properties | 3 // Collect properties of the top-level window, since touching the properties |
4 // of a DOMWindow affects its internal C++ state. | 4 // of a DOMWindow affects its internal C++ state. |
5 collectPropertiesHelper(window, []); | 5 collectPropertiesHelper(window, []); |
6 | 6 |
7 propertiesToVerify.sort(function (a, b) | 7 propertiesToVerify.sort(function (a, b) |
8 { | 8 { |
9 if (a.property < b.property) | 9 if (a.property < b.property) |
10 return -1 | 10 return -1 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // FIXME: Skip MemoryInfo for now, since it's not implemented as a DOMWindow
Property, and has | 29 // FIXME: Skip MemoryInfo for now, since it's not implemented as a DOMWindow
Property, and has |
30 // no way of knowing when it's detached. Eventually this should have the sam
e behavior. | 30 // no way of knowing when it's detached. Eventually this should have the sam
e behavior. |
31 if (path.length >= 2 && (path[0] == 'console' || path[0] == 'performance') &
& path[1] == 'memory') | 31 if (path.length >= 2 && (path[0] == 'console' || path[0] == 'performance') &
& path[1] == 'memory') |
32 return; | 32 return; |
33 | 33 |
34 // Skip things that are assumed to be constants. | 34 // Skip things that are assumed to be constants. |
35 if (path[path.length - 1].toUpperCase() == path[path.length - 1]) | 35 if (path[path.length - 1].toUpperCase() == path[path.length - 1]) |
36 return; | 36 return; |
37 | 37 |
38 // Various special cases... | 38 // Various special cases for legacy reasons. Please do not add entries to th
is list. |
39 var propertyPath = path.join('.'); | 39 var propertyPath = path.join('.'); |
40 switch (propertyPath) { | 40 switch (propertyPath) { |
41 case "location.href": | 41 case "location.href": |
42 expected = "'about:blank'"; | 42 expected = "'about:blank'"; |
43 break; | 43 break; |
44 case "location.origin": | 44 case "location.origin": |
45 expected = "'null'"; | 45 expected = "'null'"; |
46 break; | 46 break; |
47 case "location.pathname": | 47 case "location.pathname": |
48 expected = "'blank'"; | 48 expected = "'blank'"; |
49 break; | 49 break; |
50 case "location.protocol": | 50 case "location.protocol": |
51 expected = "'about:'"; | 51 expected = "'about:'"; |
52 break; | 52 break; |
53 case "navigator.appCodeName": | 53 case "navigator.appCodeName": |
54 case "navigator.appName": | 54 case "navigator.appName": |
55 case "navigator.language": | 55 case "navigator.language": |
56 case "navigator.onLine": | 56 case "navigator.onLine": |
57 case "navigator.platform": | 57 case "navigator.platform": |
58 case "navigator.product": | 58 case "navigator.product": |
59 case "navigator.productSub": | 59 case "navigator.productSub": |
60 case "navigator.vendor": | 60 case "navigator.vendor": |
61 expected = "window." + propertyPath; | 61 expected = "window." + propertyPath; |
62 break; | 62 break; |
63 case "navigator.battery.charging": | |
64 expected = "true"; | |
65 break; | |
66 case "navigator.battery.chargingTime": | |
67 expected = "Infinity"; | |
68 break; | |
69 case "navigator.battery.dischargingTime": | |
70 expected = "Infinity"; | |
71 break; | |
72 case "navigator.battery.level": | |
73 expected = "1"; | |
74 break; | |
75 } | 63 } |
76 | 64 |
77 insertExpectedResult(path, expected); | 65 insertExpectedResult(path, expected); |
78 } | 66 } |
79 | 67 |
80 function collectPropertiesHelper(object, path) | 68 function collectPropertiesHelper(object, path) |
81 { | 69 { |
82 if (path.length > 20) | 70 if (path.length > 20) |
83 throw 'Error: probably looping'; | 71 throw 'Error: probably looping'; |
84 | 72 |
(...skipping 23 matching lines...) Expand all Loading... |
108 } else if (type == "string") { | 96 } else if (type == "string") { |
109 emitExpectedResult(path, "''"); | 97 emitExpectedResult(path, "''"); |
110 } else if (type == "number") { | 98 } else if (type == "number") { |
111 emitExpectedResult(path, "0"); | 99 emitExpectedResult(path, "0"); |
112 } else if (type == "boolean") { | 100 } else if (type == "boolean") { |
113 emitExpectedResult(path, "false"); | 101 emitExpectedResult(path, "false"); |
114 } | 102 } |
115 path.pop(); | 103 path.pop(); |
116 } | 104 } |
117 } | 105 } |
OLD | NEW |