47 lines
1.1 KiB
HTML
47 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<script src="../../../resources/js-test-pre.js"></script>
|
|
<script>
|
|
window.jsTestIsAsync = true;
|
|
var mutations;
|
|
|
|
function testDatabase() {
|
|
var div;
|
|
var db;
|
|
var observer;
|
|
|
|
function start() {
|
|
mutations = null;
|
|
div = document.createElement('div');
|
|
observer = new MutationObserver(function(m) {
|
|
mutations = m;
|
|
});
|
|
|
|
observer.observe(div, { attributes: true, characterData: true });
|
|
|
|
db = openDatabase('DatabaseMutationDelivery', '1.0', '', 1);
|
|
db.transaction(mutate);
|
|
}
|
|
|
|
function mutate() {
|
|
div.setAttribute('foo', 'bar');
|
|
setTimeout(finish, 0);
|
|
}
|
|
|
|
function finish() {
|
|
shouldBe('mutations.length', '1');
|
|
shouldBe('mutations[0].type', '"attributes"');
|
|
shouldBe('mutations[0].attributeName', '"foo"');
|
|
observer.disconnect();
|
|
debug('');
|
|
finishJSTest();
|
|
}
|
|
|
|
start();
|
|
}
|
|
|
|
description('Testing mutations are delivered following Database transaction callbacks.');
|
|
|
|
testDatabase();
|
|
</script>
|
|
<script src="../../../resources/js-test-post.js"></script>
|