Bug 735139. (Av1a) Improve browser_pageInfo.js a little. r=dao.
authorSerge Gautherie <sgautherie.bz@free.fr>
Tue, 13 Mar 2012 17:57:14 +0100
changeset 88948 cf4978c2e32c340987a9258fe064e9a191d8a639
parent 88947 8d1c74566a0b94eecd626df143d56cf6d5237c66
child 88949 466c118c3e4417504b74f2199b758d1e43170f0f
push id22236
push usersgautherie.bz@free.fr
push dateTue, 13 Mar 2012 16:58:39 +0000
treeherdermozilla-central@cf4978c2e32c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs735139
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 735139. (Av1a) Improve browser_pageInfo.js a little. r=dao.
browser/base/content/test/browser_pageInfo.js
--- a/browser/base/content/test/browser_pageInfo.js
+++ b/browser/base/content/test/browser_pageInfo.js
@@ -1,46 +1,38 @@
 function test() {
   waitForExplicitFinish();
 
   var pageInfo;
+
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function () {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+  gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
+    gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
+
+    Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
     pageInfo = BrowserPageInfo();
-    Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
   }, true);
   content.location =
     "https://example.com/browser/browser/base/content/test/feed_tab.html";
 
   function observer(win, topic, data) {
-    if (topic != "page-info-dialog-loaded")
-      return;
-
-    Services.obs.removeObserver(observer, topic);
+    Services.obs.removeObserver(observer, "page-info-dialog-loaded");
     handlePageInfo();
   }
 
-  function $(aId) { return pageInfo.document.getElementById(aId) };
-
   function handlePageInfo() {
-    var feedTab = $("feedTab");
-    var feedListbox = $("feedListbox");
-
-    ok(feedListbox, "Feed list is null (feeds tab is broken)");
+    ok(pageInfo.document.getElementById("feedTab"), "Feed tab");
+    let feedListbox = pageInfo.document.getElementById("feedListbox");
+    ok(feedListbox, "Feed list");
 
     var feedRowsNum = feedListbox.getRowCount();
-
-    ok(feedRowsNum == 3, "Number of feeds listed: " +
-                         feedRowsNum + ", should be 3");
-
+    is(feedRowsNum, 3, "Number of feeds listed");
 
     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));
+      is(feedItem.getAttribute("name"), i + 1, "Feed name");
     }
 
     pageInfo.close();
     gBrowser.removeCurrentTab();
     finish();
   }
 }