Fix for 52536, can't bookmark full page plugin. r=jag, kerz; a=hewitt

This commit is contained in:
ben%netscape.com 2001-03-13 07:05:39 +00:00
Родитель 28a5bd7c67
Коммит 73afe96e68
4 изменённых файлов: 23 добавлений и 11 удалений

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

@ -139,7 +139,8 @@
<broadcaster id="Browser:Home" oncommand="BrowserHome();"/>
<!-- Bookmarks Menu -->
<broadcaster id="Browser:AddBookmark" value="&addCurPageCmd.label;" oncommand="BookmarksUtils.addBookmarkToWindow(window._content);"/>
<broadcaster id="Browser:AddBookmark" value="&addCurPageCmd.label;"
oncommand="BookmarksUtils.addBookmarkForBrowser(document.getElementById('content').webNavigation);"/>
<broadcaster id="Browser:ManageBookmark" value="&manBookmarksCmd.label;" oncommand="BrowserEditBookmarks();" />
</broadcasterset>

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

@ -111,7 +111,7 @@
<menuitem id="context-bookmarkpage"
value="&bookmarkPageCmd.label;"
accesskey="&bookmarkPageCmd.accesskey;"
oncommand="BookmarksUtils.addBookmarkToWindow(window._content);"/>
oncommand="BookmarksUtils.addBookmarkForBrowser(document.getElementById('content').webNavigation);"/>
<menuitem id="context-bookmarklink"
value="&bookmarkLinkCmd.label;"
accesskey="&bookmarkLinkCmd.accesskey;"

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

@ -765,11 +765,22 @@ var BookmarksUtils = {
return krAnonymous;
},
addBookmarkToWindow: function (aWindow)
addBookmarkForBrowser: function (aDocShell)
{
var url = aWindow.location.href;
var title = aWindow.document.title || url;
var docCharset = aWindow.document.characterSet;
// 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 url = aDocShell.currentURI.spec;
var title, docCharset = null;
try {
title = aDocShell.document.title || url;
docCharset = aDocShell.document.characterSet;
}
catch (e) {
title = url;
}
this.addBookmark(url, title, docCharset);
},

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

@ -66,11 +66,11 @@ BookmarksPanelTree.prototype = {
addBookmark: function ()
{
// This looks evil, you'd think we'd want to find the most recent NAVIGATOR
// window and add a bookmark to the page loaded in that, but that's not the
// case. In mail/news, we want to bookmark the current mail message and in
// editor we want to bookmark the current document.
BookmarksUtils.addBookmarkToWindow(top._content);
// This is somewhat of a hack, and we'd like to parameterize this so that
// eventually we can bookmark mail messages and editor documents.
var contentArea = top.document.getElementById('content');
if (contentArea)
BookmarksUtils.addBookmarkForBrowser(contentArea.webNavigation);
},
manageBookmarks: function ()