| <!DOCTYPE html> |
| <script src="../../../resources/js-test.js"></script> |
| <script> |
| window.jsTestIsAsync = true; |
| var mutations; |
| |
| function testFilesystem() { |
| var div; |
| var fileEntry; |
| var observer; |
| |
| function start() { |
| mutations = null; |
| div = document.createElement('div'); |
| observer = new MutationObserver(function(m) { |
| mutations = m; |
| }); |
| |
| observer.observe(div, { attributes: true, characterData: true }); |
| |
| webkitRequestFileSystem(TEMPORARY, 5*1024*1024, function(fs) { |
| fs.root.getFile('foo.txt', {create: true, excluse: true}, function(entry) { |
| fileEntry = entry; |
| fileEntry.getParent(mutateAfterGetParent); |
| }); |
| }); |
| } |
| |
| function mutateAfterGetParent() { |
| div.setAttribute('foo', 'bar'); |
| fileEntry.remove(mutateAfterRemove); |
| } |
| |
| function mutateAfterRemove() { |
| shouldBe('mutations.length', '1'); |
| shouldBe('mutations[0].type', '"attributes"'); |
| shouldBe('mutations[0].attributeName', '"foo"'); |
| |
| mutations = null; |
| div.setAttribute('baz', 'bat'); |
| setTimeout(finish, 0); |
| } |
| |
| function finish() { |
| shouldBe('mutations.length', '1'); |
| shouldBe('mutations[0].type', '"attributes"'); |
| shouldBe('mutations[0].attributeName', '"baz"'); |
| |
| observer.disconnect(); |
| debug(''); |
| finishJSTest(); |
| } |
| |
| start(); |
| } |
| |
| description('Test that Mutation Records are delivered following FileSystem callbacks.'); |
| |
| testFilesystem(); |
| </script> |