Bug 458579 - Feed tab missing in page info; r=gavin.sharp

This commit is contained in:
Natch 2008-10-29 04:37:44 +01:00
parent ff1e525b62
commit f0960b87c7
5 changed files with 84 additions and 8 deletions

View File

@ -1940,11 +1940,11 @@ function BrowserViewSourceOfDocument(aDocument)
function BrowserPageInfo(doc, initialTab)
{
var args = {doc: doc, initialTab: initialTab};
toOpenDialogByTypeAndUrl("Browser:page-info",
doc ? doc.location : window.content.document.location,
"chrome://browser/content/pageinfo/pageInfo.xul",
"chrome,toolbar,dialog=no,resizable",
args);
return toOpenDialogByTypeAndUrl("Browser:page-info",
doc ? doc.location : window.content.document.location,
"chrome://browser/content/pageinfo/pageInfo.xul",
"chrome,toolbar,dialog=no,resizable",
args);
}
#ifdef DEBUG
@ -3065,9 +3065,9 @@ function toOpenDialogByTypeAndUrl(inType, relatedUrl, windowUri, features, extra
// We didn't find a matching window, so open a new one.
if (features)
window.openDialog(windowUri, "_blank", features, extraArgument);
else
window.openDialog(windowUri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", extraArgument);
return window.openDialog(windowUri, "_blank", features, extraArgument);
return window.openDialog(windowUri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", extraArgument);
}
function OpenBrowserWindow()

View File

@ -313,6 +313,9 @@ function onLoadPageInfo()
radioGroup.selectedItem = initialTab;
radioGroup.selectedItem.doCommand();
radioGroup.focus();
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "page-info-dialog-loaded", null);
}
function loadPageInfo()

View File

@ -70,6 +70,8 @@ _BROWSER_FILES = browser_bug321000.js \
browser_ctrlTab.js \
browser_selectTabAtIndex.js \
browser_gestureSupport.js \
browser_feed_tab.js \
feed_tab.html \
$(NULL)
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))

View File

@ -0,0 +1,54 @@
function test() {
waitForExplicitFinish();
var pageInfo, obs;
var gTestPage = gBrowser.addTab();
gBrowser.selectedTab = gTestPage;
gTestPage.linkedBrowser.addEventListener("load", handleLoad, true);
content.location =
"http://localhost:8888/browser/browser/base/content/test/feed_tab.html";
gTestPage.focus();
var observer = {
observe: function(win, topic, data) {
if (topic != "page-info-dialog-loaded")
return;
obs.removeObserver(observer, "page-info-dialog-loaded");
handlePageInfo();
}
};
function handleLoad() {
pageInfo = BrowserPageInfo();
obs = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
obs.addObserver(observer, "page-info-dialog-loaded", false);
}
function handlePageInfo() {
function $(aId) { return pageInfo.document.getElementById(aId) };
var feedTab = $("feedTab");
var feedListbox = $("feedListbox");
ok(feedListbox, "Feed list is null (feeds tab is broken)");
var feedRowsNum = feedListbox.getRowCount();
ok(feedRowsNum == 3, "Number of feeds listed: " +
feedRowsNum + ", should be 3");
for (var i = 0; i < feedRowsNum; i++) {
let feedItem = feedListbox.getItemAtIndex(i);
ok(feedItem.getAttribute("name") == (i+1),
"Name given: " + feedItem.getAttribute("name") + ", should be " + (i+1));
}
pageInfo.close();
gTestPage.focus();
gBrowser.removeCurrentTab();
finish();
}
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=458579
-->
<head>
<title>Test for page info feeds tab</title>
<!-- Straight up standard -->
<link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" />
<link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" />
<link rel="feed" title="3" href="/3.xml" />
</head>
<body>
</body>
</html>