| OLD | NEW |
| 1 document.getElementById("description").innerHTML = "Tests that we clone object h
ierarchies"; | 1 document.getElementById("description").innerHTML = "Tests that we clone object h
ierarchies"; |
| 2 | 2 |
| 3 tryPostMessage('null'); | 3 tryPostMessage('null'); |
| 4 tryPostMessage('undefined'); | 4 tryPostMessage('undefined'); |
| 5 tryPostMessage('1'); | 5 tryPostMessage('1'); |
| 6 tryPostMessage('true'); | 6 tryPostMessage('true'); |
| 7 tryPostMessage('"1"'); | 7 tryPostMessage('"1"'); |
| 8 tryPostMessage('({})'); | 8 tryPostMessage('({})'); |
| 9 tryPostMessage('({a:1})'); | 9 tryPostMessage('({a:1})'); |
| 10 tryPostMessage('({a:"a"})'); | 10 tryPostMessage('({a:"a"})'); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 tryPostMessage('new Boolean(true)'); | 26 tryPostMessage('new Boolean(true)'); |
| 27 tryPostMessage('new Boolean(false)'); | 27 tryPostMessage('new Boolean(false)'); |
| 28 tryPostMessage('new String("gnirts")'); | 28 tryPostMessage('new String("gnirts")'); |
| 29 tryPostMessage('new Number(42.0)'); | 29 tryPostMessage('new Number(42.0)'); |
| 30 cyclicObject={}; | 30 cyclicObject={}; |
| 31 cyclicObject.self = cyclicObject; | 31 cyclicObject.self = cyclicObject; |
| 32 tryPostMessage('cyclicObject', false, "cyclicObject"); | 32 tryPostMessage('cyclicObject', false, "cyclicObject"); |
| 33 cyclicArray=[]; | 33 cyclicArray=[]; |
| 34 cyclicArray[0] = cyclicArray; | 34 cyclicArray[0] = cyclicArray; |
| 35 tryPostMessage('cyclicArray', false, "cyclicArray"); | 35 tryPostMessage('cyclicArray', false, "cyclicArray"); |
| 36 var cyclicObjectGetter = {get self() { return cyclicObjectGetter; }}; |
| 37 tryPostMessage('cyclicObjectGetter', false, 'cyclicObject'); |
| 36 objectGraph = {}; | 38 objectGraph = {}; |
| 37 object = {}; | 39 object = {}; |
| 38 objectGraph.graph1 = object; | 40 objectGraph.graph1 = object; |
| 39 objectGraph.graph2 = object; | 41 objectGraph.graph2 = object; |
| 40 tryPostMessage('objectGraph', false, "objectGraph"); | 42 tryPostMessage('objectGraph', false, "objectGraph"); |
| 41 arrayGraph = [object, object]; | 43 arrayGraph = [object, object]; |
| 42 tryPostMessage('arrayGraph', false, "arrayGraph"); | 44 tryPostMessage('arrayGraph', false, "arrayGraph"); |
| 43 tryPostMessage('window', true); | 45 tryPostMessage('window', true); |
| 44 tryPostMessage('({get a() { throw "x" }})', true); | 46 tryPostMessage('({get a() { throw "x" }})', true); |
| 45 | 47 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 tryPostMessage(thunk( | 149 tryPostMessage(thunk( |
| 148 'var obja = {get p() { return 42; }}; ' + | 150 'var obja = {get p() { return 42; }}; ' + |
| 149 'var msg = {a: obja, get b() { return obja; }}; ' + | 151 'var msg = {a: obja, get b() { return obja; }}; ' + |
| 150 'return msg;' | 152 'return msg;' |
| 151 ), false, "evalThunk", function(v) { | 153 ), false, "evalThunk", function(v) { |
| 152 // Interestingly, the standard admits two answers here! | 154 // Interestingly, the standard admits two answers here! |
| 153 doPassFail(v.a === v.b, "reference equality preserved (opposite order)")
; | 155 doPassFail(v.a === v.b, "reference equality preserved (opposite order)")
; |
| 154 doPassFail((v.b.p === 42 && v.a.p === 42) || | 156 doPassFail((v.b.p === 42 && v.a.p === 42) || |
| 155 (v.b.p === null && v.a.p === null), "accessors used (opposite
order)"); | 157 (v.b.p === null && v.a.p === null), "accessors used (opposite
order)"); |
| 156 }); | 158 }); |
| 157 // We should nullify the results from accessors more than one level deep, | 159 |
| 158 // but leave other fields untouched. | 160 // Tests to verify that accessor and non-accessor properties are |
| 161 // treated equivalently. |
| 159 tryPostMessage(thunk( | 162 tryPostMessage(thunk( |
| 160 'var obja = {get p() { return 42; }, q: 43}; ' + | 163 'var obja = {get p() { return 42; }, q: 43}; ' + |
| 161 'return {get a() { return obja; }};' | 164 'return {get a() { return obja; }};' |
| 162 ), false, "evalThunk", function(v) { | 165 ), false, "evalThunk", function(v) { |
| 163 doPassFail(v.a.p === null, "accessor value was nullified"); | 166 doPassFail(v.a.p === 42, "accessor value was not nullified"); |
| 164 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); | 167 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); |
| 165 }); | 168 }); |
| 166 tryPostMessage(thunk( | 169 tryPostMessage(thunk( |
| 167 'var objb = {get r() { return 44; }, t: 45}; ' + | 170 'var objb = {get r() { return 44; }, t: 45}; ' + |
| 168 'var obja = {get p() { return 42; }, q: 43, s: objb}; ' + | 171 'var obja = {get p() { return 42; }, q: 43, s: objb}; ' + |
| 169 'return {get a() { return obja; }};' | 172 'return {get a() { return obja; }};' |
| 170 ), false, "evalThunk", function(v) { | 173 ), false, "evalThunk", function(v) { |
| 171 doPassFail(v.a.p === null, "accessor value was nullified"); | 174 doPassFail(v.a.p === 42, "accessor value was not nullified"); |
| 172 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); | 175 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); |
| 173 doPassFail(v.s !== null, "non-accessor value was not nullified"); | 176 doPassFail(v.s !== null, "non-accessor value was not nullified"); |
| 174 doPassFail(v.a.s.r === null, "accessor value was nullified"); | 177 doPassFail(v.a.s.r === 44, "accessor value was not nullified"); |
| 175 doPassFail(v.a.s.t === 45, "non-accessor value was not nullified"); | 178 doPassFail(v.a.s.t === 45, "non-accessor value was not nullified"); |
| 176 }); | 179 }); |
| 177 tryPostMessage(thunk( | 180 tryPostMessage(thunk( |
| 178 'var objb = {get r() { return 44; }, t: 45}; ' + | 181 'var objb = {get r() { return 44; }, t: 45}; ' + |
| 179 'var obja = {get p() { return 42; }, q: 43, s: [objb]}; ' + | 182 'var obja = {get p() { return 42; }, q: 43, s: [objb]}; ' + |
| 180 'return {get c() { return 47; }, get a() { return obja; }, get b() { ret
urn 46; } };' | 183 'return {get c() { return 47; }, get a() { return obja; }, get b() { ret
urn 46; } };' |
| 181 ), false, "evalThunk", function(v) { | 184 ), false, "evalThunk", function(v) { |
| 182 doPassFail(v.b === 46, "accessor value was not nullified"); | 185 doPassFail(v.b === 46, "accessor value was not nullified"); |
| 183 doPassFail(v.c === 47, "accessor value was not nullified"); | 186 doPassFail(v.c === 47, "accessor value was not nullified"); |
| 184 doPassFail(v.a.p === null, "accessor value was nullified"); | 187 doPassFail(v.a.p === 42, "accessor value was not nullified"); |
| 185 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); | 188 doPassFail(v.a.q === 43, "non-accessor value was not nullified"); |
| 186 doPassFail(v.a.s !== null, "non-accessor value was not nullified"); | 189 doPassFail(v.a.s !== null, "non-accessor value was not nullified"); |
| 187 doPassFail(v.a.s !== undefined, "non-accessor value is defined"); | 190 doPassFail(v.a.s !== undefined, "non-accessor value is defined"); |
| 188 doPassFail(v.a.s[0] !== null, "non-accessor value was not nullified"); | 191 doPassFail(v.a.s[0] !== null, "non-accessor value was not nullified"); |
| 189 doPassFail(v.a.s[0] !== undefined, "non-accessor value is defined"); | 192 doPassFail(v.a.s[0] !== undefined, "non-accessor value is defined"); |
| 190 doPassFail(v.a.s[0].r === null, "accessor value was nullified"); | 193 doPassFail(v.a.s[0].r === 44, "accessor value was not nullified"); |
| 191 doPassFail(v.a.s[0].t === 45, "non-accessor value was not nullified"); | 194 doPassFail(v.a.s[0].t === 45, "non-accessor value was not nullified"); |
| 192 }); | 195 }); |
| 193 | 196 |
| 194 // We need to pass out the exception raised from internal accessors. | 197 // We need to pass out the exception raised from internal accessors. |
| 195 tryPostMessage(thunk( | 198 tryPostMessage(thunk( |
| 196 'return {get a() { throw "accessor-exn"; }};' | 199 'return {get a() { throw "accessor-exn"; }};' |
| 197 ), true, null, 'accessor-exn'); | 200 ), true, null, 'accessor-exn'); |
| 198 // We should still return the exception raised from nulled-out accessors. | |
| 199 tryPostMessage(thunk( | 201 tryPostMessage(thunk( |
| 200 'var obja = {get p() { throw "accessor-exn"; }}; ' + | 202 'var obja = {get p() { throw "accessor-exn"; }}; ' + |
| 201 'return {get a() { return obja; }};' | 203 'return {get a() { return obja; }};' |
| 202 ), true, null, 'accessor-exn'); | 204 ), true, null, 'accessor-exn'); |
| 203 // We should run the first nullified accessor, but no more. | |
| 204 tryPostMessage(thunk( | 205 tryPostMessage(thunk( |
| 205 'window.bcalled = undefined; ' + | 206 'window.bcalled = undefined; ' + |
| 206 'window.acalled = undefined; ' + | 207 'window.acalled = undefined; ' + |
| 207 'window.pcalled = undefined; ' + | 208 'window.pcalled = undefined; ' + |
| 208 'var objb = {get b() { window.bcalled = true; return 42; }}; ' + | 209 'var objb = {get b() { window.bcalled = true; return 42; }}; ' + |
| 209 'var obja = {get a() { window.acalled = true; return objb; }}; ' + | 210 'var obja = {get a() { window.acalled = true; return objb; }}; ' + |
| 210 'return { get p() { window.pcalled = true; return obja; }};' | 211 'return { get p() { window.pcalled = true; return obja; }};' |
| 211 ), false, "evalThunk", function(v) { | 212 ), false, "evalThunk", function(v) { |
| 212 doPassFail(v.p.a === null, "accessor value was nullified"); | 213 doPassFail(v.p.a.b === 42, "accessor value was not nullified"); |
| 213 doPassFail(window.pcalled === true, "window.pcalled === true"); | 214 doPassFail(window.pcalled === true, "window.pcalled === true"); |
| 214 doPassFail(window.acalled === true, "window.acalled === true"); | 215 doPassFail(window.acalled === true, "window.acalled === true"); |
| 215 doPassFail(window.bcalled === undefined, "window.bcalled === undefined")
; | 216 doPassFail(window.bcalled === true, "window.bcalled === true"); |
| 216 }); | 217 }); |
| 217 | 218 |
| 218 // Reference equality between Boolean objects must be maintained. | 219 // Reference equality between Boolean objects must be maintained. |
| 219 tryPostMessage(thunk( | 220 tryPostMessage(thunk( |
| 220 'var t1 = new Boolean(true); ' + | 221 'var t1 = new Boolean(true); ' + |
| 221 'var t2 = new Boolean(true); ' + | 222 'var t2 = new Boolean(true); ' + |
| 222 'var f1 = new Boolean(false); ' + | 223 'var f1 = new Boolean(false); ' + |
| 223 'var f2 = new Boolean(false); ' + | 224 'var f2 = new Boolean(false); ' + |
| 224 'return [t1, t1, t2, f1, f1, f2];' | 225 'return [t1, t1, t2, f1, f1, f2];' |
| 225 ), false, "evalThunk", function(v) { | 226 ), false, "evalThunk", function(v) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 doPassFail(v[0].length === window.fileList.length, "FileList length
sent correctly"); | 326 doPassFail(v[0].length === window.fileList.length, "FileList length
sent correctly"); |
| 326 doPassFail(v[0][0] !== v[1], "FileList should not respect reference
equality (0)"); | 327 doPassFail(v[0][0] !== v[1], "FileList should not respect reference
equality (0)"); |
| 327 doPassFail(v[0][1] !== v[2], "FileList should not respect reference
equality (1)"); | 328 doPassFail(v[0][1] !== v[2], "FileList should not respect reference
equality (1)"); |
| 328 doPassFail(v[0][0].name == window.file0.name, "FileList preserves or
der and data (name0)"); | 329 doPassFail(v[0][0].name == window.file0.name, "FileList preserves or
der and data (name0)"); |
| 329 doPassFail(v[0][1].name == window.file1.name, "FileList preserves or
der and data (name1)"); | 330 doPassFail(v[0][1].name == window.file1.name, "FileList preserves or
der and data (name1)"); |
| 330 doPassFail(equal(v[0][0].lastModifiedDate, window.file0.lastModified
Date), "FileList preserves order and data (date0)"); | 331 doPassFail(equal(v[0][0].lastModifiedDate, window.file0.lastModified
Date), "FileList preserves order and data (date0)"); |
| 331 doPassFail(equal(v[0][1].lastModifiedDate, window.file1.lastModified
Date), "FileList preserves order and data (date1)"); | 332 doPassFail(equal(v[0][1].lastModifiedDate, window.file1.lastModified
Date), "FileList preserves order and data (date1)"); |
| 332 }); | 333 }); |
| 333 } | 334 } |
| 334 tryPostMessage('"done"'); | 335 tryPostMessage('"done"'); |
| OLD | NEW |