mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1241892 - Make Page Info work for sidebar browser. r=florian
The modifications that were made in bug 1238180 assumed that gBrowser.selectedBrowser from the opening window context would be defined. This is true in normal browser tabs, but not so much in the sidebar browser. This patch makes it so that callers can supply a browser to override the assumption. MozReview-Commit-ID: FKSyl7WUu1V --HG-- extra : rebase_source : 54e163dc79c349fe84da4b9b3bab7f6462d82217
This commit is contained in:
parent
731d8bd1c6
commit
aabda2cf0f
@ -2322,7 +2322,8 @@ function BrowserViewSource(browser) {
|
||||
// initialTab - name of the initial tab to display, or null for the first tab
|
||||
// imageElement - image to load in the Media Tab of the Page Info window; can be null/omitted
|
||||
// frameOuterWindowID - the id of the frame that the context menu opened in; can be null/omitted
|
||||
function BrowserPageInfo(documentURL, initialTab, imageElement, frameOuterWindowID) {
|
||||
// browser - the browser containing the document we're interested in inspecting; can be null/omitted
|
||||
function BrowserPageInfo(documentURL, initialTab, imageElement, frameOuterWindowID, browser) {
|
||||
if (documentURL instanceof HTMLDocument) {
|
||||
Deprecated.warning("Please pass the location URL instead of the document " +
|
||||
"to BrowserPageInfo() as the first argument.",
|
||||
@ -2330,7 +2331,7 @@ function BrowserPageInfo(documentURL, initialTab, imageElement, frameOuterWindow
|
||||
documentURL = documentURL.location;
|
||||
}
|
||||
|
||||
let args = { initialTab, imageElement, frameOuterWindowID };
|
||||
let args = { initialTab, imageElement, frameOuterWindowID, browser };
|
||||
var windows = Services.wm.getEnumerator("Browser:page-info");
|
||||
|
||||
documentURL = documentURL || window.gBrowser.selectedBrowser.currentURI.spec;
|
||||
|
@ -1110,14 +1110,12 @@ nsContextMenu.prototype = {
|
||||
},
|
||||
|
||||
viewInfo: function() {
|
||||
BrowserPageInfo();
|
||||
BrowserPageInfo(gContextMenuContentData.docLocation, null, null, null, this.browser);
|
||||
},
|
||||
|
||||
viewImageInfo: function() {
|
||||
// Don't need to pass in ownerDocument.defaultView.top.document here;
|
||||
// window.gBrowser.selectedBrowser.currentURI.spec does the job without
|
||||
// using CPOWs
|
||||
BrowserPageInfo(null, "mediaTab", this.target);
|
||||
BrowserPageInfo(gContextMenuContentData.docLocation, "mediaTab",
|
||||
this.target, null, this.browser);
|
||||
},
|
||||
|
||||
viewImageDesc: function(e) {
|
||||
@ -1130,7 +1128,7 @@ nsContextMenu.prototype = {
|
||||
|
||||
viewFrameInfo: function() {
|
||||
BrowserPageInfo(gContextMenuContentData.docLocation, null, null,
|
||||
this.frameOuterWindowID);
|
||||
this.frameOuterWindowID, this.browser);
|
||||
},
|
||||
|
||||
reloadImage: function() {
|
||||
|
@ -350,9 +350,10 @@ function onLoadPageInfo()
|
||||
.notifyObservers(window, "page-info-dialog-loaded", null);
|
||||
}
|
||||
|
||||
function loadPageInfo(frameOuterWindowID, imageElement)
|
||||
function loadPageInfo(frameOuterWindowID, imageElement, browser)
|
||||
{
|
||||
let mm = window.opener.gBrowser.selectedBrowser.messageManager;
|
||||
browser = browser || window.opener.gBrowser.selectedBrowser;
|
||||
let mm = browser.messageManager;
|
||||
|
||||
gStrings["application/rss+xml"] = gBundle.getString("feedRss");
|
||||
gStrings["application/atom+xml"] = gBundle.getString("feedAtom");
|
||||
@ -486,11 +487,11 @@ function loadTab(args)
|
||||
// If the "View Image Info" context menu item was used, the related image
|
||||
// element is provided as an argument. This can't be a background image.
|
||||
let imageElement = args && args.imageElement;
|
||||
|
||||
let frameOuterWindowID = args && args.frameOuterWindowID;
|
||||
let browser = args && args.browser;
|
||||
|
||||
/* Load the page info */
|
||||
loadPageInfo(frameOuterWindowID, imageElement);
|
||||
loadPageInfo(frameOuterWindowID, imageElement, browser);
|
||||
|
||||
var initialTab = (args && args.initialTab) || "generalTab";
|
||||
var radioGroup = document.getElementById("viewGroup");
|
||||
|
Loading…
Reference in New Issue
Block a user