Bug 734043 - Error: node.parentNode is null when I click x button of thumbnail quickly in newTab page; r=dietrich

This commit is contained in:
Tim Taubert 2012-03-12 09:51:00 +01:00
Родитель e6a7befda0
Коммит af54c54e3a
4 изменённых файлов: 49 добавлений и 4 удалений

Просмотреть файл

@ -82,12 +82,17 @@ Site.prototype = {
/** /**
* Blocks the site (removes it from the grid) and calls the given callback * Blocks the site (removes it from the grid) and calls the given callback
* when done. * when done.
* @param aCallback The callback to be called when finished. * @param aCallback The function to be called when finished.
*/ */
block: function Site_block(aCallback) { block: function Site_block(aCallback) {
gBlockedLinks.block(this._link); if (gBlockedLinks.isBlocked(this._link)) {
gUpdater.updateGrid(aCallback); if (aCallback)
gPage.updateModifiedFlag(); aCallback();
} else {
gBlockedLinks.block(this._link);
gUpdater.updateGrid(aCallback);
gPage.updateModifiedFlag();
}
}, },
/** /**

Просмотреть файл

@ -23,6 +23,7 @@ _BROWSER_FILES = \
browser_newtab_bug722273.js \ browser_newtab_bug722273.js \
browser_newtab_bug723102.js \ browser_newtab_bug723102.js \
browser_newtab_bug723121.js \ browser_newtab_bug723121.js \
browser_newtab_bug734043.js \
head.js \ head.js \
$(NULL) $(NULL)

Просмотреть файл

@ -0,0 +1,27 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function runTests() {
setLinks("0,1,2,3,4,5,6,7,8");
setPinnedLinks("");
yield addNewTabPageTab();
let receivedError = false;
let block = cw.document.querySelector(".strip-button-block");
function onError() {
receivedError = true;
}
cw.addEventListener("error", onError);
for (let i = 0; i < 3; i++) {
EventUtils.synthesizeMouseAtCenter(block, {}, cw);
yield executeSoon(TestRunner.next);
}
yield whenPagesUpdated();
ok(!receivedError, "we got here without any errors");
cw.removeEventListener("error", onError);
}

Просмотреть файл

@ -265,3 +265,15 @@ function simulateDrop(aDropTarget, aDragSource) {
if (aDragSource) if (aDragSource)
cw.gDrag.end(aDragSource.site); cw.gDrag.end(aDragSource.site);
} }
/**
* Resumes testing when all pages have been updated.
*/
function whenPagesUpdated() {
NewTabUtils.allPages.register({
update: function () {
NewTabUtils.allPages.unregister(this);
executeSoon(TestRunner.next);
}
});
}