summaryrefslogtreecommitdiffstats
path: root/application/palemoon
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-23 18:31:43 +0200
committerGitHub <noreply@github.com>2018-05-23 18:31:43 +0200
commit542da56e2c4f992afb50c4222dcf757c3a3e6a5c (patch)
tree9a35b5ddfaf84326e9b2831a8b2fb4e7061c56be /application/palemoon
parentfcd7ee3c886c435f178230b13d0b0cb0c9c40c53 (diff)
parent30cbf0b5adf28e5258f46baf26f5351d3a669655 (diff)
downloadUXP-542da56e2c4f992afb50c4222dcf757c3a3e6a5c.tar
UXP-542da56e2c4f992afb50c4222dcf757c3a3e6a5c.tar.gz
UXP-542da56e2c4f992afb50c4222dcf757c3a3e6a5c.tar.lz
UXP-542da56e2c4f992afb50c4222dcf757c3a3e6a5c.tar.xz
UXP-542da56e2c4f992afb50c4222dcf757c3a3e6a5c.zip
Merge pull request #379 from janekptacijarabaci/pm_places_livemark_add_1
[PALEMOON] [frontend vs backend] Places - fix: adding a livemark doesn't work correctly
Diffstat (limited to 'application/palemoon')
-rw-r--r--application/palemoon/components/places/content/bookmarkProperties.js32
1 files changed, 22 insertions, 10 deletions
diff --git a/application/palemoon/components/places/content/bookmarkProperties.js b/application/palemoon/components/places/content/bookmarkProperties.js
index 22bd51773..685ef57d2 100644
--- a/application/palemoon/components/places/content/bookmarkProperties.js
+++ b/application/palemoon/components/places/content/bookmarkProperties.js
@@ -61,6 +61,8 @@
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
const BOOKMARK_ITEM = 0;
const BOOKMARK_FOLDER = 1;
@@ -303,7 +305,7 @@ var BookmarkPropertiesPanel = {
* This method should be called by the onload of the Bookmark Properties
* dialog to initialize the state of the panel.
*/
- onDialogLoad: function BPP_onDialogLoad() {
+ onDialogLoad: Task.async(function* BPP_onDialogLoad() {
this._determineItemInfo();
document.title = this._getDialogTitle();
@@ -355,7 +357,7 @@ var BookmarkPropertiesPanel = {
acceptButton.disabled = this._readOnly;
break;
case ACTION_ADD:
- this._fillAddProperties();
+ yield this._fillAddProperties();
// if this is an uri related dialog disable accept button until
// the user fills an uri value.
if (this._itemType == BOOKMARK_ITEM)
@@ -380,7 +382,7 @@ var BookmarkPropertiesPanel = {
.addEventListener("input", this, false);
}
}
- },
+ }),
// nsIDOMEventListener
handleEvent: function BPP_handleEvent(aEvent) {
@@ -428,8 +430,8 @@ var BookmarkPropertiesPanel = {
forceReadOnly: this._readOnly });
},
- _fillAddProperties: function BPP__fillAddProperties() {
- this._createNewItem();
+ _fillAddProperties: Task.async(function* BPP__fillAddProperties() {
+ yield this._createNewItem();
// Edit the new item
gEditItemOverlay.initPanel(this._itemId,
{ hiddenRows: this._hiddenRows });
@@ -439,7 +441,7 @@ var BookmarkPropertiesPanel = {
var locationField = this._element("locationField");
if (locationField.value == "about:blank")
locationField.value = "";
- },
+ }),
// nsISupports
QueryInterface: function BPP_QueryInterface(aIID) {
@@ -637,7 +639,7 @@ var BookmarkPropertiesPanel = {
/**
* Dialog-accept code-path for creating a new item (any type)
*/
- _createNewItem: function BPP__getCreateItemTransaction() {
+ _createNewItem: Task.async(function* BPP__getCreateItemTransaction() {
var [container, index] = this._getInsertionPointDetails();
var txn;
@@ -647,12 +649,22 @@ var BookmarkPropertiesPanel = {
break;
case LIVEMARK_CONTAINER:
txn = this._getCreateNewLivemarkTransaction(container, index);
- break;
+ break;
default: // BOOKMARK_ITEM
txn = this._getCreateNewBookmarkTransaction(container, index);
}
PlacesUtils.transactionManager.doTransaction(txn);
- this._itemId = PlacesUtils.bookmarks.getIdForItemAt(container, index);
- }
+ // This is a temporary hack until we use PlacesTransactions.jsm
+ if (txn._promise) {
+ yield txn._promise;
+ }
+
+ let folderGuid = yield PlacesUtils.promiseItemGuid(container);
+ let bm = yield PlacesUtils.bookmarks.fetch({
+ parentGuid: folderGuid,
+ index: index
+ });
+ this._itemId = yield PlacesUtils.promiseItemId(bm.guid);
+ })
};