Bug 825739 - Add logging for intermittent browser_bookmark_titles.js failure
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 18 Apr 2013 16:48:37 +0200
changeset 129203 c81d0474b833d7e46a979def2d9806d419f41d56
parent 129202 76fb1757892dbaf4f05fae5fedcb9b81418b62ba
child 129204 7610346a34ee15a2cc26a4726c59675111a97992
push id24562
push userryanvm@gmail.com
push dateFri, 19 Apr 2013 01:24:04 +0000
treeherdermozilla-central@f8d27fe5d7c0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs825739
milestone23.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 825739 - Add logging for intermittent browser_bookmark_titles.js failure
browser/base/content/test/browser_bookmark_titles.js
--- a/browser/base/content/test/browser_bookmark_titles.js
+++ b/browser/base/content/test/browser_bookmark_titles.js
@@ -19,17 +19,24 @@ let tests = [
      'https://untrusted.example.com/somepage.html']
 ];
 
 function generatorTest() {
     gBrowser.selectedTab = gBrowser.addTab();
     let browser = gBrowser.selectedBrowser;
     browser.stop(); // stop the about:blank load.
 
-    browser.addEventListener("DOMContentLoaded", nextStep, true);
+    browser.addEventListener("DOMContentLoaded", event => {
+        if (event.originalTarget != browser.contentDocument ||
+            event.target.location.href == "about:blank") {
+            info("skipping spurious load event");
+            return;
+        }
+        nextStep();
+    }, true);
     registerCleanupFunction(function () {
         browser.removeEventListener("DOMContentLoaded", nextStep, true);
         gBrowser.removeCurrentTab();
     });
 
     // Test that a bookmark of each URI gets the corresponding default title.
     for (let i = 0; i < tests.length; ++i) {
         let [uri, title] = tests[i];
@@ -61,16 +68,18 @@ function generatorTest() {
     is(content.document.documentURI.substring(0, 14), 'about:neterror',
         "Offline mode successfully simulated network outage.");
     checkBookmark(uri, title);
 }
 
 // Bookmark the current page and confirm that the new bookmark has the expected
 // title. (Then delete the bookmark.)
 function checkBookmark(uri, expected_title) {
+    is(gBrowser.selectedBrowser.currentURI.spec, uri,
+       "Trying to bookmark the expected uri");
     PlacesCommandHook.bookmarkCurrentPage(false);
 
     let id = PlacesUtils.getMostRecentBookmarkForURI(PlacesUtils._uri(uri));
     ok(id > 0, "Found the expected bookmark");
     let title = PlacesUtils.bookmarks.getItemTitle(id);
     is(title, expected_title, "Bookmark got a good default title.");
 
     PlacesUtils.bookmarks.removeItem(id);