diff --git a/browser/components/places/content/editBookmarkOverlay.js b/browser/components/places/content/editBookmarkOverlay.js
index 1c29bc556df3..da5ea9d59805 100644
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -583,10 +583,10 @@ var gEditItemOverlay = {
tagsToAdd.push(tags[i]);
}
- if (tagsToAdd.length > 0)
- txns.push(PlacesUIUtils.ptm.tagURI(this._uri, tagsToAdd));
if (tagsToRemove.length > 0)
txns.push(PlacesUIUtils.ptm.untagURI(this._uri, tagsToRemove));
+ if (tagsToAdd.length > 0)
+ txns.push(PlacesUIUtils.ptm.tagURI(this._uri, tagsToAdd));
if (txns.length > 0) {
var aggregate = PlacesUIUtils.ptm.aggregateTransactions("Update tags",
diff --git a/browser/components/places/tests/chrome/Makefile.in b/browser/components/places/tests/chrome/Makefile.in
index 968a73976b53..e6632918663e 100644
--- a/browser/components/places/tests/chrome/Makefile.in
+++ b/browser/components/places/tests/chrome/Makefile.in
@@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk
_CHROME_TEST_FILES = \
test_treeview_date.xul \
test_editBookmarkOverlay.xul \
+ test_bug485100-change-case-loses-tag.xul \
$(NULL)
libs:: $(_CHROME_TEST_FILES)
diff --git a/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul b/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul
new file mode 100644
index 000000000000..01fc8a030dc3
--- /dev/null
+++ b/browser/components/places/tests/chrome/test_bug485100-change-case-loses-tag.xul
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %editBookmarkOverlayDTD;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+