Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue 5749 (Denying cookies for a specific path and accepting to

remove them deletes all cookies for a site)
http://code.google.com/p/fbug/issues/detail?id=5749
  • Loading branch information...
commit 70ed3a6d2dc1ee6130f65f3f1f53fd2c044d5537 1 parent fe488f5
Sebastian Zartner authored September 13, 2012
44  extension/content/firebug/cookies/cookieModule.js
@@ -676,6 +676,12 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
676 676
         return true;
677 677
     },
678 678
 
  679
+    /**
  680
+     * Removes cookies defined for a website
  681
+     * @param {Object} context context, in which the cookies are defined
  682
+     * @param {Object} [filter] filter to define, which cookies should be removed
  683
+     *   (format: {session: true/false, host: string})
  684
+     */
679 685
     removeCookies: function(context, filter)
680 686
     {
681 687
         var panel = context.getPanel(panelName, true);
@@ -690,10 +696,7 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
690 696
             {
691 697
                 var cookie = cookieEnumerator.getNext().QueryInterface(Ci.nsICookie2);
692 698
 
693  
-                var sessionCookieToRemove = filter && filter.session && cookie.isSession;
694  
-                var remove = !filter || sessionCookieToRemove;
695  
-
696  
-                if (remove && !cookies[cookie.name])
  699
+                if (!filter || ((!filter.session || cookie.isSession) && (!filter.host || filter.host == cookie.host)))
697 700
                     cookieManager.remove(cookie.host, cookie.name, cookie.path, false);
698 701
             }
699 702
         }
@@ -705,23 +708,23 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
705 708
         {
706 709
             var check = {value: false};
707 710
             var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +  
708  
-                prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;  
709  
-
  711
+            prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;  
  712
+            
710 713
             if (!prompts.confirmEx(context.chrome.window, Locale.$STR("Firebug"),
711 714
                 Locale.$STR("cookies.confirm.removeall"), flags, "", "", "",
712 715
                 Locale.$STR("cookies.msg.Do_not_show_this_message_again"), check) == 0)
713 716
             {
714 717
                 return;
715 718
             }
716  
-
  719
+            
717 720
             // Update 'Remove Cookies' confirmation option according to the value
718 721
             // of the dialog's "do not show again" checkbox.
719 722
             Options.set(removeConfirmation, !check.value);
720 723
         }
721  
-
  724
+        
722 725
         Firebug.CookieModule.removeCookies(context);
723 726
     },
724  
-
  727
+    
725 728
     onRemoveAllSession: function(context)
726 729
     {
727 730
         if (Options.get(removeSessionConfirmation))
@@ -745,6 +748,29 @@ Firebug.CookieModule = Obj.extend(Firebug.ActivableModule,
745 748
         Firebug.CookieModule.removeCookies(context, {session: true});
746 749
     },
747 750
 
  751
+    onRemoveAllFromHost: function(context, host)
  752
+    {
  753
+        if (Options.get(removeConfirmation))
  754
+        {
  755
+            var check = {value: false};
  756
+            var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_YES +  
  757
+                prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_NO;  
  758
+
  759
+            if (!prompts.confirmEx(context.chrome.window, Locale.$STR("Firebug"),
  760
+                Locale.$STRF("cookies.confirm.Remove_All_From_Host", [host]), flags, "", "", "",
  761
+                Locale.$STR("cookies.msg.Do_not_show_this_message_again"), check) == 0)
  762
+            {
  763
+                return;
  764
+            }
  765
+
  766
+            // Update 'Remove Cookies' confirmation option according to the value
  767
+            // of the dialog's "do not show again" checkbox.
  768
+            Options.set(removeConfirmation, !check.value);
  769
+        }
  770
+
  771
+        Firebug.CookieModule.removeCookies(context, {host: host});
  772
+    },
  773
+
748 774
     onCreateCookieShowTooltip: function(tooltip, context)
749 775
     {
750 776
         var host = context.window.location.host;
2  extension/content/firebug/cookies/cookiePermissions.js
@@ -154,7 +154,7 @@ var CookiePermissions = Obj.extend(Object,
154 154
 
155 155
             case "default-deny":
156 156
                 if (Options.get("cookies.clearWhenDeny"))
157  
-                    Firebug.CookieModule.onRemoveAll(context);
  157
+                    Firebug.CookieModule.onRemoveAllFromHost(context, location.host);
158 158
                 break;
159 159
         }
160 160
 
8  extension/locale/en-US/cookies.properties
@@ -65,14 +65,18 @@ cookies.PermissionsIntro=Choose web sites where Cookies panel will be enabled or
65 65
 cookies.SystemPages=System Pages
66 66
 cookies.LocalFiles=Local Files
67 67
 
68  
-# LOCALIZATION NOTE (cookies.confirm.removeall): Used in a confirmation dialog when cookies
69  
-# are going to be deleted deleted (or permission is set do deny and cookies should be deleted).
  68
+# LOCALIZATION NOTE (cookies.confirm.removeall): Used in a confirmation dialog when all cookies
  69
+# of a website are going to be deleted (or permission is set do deny and cookies should be deleted).
70 70
 cookies.confirm.removeall=Do you want to remove all cookies in the list?
71 71
 
72 72
 # LOCALIZATION NOTE (cookies.confirm.removeallsession): Used in a confirmation dialog when
73 73
 # all session cookies are going to be deleted
74 74
 cookies.confirm.removeallsession=Do you want to remove all session cookies in the list?
75 75
 
  76
+# LOCALIZATION NOTE (cookies.confirm.Remove_All_From_Host): Used in a confirmation dialog when cookies
  77
+# from a specific host are going to be deleted (or permission is set do deny and cookies should be deleted).
  78
+cookies.confirm.Remove_All_From_Host=Do you want to remove all cookies from %S?
  79
+
76 80
 # LOCALIZATION NOTE (cookies.msg.Do_not_show_this_message_again): 
77 81
 # Message within a confirmation dialog that is displayed when deleting cookies.
78 82
 # This message is displayed next to a check-box that can be used to disabled this

0 notes on commit 70ed3a6

Please sign in to comment.
Something went wrong with that request. Please try again.