Bug 767693 - [New Tab Page] need to save block list when unblocking a site; r=jaws

This commit is contained in:
Tim Taubert 2012-06-26 21:44:29 +02:00
parent 231eb879ca
commit 05954751b6
2 changed files with 24 additions and 5 deletions

View File

@ -17,6 +17,10 @@ function runTests() {
yield simulateDrop(1);
checkGrid("0,99p,1,2,3,4,5,6,7");
NewTabUtils.blockedLinks.resetCache();
yield addNewTabPageTab();
checkGrid("0,99p,1,2,3,4,5,6,7");
yield blockCell(1);
checkGrid("0,1,2,3,4,5,6,7,8");
}

View File

@ -211,7 +211,7 @@ let PinnedLinks = {
this.unpin(aLink);
this.links[aIndex] = aLink;
Storage.set("pinnedLinks", this.links);
this.save();
},
/**
@ -222,10 +222,17 @@ let PinnedLinks = {
let index = this._indexOfLink(aLink);
if (index != -1) {
this.links[index] = null;
Storage.set("pinnedLinks", this.links);
this.save();
}
},
/**
* Saves the current list of pinned links.
*/
save: function PinnedLinks_save() {
Storage.set("pinnedLinks", this.links);
},
/**
* Checks whether a given link is pinned.
* @params aLink The link to check.
@ -284,11 +291,10 @@ let BlockedLinks = {
*/
block: function BlockedLinks_block(aLink) {
this.links[aLink.url] = 1;
this.save();
// Make sure we unpin blocked links.
PinnedLinks.unpin(aLink);
Storage.set("blockedLinks", this.links);
},
/**
@ -296,8 +302,17 @@ let BlockedLinks = {
* @param aLink The link to unblock.
*/
unblock: function BlockedLinks_unblock(aLink) {
if (this.isBlocked(aLink))
if (this.isBlocked(aLink)) {
delete this.links[aLink.url];
this.save();
}
},
/**
* Saves the current list of blocked links.
*/
save: function BlockedLinks_save() {
Storage.set("blockedLinks", this.links);
},
/**