[Pkg-mozext-commits] [cookie-monster] 01/07: Imported Upstream version 1.2.5
David Prévot
taffit at moszumanska.debian.org
Fri May 1 02:28:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository cookie-monster.
commit f4fdf072d9a604953c78a7ea49cce4d8e8c8c34e
Author: David Prévot <david at tilapin.org>
Date: Thu Apr 30 21:50:31 2015 -0400
Imported Upstream version 1.2.5
---
chrome/cookiemonster.jar!/content/cookies.js | 149 +++++++++++++++++-----
chrome/cookiemonster.jar!/content/siteCookies.xul | 21 +--
install.rdf | 4 +-
3 files changed, 131 insertions(+), 43 deletions(-)
diff --git a/chrome/cookiemonster.jar!/content/cookies.js b/chrome/cookiemonster.jar!/content/cookies.js
index d1a7369..935fae5 100644
--- a/chrome/cookiemonster.jar!/content/cookies.js
+++ b/chrome/cookiemonster.jar!/content/cookies.js
@@ -1,7 +1,12 @@
-//@line 39 "e:\builds\moz2_slave\rel-m-rel-w32-bld\build\browser\components\preferences\cookies.js"
+/* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const nsICookie = Components.interfaces.nsICookie;
+Components.utils.import("resource://gre/modules/PluralForm.jsm");
+
var gSiteCookiesWindow = {
_cm : Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager),
@@ -39,7 +44,7 @@ var gSiteCookiesWindow = {
_populateList: function (aInitialLoad) {
this._loadCookies();
- this._tree.treeBoxObject.view = this._view;
+ this._tree.view = this._view;
if (aInitialLoad)
this.sort("rawHost");
if (this._view.rowCount > 0)
@@ -71,6 +76,8 @@ var gSiteCookiesWindow = {
this.filter();
}
+ this._updateRemoveAllButton();
+
this._saveState();
},
@@ -99,6 +106,7 @@ var gSiteCookiesWindow = {
this._view._rowCount = 0;
this._tree.treeBoxObject.rowCountChanged(0, -oldRowCount);
this._view.selection.clearSelection();
+ this._updateRemoveAllButton();
}
else if (aData == "reload") {
// first, clear any existing entries
@@ -189,7 +197,7 @@ var gSiteCookiesWindow = {
this._view._rowCount += rowCountImpact;
this._tree.treeBoxObject.rowCountChanged(oldRowCount - 1, rowCountImpact);
- document.getElementById("removeAllCookies").disabled = this._view._filtered;
+ this._updateRemoveAllButton();
},
_view: {
@@ -322,9 +330,9 @@ var gSiteCookiesWindow = {
_selection: null,
get selection () { return this._selection; },
set selection (val) { this._selection = val; return val; },
- getRowProperties: function (aIndex, aProperties) {},
- getCellProperties: function (aIndex, aColumn, aProperties) {},
- getColumnProperties: function (aColumn, aProperties) {},
+ getRowProperties: function (aIndex) { return ""; },
+ getCellProperties: function (aIndex, aColumn) { return ""; },
+ getColumnProperties: function (aColumn) { return ""; },
isContainer: function (aIndex) {
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
@@ -553,7 +561,7 @@ var gSiteCookiesWindow = {
},
onCookieSelected: function () {
- var properties, item;
+ var item;
var seln = this._tree.view.selection;
if (!this._view._filtered)
item = this._view._getItemAtIndex(seln.currentIndex);
@@ -570,27 +578,82 @@ var gSiteCookiesWindow = {
for (var j = min.value; j <= max.value; ++j) {
item = this._view._getItemAtIndex(j);
if (!item) continue;
- if (item.container && !item.open)
+ if (item.container)
selectedCookieCount += item.cookies.length;
else if (!item.container)
++selectedCookieCount;
}
}
- var item = this._view._getItemAtIndex(seln.currentIndex);
- if (item && seln.count == 1 && item.container && item.open)
- selectedCookieCount += 2;
- var removeCookie = document.getElementById("removeCookie");
- var removeCookies = document.getElementById("removeCookies");
- removeCookie.parentNode.selectedPanel =
- selectedCookieCount == 1 ? removeCookie : removeCookies;
+ let buttonLabel = this._bundle.getString("removeSelectedCookies");
+ let removeSelectedCookies = document.getElementById("removeSelectedCookies");
+ removeSelectedCookies.label = PluralForm.get(selectedCookieCount, buttonLabel)
+ .replace("#1", selectedCookieCount);
- document.getElementById("removeAllCookies").disabled = this._view._filtered;
- removeCookie.disabled = removeCookies.disabled = !(seln.count > 0);
+ removeSelectedCookies.disabled = !(seln.count > 0);
+ },
+
+ performDeletion: function gCookiesWindow_performDeletion(deleteItems) {
+ var psvc = Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch);
+ var blockFutureCookies = false;
+ if (psvc.prefHasUserValue("network.cookie.blockFutureCookies"))
+ blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
+ for (var i = 0; i < deleteItems.length; ++i) {
+ var item = deleteItems[i];
+ this._cm.remove(item.host, item.name, item.path, blockFutureCookies);
+ }
},
deleteCookie: function () {
-//@line 643 "e:\builds\moz2_slave\rel-m-rel-w32-bld\build\browser\components\preferences\cookies.js"
+ // Selection Notes
+ // - Selection always moves to *NEXT* adjacent item unless item
+ // is last child at a given level in which case it moves to *PREVIOUS*
+ // item
+ //
+ // Selection Cases (Somewhat Complicated)
+ //
+ // 1) Single cookie selected, host has single child
+ // v cnn.com
+ // //// cnn.com ///////////// goksdjf@ ////
+ // > atwola.com
+ //
+ // Before SelectedIndex: 1 Before RowCount: 3
+ // After SelectedIndex: 0 After RowCount: 1
+ //
+ // 2) Host selected, host open
+ // v goats.com ////////////////////////////
+ // goats.com sldkkfjl
+ // goat.scom flksj133
+ // > atwola.com
+ //
+ // Before SelectedIndex: 0 Before RowCount: 4
+ // After SelectedIndex: 0 After RowCount: 1
+ //
+ // 3) Host selected, host closed
+ // > goats.com ////////////////////////////
+ // > atwola.com
+ //
+ // Before SelectedIndex: 0 Before RowCount: 2
+ // After SelectedIndex: 0 After RowCount: 1
+ //
+ // 4) Single cookie selected, host has many children
+ // v goats.com
+ // goats.com sldkkfjl
+ // //// goats.com /////////// flksjl33 ////
+ // > atwola.com
+ //
+ // Before SelectedIndex: 2 Before RowCount: 4
+ // After SelectedIndex: 1 After RowCount: 3
+ //
+ // 5) Single cookie selected, host has many children
+ // v goats.com
+ // //// goats.com /////////// flksjl33 ////
+ // goats.com sldkkfjl
+ // > atwola.com
+ //
+ // Before SelectedIndex: 1 Before RowCount: 4
+ // After SelectedIndex: 1 After RowCount: 3
var seln = this._view.selection;
var tbo = this._tree.treeBoxObject;
@@ -638,7 +701,10 @@ var gSiteCookiesWindow = {
}
else {
var rangeCount = seln.getRangeCount();
- for (var i = 0; i < rangeCount; ++i) {
+ // Traverse backwards through selections to avoid messing
+ // up the indices when they are deleted.
+ // See bug 388079.
+ for (var i = rangeCount - 1; i >= 0; --i) {
var min = {}; var max = {};
seln.getRangeAt(i, min, max);
nextSelected = min.value;
@@ -655,15 +721,7 @@ var gSiteCookiesWindow = {
}
}
- var psvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- var blockFutureCookies = false;
- if (psvc.prefHasUserValue("network.cookie.blockFutureCookies"))
- blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
- for (i = 0; i < deleteItems.length; ++i) {
- var item = deleteItems[i];
- this._cm.remove(item.host, item.name, item.path, blockFutureCookies);
- }
+ this.performDeletion(deleteItems);
if (nextSelected < 0)
seln.clearSelection();
@@ -674,12 +732,28 @@ var gSiteCookiesWindow = {
},
deleteAllCookies: function () {
- this._cm.removeAll();
- this._tree.focus();
+ if (this._view._filtered) {
+ var rowCount = this._view.rowCount;
+ var deleteItems = [];
+ for (var index = 0; index < rowCount; index++) {
+ deleteItems.push(this._view._getItemAtIndex(index));
+ }
+ this._view._removeItemAtIndex(0, rowCount);
+ this._view._rowCount = 0;
+ this._tree.treeBoxObject.rowCountChanged(0, -rowCount);
+ this.performDeletion(deleteItems);
+ }
+ else {
+ this._cm.removeAll();
+ }
+ this._updateRemoveAllButton();
+ this.focusFilterBox();
},
onCookieKeyPress: function (aEvent) {
- if (aEvent.keyCode == 46)
+ if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
+//@line 723 "/build/buildd/firefox-37.0.1+build1/browser/components/preferences/cookies.js"
+ )
this.deleteCookie();
},
@@ -748,7 +822,7 @@ var gSiteCookiesWindow = {
// Just reload the list to make sure deletions are respected
this._loadCookies();
- this._tree.treeBoxObject.view = this._view;
+ this._tree.view = this._view;
// Restore sort order
var sortby = this._lastSortProperty;
@@ -775,6 +849,7 @@ var gSiteCookiesWindow = {
this._lastSelectedRanges = [];
document.getElementById("cookiesIntro").value = this._bundle.getString("cookiesAll");
+ this._updateRemoveAllButton();
},
_cookieMatchesFilter: function (aCookie) {
@@ -826,6 +901,10 @@ var gSiteCookiesWindow = {
}
},
+ _updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
+ document.getElementById("removeAllCookies").disabled = this._view._rowCount == 0;
+ },
+
filter: function () {
var filter = document.getElementById("filter").value;
if (filter == "") {
@@ -857,6 +936,7 @@ var gSiteCookiesWindow = {
// Display label for site cookies
document.getElementById("cookiesIntro").value = gSiteCookiesWindow._bundleExtra.getString("sitelabel") + ' ' + filter;
+ this._updateRemoveAllButton();
},
setFilter: function (aFilterString) {
@@ -868,5 +948,10 @@ var gSiteCookiesWindow = {
var filter = document.getElementById("filter");
filter.focus();
filter.select();
+ },
+
+ onWindowKeyPress: function (aEvent) {
+ if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
+ window.close();
}
};
diff --git a/chrome/cookiemonster.jar!/content/siteCookies.xul b/chrome/cookiemonster.jar!/content/siteCookies.xul
index b65c7b5..919a993 100644
--- a/chrome/cookiemonster.jar!/content/siteCookies.xul
+++ b/chrome/cookiemonster.jar!/content/siteCookies.xul
@@ -11,17 +11,17 @@
style="width: &window.width;"
onload="gSiteCookiesWindow.init();"
onunload="gSiteCookiesWindow.uninit();"
- persist="screenX screenY width height">
+ persist="screenX screenY width height"
+ onkeypress="gSiteCookiesWindow.onWindowKeyPress(event);">
- <script src="chrome://browser/content/preferences/permissionsutils.js"/>
+ <script src="chrome://global/content/treeUtils.js"/>
<script src="cookies.js"/>
<stringbundleset id="stringbundleset">
<stringbundle id="bundlePreferences"
- src="chrome://browser/locale/preferences/preferences.properties"/>
-
+ src="chrome://browser/locale/preferences/preferences.properties"/>
<stringbundle id="site-cookie-labels"
- src="chrome://cookiemonster/locale/siteCookies.properties"/>
+ src="chrome://cookiemonster/locale/siteCookies.properties"/>
</stringbundleset>
<keyset>
@@ -91,16 +91,19 @@
</vbox>
<hbox align="end">
<hbox class="actionButtons" flex="1">
- <deck oncommand="gSiteCookiesWindow.deleteCookie();">
+<!-- <deck oncommand="gSiteCookiesWindow.deleteCookie();">
<button id="removeCookie" disabled="true" icon="remove"
label="&button.removecookie.label;"
accesskey="&button.removecookie.accesskey;"/>
<button id="removeCookies" disabled="true" icon="remove"
label="&button.removecookies.label;"
accesskey="&button.removecookie.accesskey;"/>
- </deck>
- <button id="removeAllCookies" disabled="true" icon="clear"
- label="&button.removeallcookies.label;" accesskey="&button.removeallcookies.accesskey;"
+ </deck>-->
+ <button id="removeSelectedCookies" disabled="true" icon="clear"
+ accesskey="&button.removeSelectedCookies.accesskey;"
+ oncommand="gSiteCookiesWindow.deleteCookie();"/>
+ <button id="removeAllCookies" disabled="true" icon="clear"
+ label="&button.removeAllCookies.label;" accesskey="&button.removeAllCookies.accesskey;"
oncommand="gSiteCookiesWindow.deleteAllCookies();"/>
<spacer flex="1"/>
<button oncommand="close();" icon="close"
diff --git a/install.rdf b/install.rdf
index a14fb79..485c7b8 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>{45d8ff86-d909-11db-9705-005056c00008}</em:id>
- <em:version>1.2.0</em:version>
+ <em:version>1.2.5</em:version>
<em:type>2</em:type>
<em:optionsURL>chrome://cookiemonster/content/options.xul</em:optionsURL>
<!-- <em:iconURL>chrome://cookiemonster/skin/face-monkey.png</em:iconURL> -->
@@ -17,7 +17,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.5</em:minVersion>
- <em:maxVersion>30.*</em:maxVersion>
+ <em:maxVersion>39.*</em:maxVersion>
</Description>
</em:targetApplication>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/cookie-monster.git
More information about the Pkg-mozext-commits
mailing list