diff --git a/src/css/popup.css b/src/css/popup.css
index 6ba365daa..f3a2f175c 100644
--- a/src/css/popup.css
+++ b/src/css/popup.css
@@ -338,22 +338,26 @@ body.dirty #refresh:hover {
visibility: hidden;
}
-#saveRules {
+#saveflushButtonGroup {
+ display: none;
+ position: fixed;
+}
+#saveRules,
+#flushRules {
opacity: 0.7;
background-color: #444;
border-radius: 4px;
color: rgba(255, 255, 255, 0.8);
cursor: pointer;
- display: none;
font-size: 35px;
height: 35px;
padding: 8px;
- position: fixed;
text-align: center;
}
-#firewallContainer.dirty ~ #saveRules {
+#firewallContainer.dirty ~ #saveflushButtonGroup {
display: block;
}
-#firewallContainer.dirty ~ #saveRules:hover {
+#firewallContainer.dirty ~ #saveRules:hover,
+#firewallContainer.dirty ~ #flushRules:hover {
opacity: 1;
}
diff --git a/src/img/icons.svg b/src/img/icons.svg
index c9afc85a3..3bfa57963 100755
--- a/src/img/icons.svg
+++ b/src/img/icons.svg
@@ -4,6 +4,10 @@
save
+
+ trash
+
+
power
diff --git a/src/js/messaging.js b/src/js/messaging.js
index 1accb1132..424b62487 100644
--- a/src/js/messaging.js
+++ b/src/js/messaging.js
@@ -342,6 +342,14 @@ var onMessage = function(request, sender, callback) {
µb.savePermanentFirewallRules();
break;
+ case 'flushFirewallRules':
+ µb.sessionFirewall.copyRules(
+ µb.permanentFirewall,
+ request.srcHostname,
+ request.desHostnames
+ );
+ break;
+
case 'toggleFirewallRule':
µb.toggleFirewallRule(request);
response = getStats(request.tabId);
diff --git a/src/js/popup.js b/src/js/popup.js
index d21c77d4d..820093b14 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -47,7 +47,7 @@ document.getElementById('dfPane').style.setProperty(
// The padlock must be manually positioned:
// - It's vertical position depends on the height on the title bar.
-document.getElementById('saveRules').style.setProperty(
+document.getElementById('saveflushButtonGroup').style.setProperty(
'top',
(document.getElementById('gotoPrefs').getBoundingClientRect().bottom + 4) + 'px'
);
@@ -330,7 +330,7 @@ var buildAllFirewallRows = function() {
var updateDfButtonsPosition = function() {
var rect = document.getElementById('firewallContainer').getBoundingClientRect();
- document.getElementById('saveRules').style.setProperty('left', (rect.left + 4) + 'px');
+ document.getElementById('saveflushButtonGroup').style.setProperty('left', (rect.left + 4) + 'px');
};
/******************************************************************************/
@@ -654,6 +654,17 @@ var saveFirewallRules = function() {
/******************************************************************************/
+var flushFirewallRules = function() {
+ messager.send({
+ what: 'flushFirewallRules',
+ srcHostname: popupData.pageHostname,
+ desHostnames: popupData.hostnameDict
+ });
+ popupData.contentLastModified = -1;
+ uDom('#firewallContainer').removeClass('dirty');
+};
+
+/******************************************************************************/
// Poll for changes.
//
// I couldn't find a better way to be notified of changes which can affect
@@ -737,6 +748,7 @@ uDom.onLoad(function () {
uDom('h2').on('click', toggleFirewallPane);
uDom('#refresh').on('click', reloadTab);
uDom('#saveRules').on('click', saveFirewallRules);
+ uDom('#flushRules').on('click', flushFirewallRules);
uDom('[data-i18n="popupAnyRulePrompt"]').on('click', toggleMinimize);
});
diff --git a/src/popup.html b/src/popup.html
index b935cb364..b2759d774 100644
--- a/src/popup.html
+++ b/src/popup.html
@@ -35,7 +35,11 @@
-
+
+