Bug 1067042 - [e10s] Show page title in bookmark UI (r=mak)

This commit is contained in:
Bill McCloskey 2015-03-28 15:24:16 -07:00
parent 5f1aaf0af6
commit 930b301100

View File

@ -274,25 +274,18 @@ var PlacesCommandHook = {
var uri = aBrowser.currentURI;
var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri);
if (itemId == -1) {
// Copied over from addBookmarkForBrowser:
// Bug 52536: We obtain the URL and title from the nsIWebNavigation
// associated with a <browser/> rather than from a DOMWindow.
// This is because when a full page plugin is loaded, there is
// no DOMWindow (?) but information about the loaded document
// may still be obtained from the webNavigation.
var webNav = aBrowser.webNavigation;
var url = webNav.currentURI;
// Bug 1148838 - Make this code work for full page plugins.
var title;
var description;
var charset;
try {
let isErrorPage = /^about:(neterror|certerror|blocked)/
.test(webNav.document.documentURI);
title = isErrorPage ? PlacesUtils.history.getPageTitle(url)
: webNav.document.title;
title = title || url.spec;
description = PlacesUIUtils.getDescriptionFromDocument(webNav.document);
charset = webNav.document.characterSet;
.test(aBrowser.contentDocumentAsCPOW.documentURI);
title = isErrorPage ? PlacesUtils.history.getPageTitle(uri)
: aBrowser.contentTitle;
title = title || uri.spec;
description = PlacesUIUtils.getDescriptionFromDocument(aBrowser.contentDocumentAsCPOW);
charset = aBrowser.characterSet;
}
catch (e) { }