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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 break; | 55 break; |
56 } | 56 } |
57 | 57 |
58 insertExpectedResult(path, expected); | 58 insertExpectedResult(path, expected); |
59 } | 59 } |
60 | 60 |
61 function collectPropertiesHelper(object, path) | 61 function collectPropertiesHelper(object, path) |
62 { | 62 { |
63 if (path.length > 20) | 63 if (path.length > 20) |
64 throw 'Error: probably looping'; | 64 throw 'Error: probably looping'; |
65 | |
65 for (var property in object) { | 66 for (var property in object) { |
67 // Skip the properties which are hard to expect a stable result. | |
haraken
2014/03/05 05:49:26
Let's mention why this is unstable.
hajimehoshi
2014/03/05 05:53:56
Done.
| |
68 if (property == 'accessibilityController') | |
69 continue; | |
66 if (!object[property]) | 70 if (!object[property]) |
67 continue; | 71 continue; |
68 path.push(property); | 72 path.push(property); |
69 var type = typeof(object[property]); | 73 var type = typeof(object[property]); |
70 if (type == "object") { | 74 if (type == "object") { |
71 // Skip some traversing through types that will end up in cycles... | 75 // Skip some traversing through types that will end up in cycles... |
72 if (!object[property].Window | 76 if (!object[property].Window |
73 && !(object[property] instanceof Node) | 77 && !(object[property] instanceof Node) |
74 && !(object[property] instanceof MimeTypeArray) | 78 && !(object[property] instanceof MimeTypeArray) |
75 && !(object[property] instanceof PluginArray)) { | 79 && !(object[property] instanceof PluginArray)) { |
76 collectPropertiesHelper(object[property], path); | 80 collectPropertiesHelper(object[property], path); |
77 } | 81 } |
78 } else if (type == "string") { | 82 } else if (type == "string") { |
79 emitExpectedResult(path, "''"); | 83 emitExpectedResult(path, "''"); |
80 } else if (type == "number") { | 84 } else if (type == "number") { |
81 emitExpectedResult(path, "0"); | 85 emitExpectedResult(path, "0"); |
82 } else if (type == "boolean") { | 86 } else if (type == "boolean") { |
83 emitExpectedResult(path, "false"); | 87 emitExpectedResult(path, "false"); |
84 } | 88 } |
85 path.pop(); | 89 path.pop(); |
86 } | 90 } |
87 } | 91 } |
88 | |
OLD | NEW |