Bug 1175794 - Rename and cleanup pageinfo code. r=florian

This commit is contained in:
Jimmy Wang 2015-08-13 03:37:02 -04:00
parent c1fc3459bc
commit e6f347f498
3 changed files with 11 additions and 11 deletions

View File

@ -2413,7 +2413,7 @@ function BrowserPageInfo(doc, initialTab, imageElement, frameOuterWindowID) {
frameOuterWindowID: frameOuterWindowID};
var windows = Services.wm.getEnumerator("Browser:page-info");
var documentURL = doc ? doc.location : window.gBrowser.selectedBrowser.contentDocumentAsCPOW.location;
var documentURL = doc ? doc.location : window.gBrowser.selectedBrowser.currentURI.spec;
// Check for windows matching the url
while (windows.hasMoreElements()) {

View File

@ -38,8 +38,8 @@ XPCOMUtils.defineLazyGetter(this, "PageMenuChild", function() {
Cu.import("resource://gre/modules/PageMenu.jsm", tmp);
return new tmp.PageMenuChild();
});
XPCOMUtils.defineLazyModuleGetter(this, "Feeds", "resource:///modules/Feeds.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Feeds",
"resource:///modules/Feeds.jsm");
// TabChildGlobal
var global = this;
@ -849,10 +849,10 @@ addMessageListener("ContextMenu:SetAsDesktopBackground", (message) => {
sendAsyncMessage("ContextMenu:SetAsDesktopBackground:Result", { disable });
});
let pageInfoListener = {
let PageInfoListener = {
init: function(chromeGlobal) {
chromeGlobal.addMessageListener("PageInfo:getData", this, false, true);
init: function() {
addMessageListener("PageInfo:getData", this);
},
receiveMessage: function(message) {
@ -974,7 +974,7 @@ let pageInfoListener = {
if (window && window.frames.length > 0) {
let num = window.frames.length;
for (let i = 0; i < num; i++) {
// recurse through the frames
// Recurse through the frames.
frameList.concat(this.goThroughFrames(window.frames[i].document,
window.frames[i]));
}
@ -1124,7 +1124,7 @@ let pageInfoListener = {
}
}
// if we have a data url, get the MIME type from the url
// If we have a data url, get the MIME type from the url.
if (!result.mimeType && url.startsWith("data:")) {
let dataMimeType = /^data:(image\/[^;,]+)/i.exec(url);
if (dataMimeType)
@ -1224,4 +1224,4 @@ let pageInfoListener = {
return text.replace(endRE, "");
}
};
pageInfoListener.init(this);
PageInfoListener.init();

View File

@ -376,8 +376,8 @@ function loadPageInfo(frameOuterWindowID)
docInfo.documentURIObject.originCharset);
gDocInfo = docInfo;
var titleFormat = windowInfo.isTopWindow ? "pageInfo.frame.title"
: "pageInfo.page.title";
var titleFormat = windowInfo.isTopWindow ? "pageInfo.page.title"
: "pageInfo.frame.title";
document.title = gBundle.getFormattedString(titleFormat, [docInfo.location]);
document.getElementById("main-window").setAttribute("relatedUrl", docInfo.location);