Bug 1036297 - markupview updateNodeOuterHTML method jsdoc is incorrect and should return a promise, r=pbrosset

This commit is contained in:
Alexey Novak 2014-08-21 12:59:53 -04:00
Родитель 212b97550b
Коммит 6293339534
1 изменённых файлов: 13 добавлений и 9 удалений

Просмотреть файл

@ -857,29 +857,33 @@ MarkupView.prototype = {
},
/**
* Retrieve the index of a child within its parent's children collection.
* @param aNode The NodeFront to find the index of.
* Replace the outerHTML of any node displayed in the inspector with
* some other HTML code
* @param aNode node which outerHTML will be replaced.
* @param newValue The new outerHTML to set on the node.
* @param oldValue The old outerHTML that will be reverted to find the index of.
* @returns A promise that will be resolved with the integer index.
* If the child cannot be found, returns -1
* @param oldValue The old outerHTML that will be used if the user undos the update.
* @returns A promise that will resolve when the outer HTML has been updated.
*/
updateNodeOuterHTML: function(aNode, newValue, oldValue) {
let container = this.getContainer(aNode);
let container = this._containers.get(aNode);
if (!container) {
return;
return promise.reject();
}
let def = promise.defer();
this.getNodeChildIndex(aNode).then((i) => {
this._outerHTMLChildIndex = i;
this._outerHTMLNode = aNode;
container.undo.do(() => {
this.walker.setOuterHTML(aNode, newValue);
this.walker.setOuterHTML(aNode, newValue).then(def.resolve, def.reject);
}, () => {
this.walker.setOuterHTML(aNode, oldValue);
this.walker.setOuterHTML(aNode, oldValue).then(def.resolve, def.reject);
});
});
return def.promise;
},
/**