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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 var mutatedImageData = document.createElement("canvas").getContext("2d").createI
mageData(10,10); | 68 var mutatedImageData = document.createElement("canvas").getContext("2d").createI
mageData(10,10); |
69 for (var i = 0; i < imageData.data.length * 4; i++) | 69 for (var i = 0; i < imageData.data.length * 4; i++) |
70 mutatedImageData.data[i] = i % 256; | 70 mutatedImageData.data[i] = i % 256; |
71 tryPostMessage('imageData', false, imageData); | 71 tryPostMessage('imageData', false, imageData); |
72 tryPostMessage('imageData.data', false, imageData.data) | 72 tryPostMessage('imageData.data', false, imageData.data) |
73 tryPostMessage('mutatedImageData', false, imageData); | 73 tryPostMessage('mutatedImageData', false, imageData); |
74 tryPostMessage('mutatedImageData.data', false, imageData.data) | 74 tryPostMessage('mutatedImageData.data', false, imageData.data) |
75 for (var i = 0; i < imageData.data.length * 4; i++) | 75 for (var i = 0; i < imageData.data.length * 4; i++) |
76 mutatedImageData.data[i] = 0; | 76 mutatedImageData.data[i] = 0; |
77 | 77 |
| 78 // Test close() special case for Blob (and File.) |
| 79 |
| 80 var blob = new Blob(["Hello"]); |
| 81 var blobSize = blob.size; |
| 82 tryPostMessage('blob', false, "evalThunk", function(v) { doPassFail(v.size === b
lobSize, "Cloned Blob size equal to the original size."); }); |
| 83 tryPostMessage('blob.close(); blob', true, null, DOMException.DATA_CLONE_ERR); |
| 84 |
| 85 var constructedFile = new File(["Hello"], "test"); |
| 86 var fileSize = constructedFile.size; |
| 87 tryPostMessage('constructedFile', false, "evalThunk", function(v) { doPassFail(v
.size === fileSize, "Cloned File size equal to the original size."); }); |
| 88 tryPostMessage('constructedFile.close(); constructedFile', true, null, DOMExcept
ion.DATA_CLONE_ERR); |
| 89 |
78 function thunk(s) { | 90 function thunk(s) { |
79 return "(function() {" + s + "})()"; | 91 return "(function() {" + s + "})()"; |
80 } | 92 } |
81 tryPostMessage(thunk('return 42;'), false, '42'); | 93 tryPostMessage(thunk('return 42;'), false, '42'); |
82 tryPostMessage(thunk('return 42;'), false, thunk('return 40 + 2;')); | 94 tryPostMessage(thunk('return 42;'), false, thunk('return 40 + 2;')); |
83 tryPostMessage(thunk('return 42;'), false, "evalThunk", | 95 tryPostMessage(thunk('return 42;'), false, "evalThunk", |
84 function(v) { doPassFail(v == 42, "evalThunk OK"); }) | 96 function(v) { doPassFail(v == 42, "evalThunk OK"); }) |
85 | 97 |
86 // Only enumerable properties should be serialized. | 98 // Only enumerable properties should be serialized. |
87 tryPostMessage(thunk('var o = {x:"hello"}; Object.defineProperty(o, "y", {value:
"goodbye"}); return o;'), false, '({x:"hello"})'); | 99 tryPostMessage(thunk('var o = {x:"hello"}; Object.defineProperty(o, "y", {value:
"goodbye"}); return o;'), false, '({x:"hello"})'); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 doPassFail(v[0].length === window.fileList.length, "FileList length
sent correctly"); | 346 doPassFail(v[0].length === window.fileList.length, "FileList length
sent correctly"); |
335 doPassFail(v[0][0] !== v[1], "FileList should not respect reference
equality (0)"); | 347 doPassFail(v[0][0] !== v[1], "FileList should not respect reference
equality (0)"); |
336 doPassFail(v[0][1] !== v[2], "FileList should not respect reference
equality (1)"); | 348 doPassFail(v[0][1] !== v[2], "FileList should not respect reference
equality (1)"); |
337 doPassFail(v[0][0].name == window.file0.name, "FileList preserves or
der and data (name0)"); | 349 doPassFail(v[0][0].name == window.file0.name, "FileList preserves or
der and data (name0)"); |
338 doPassFail(v[0][1].name == window.file1.name, "FileList preserves or
der and data (name1)"); | 350 doPassFail(v[0][1].name == window.file1.name, "FileList preserves or
der and data (name1)"); |
339 doPassFail(equal(v[0][0].lastModifiedDate, window.file0.lastModified
Date), "FileList preserves order and data (date0)"); | 351 doPassFail(equal(v[0][0].lastModifiedDate, window.file0.lastModified
Date), "FileList preserves order and data (date0)"); |
340 doPassFail(equal(v[0][1].lastModifiedDate, window.file1.lastModified
Date), "FileList preserves order and data (date1)"); | 352 doPassFail(equal(v[0][1].lastModifiedDate, window.file1.lastModified
Date), "FileList preserves order and data (date1)"); |
341 }); | 353 }); |
342 } | 354 } |
343 tryPostMessage('"done"'); | 355 tryPostMessage('"done"'); |
OLD | NEW |