зеркало из https://github.com/mozilla/gecko-dev.git
Bug 885246 - Remove usage of the sync history.getPageTitle API from BookmarkProperties.js. r=adw
MozReview-Commit-ID: KXhWKebkdvz --HG-- extra : rebase_source : 44fcdacb2fd031f14634b6f3033f8230e9a183ce
This commit is contained in:
Родитель
f6b7398a66
Коммит
144f004df2
|
@ -150,7 +150,7 @@ var BookmarkPropertiesPanel = {
|
|||
/**
|
||||
* Determines the initial data for the item edited or added by this dialog
|
||||
*/
|
||||
_determineItemInfo() {
|
||||
async _determineItemInfo() {
|
||||
let dialogInfo = window.arguments[0];
|
||||
this._action = dialogInfo.action == "add" ? ACTION_ADD : ACTION_EDIT;
|
||||
this._hiddenRows = dialogInfo.hiddenRows ? dialogInfo.hiddenRows : [];
|
||||
|
@ -178,7 +178,7 @@ var BookmarkPropertiesPanel = {
|
|||
"uri property should be a uri object");
|
||||
this._uri = dialogInfo.uri;
|
||||
if (typeof(this._title) != "string") {
|
||||
this._title = this._getURITitleFromHistory(this._uri) ||
|
||||
this._title = await PlacesUtils.history.fetch(this._uri) ||
|
||||
this._uri.spec;
|
||||
}
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ var BookmarkPropertiesPanel = {
|
|||
|
||||
if (!this._title) {
|
||||
if (this._feedURI) {
|
||||
this._title = this._getURITitleFromHistory(this._feedURI) ||
|
||||
this._title = await PlacesUtils.history.fetch(this._feedURI) ||
|
||||
this._feedURI.spec;
|
||||
} else
|
||||
this._title = this._strings.getString("newLivemarkDefault");
|
||||
|
@ -240,30 +240,12 @@ var BookmarkPropertiesPanel = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method returns the title string corresponding to a given URI.
|
||||
* If none is available from the bookmark service (probably because
|
||||
* the given URI doesn't appear in bookmarks or history), we synthesize
|
||||
* a title from the first 100 characters of the URI.
|
||||
*
|
||||
* @param aURI
|
||||
* nsIURI object for which we want the title
|
||||
*
|
||||
* @returns a title string
|
||||
*/
|
||||
_getURITitleFromHistory: function BPP__getURITitleFromHistory(aURI) {
|
||||
NS_ASSERT(aURI instanceof Ci.nsIURI);
|
||||
|
||||
// get the title from History
|
||||
return PlacesUtils.history.getPageTitle(aURI);
|
||||
},
|
||||
|
||||
/**
|
||||
* This method should be called by the onload of the Bookmark Properties
|
||||
* dialog to initialize the state of the panel.
|
||||
*/
|
||||
onDialogLoad() {
|
||||
this._determineItemInfo();
|
||||
async onDialogLoad() {
|
||||
await this._determineItemInfo();
|
||||
|
||||
document.title = this._getDialogTitle();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче