| OLD | NEW |
| 1 function collectProperties() | 1 function collectProperties(windowHasBeenGCed) |
| 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, windowHasBeenGCed, []); |
| 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 |
| 11 if (a.property > b.property) | 11 if (a.property > b.property) |
| 12 return 1; | 12 return 1; |
| 13 return 0; | 13 return 0; |
| 14 }); | 14 }); |
| 15 } | 15 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 expected = "window." + propertyPath; | 73 expected = "window." + propertyPath; |
| 74 break; | 74 break; |
| 75 case "screen.orientation": | 75 case "screen.orientation": |
| 76 expected = "'portrait-primary'"; | 76 expected = "'portrait-primary'"; |
| 77 break; | 77 break; |
| 78 } | 78 } |
| 79 | 79 |
| 80 insertExpectedResult(path, expected); | 80 insertExpectedResult(path, expected); |
| 81 } | 81 } |
| 82 | 82 |
| 83 function collectPropertiesHelper(object, path) | 83 function collectPropertiesHelper(object, windowHasBeenGCed, path) |
| 84 { | 84 { |
| 85 if (path.length > 20) | 85 if (path.length > 20) |
| 86 throw 'Error: probably looping'; | 86 throw 'Error: probably looping'; |
| 87 | 87 |
| 88 for (var property in object) { | 88 for (var property in object) { |
| 89 // Skip internals properties, since they aren't web accessible. | 89 // Skip internals properties, since they aren't web accessible. |
| 90 if (property === 'internals') | 90 if (property === 'internals') |
| 91 continue; | 91 continue; |
| 92 path.push(property); | 92 path.push(property); |
| 93 var type = typeof(object[property]); | 93 var type = typeof(object[property]); |
| 94 if (type == "object") { | 94 if (type == "object") { |
| 95 if (object[property] === null) { | 95 if (object[property] === null) { |
| 96 emitExpectedResult(path, "null"); | 96 emitExpectedResult(path, "null"); |
| 97 } else if (!object[property].Window | 97 } else if (!object[property].Window |
| 98 && !(object[property] instanceof Node) | 98 && !(object[property] instanceof Node) |
| 99 && !(object[property] instanceof MimeTypeArray) | 99 && !(object[property] instanceof MimeTypeArray) |
| 100 && !(object[property] instanceof PluginArray)) { | 100 && !(object[property] instanceof PluginArray)) { |
| 101 // Skip some traversing through types that will end up in cycles
... | 101 // Skip some traversing through types that will end up in cycles
... |
| 102 collectPropertiesHelper(object[property], path); | 102 collectPropertiesHelper(object[property], windowHasBeenGCed, pat
h); |
| 103 } | 103 } |
| 104 } else if (type == "string") { | 104 } else if (type == "string") { |
| 105 emitExpectedResult(path, "''"); | 105 emitExpectedResult(path, "''"); |
| 106 } else if (type == "number") { | 106 } else if (type == "number") { |
| 107 emitExpectedResult(path, "0"); | 107 emitExpectedResult(path, "0"); |
| 108 } else if (type == "boolean") { | 108 } else if (type == "boolean") { |
| 109 emitExpectedResult(path, "false"); | 109 expected = "false"; |
| 110 if (path == "closed" && windowHasBeenGCed ) |
| 111 expected = "true"; |
| 112 emitExpectedResult(path, expected); |
| 110 } | 113 } |
| 111 path.pop(); | 114 path.pop(); |
| 112 } | 115 } |
| 113 } | 116 } |
| OLD | NEW |