summaryrefslogtreecommitdiffstats
path: root/toolkit/components
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-07-28 21:24:32 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-07-28 21:24:32 +0200
commit3170ee7692ef30ee67f26219b19b2b4115c01a56 (patch)
tree68c69d03e2e707d6c6c957e73942a638b8c50277 /toolkit/components
parent1545320721d22045168b1ca15f924f4143128512 (diff)
downloadUXP-3170ee7692ef30ee67f26219b19b2b4115c01a56.tar
UXP-3170ee7692ef30ee67f26219b19b2b4115c01a56.tar.gz
UXP-3170ee7692ef30ee67f26219b19b2b4115c01a56.tar.lz
UXP-3170ee7692ef30ee67f26219b19b2b4115c01a56.tar.xz
UXP-3170ee7692ef30ee67f26219b19b2b4115c01a56.zip
Hide and disable open_all/cut/copy/delete/properties when opening
bookmarks/history context menu with no selection This resolves #882 (by not offering options that can't be used)
Diffstat (limited to 'toolkit/components')
-rw-r--r--toolkit/components/places/PlacesUtils.jsm9
-rw-r--r--toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js1
2 files changed, 7 insertions, 3 deletions
diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm
index 323fa41a1..5f6e81f18 100644
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1341,7 +1341,7 @@ this.PlacesUtils = {
* The container node to search through.
* @returns true if the node contains uri nodes, false otherwise.
*/
- hasChildURIs: function PU_hasChildURIs(aNode) {
+ hasChildURIs: function PU_hasChildURIs(aNode, aMultiple=false) {
if (!this.nodeIsContainer(aNode))
return false;
@@ -1357,11 +1357,14 @@ this.PlacesUtils = {
root.containerOpen = true;
}
+ let foundFirst = !aMultiple;
let found = false;
for (let i = 0; i < root.childCount && !found; i++) {
let child = root.getChild(i);
- if (this.nodeIsURI(child))
- found = true;
+ if (this.nodeIsURI(child)) {
+ found = foundFirst;
+ foundFirst = true;
+ }
}
if (!wasOpen) {
diff --git a/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js b/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
index ecebce94a..3e2f88c21 100644
--- a/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
+++ b/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
@@ -165,6 +165,7 @@ function check_uri_nodes(aQuery, aOptions, aExpectedURINodes) {
root.containerOpen = true;
var node = root.getChild(0);
do_check_eq(PU.hasChildURIs(node), aExpectedURINodes > 0);
+ do_check_eq(PU.hasChildURIs(node, true), aExpectedURINodes > 1);
do_check_eq(PU.getURLsForContainerNode(node).length, aExpectedURINodes);
root.containerOpen = false;
}