Bug 1398114 - Intermittent failure in browser_privatebrowsing_placesTitleNoUpdate.js. r=standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 08 Sep 2017 14:40:03 +0200
changeset 429539 8b48ae67b5ce0e524c41b541c3c14ca2713b4320
parent 429538 100136657a8b3ddd959360a924ac1fafcfb43cec
child 429540 65d965324c8c073caeaaabd38ec1be289d833fab
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1398114
milestone57.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 1398114 - Intermittent failure in browser_privatebrowsing_placesTitleNoUpdate.js. r=standard8 MozReview-Commit-ID: 7mXQAuaZOwD
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
@@ -18,27 +18,29 @@ add_task(async function test() {
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
   registerCleanupFunction(async () => {
     await BrowserTestUtils.removeTab(tab);
   });
   info("Wait for a title change notification.");
   await promiseTitleChanged;
   await BrowserTestUtils.waitForCondition(async function() {
-    return (await PlacesUtils.history.fetch(TEST_URL)).title == TITLE_1;
-  }, "The title matches the orignal title after first visit");
+    let entry = await PlacesUtils.history.fetch(TEST_URL);
+    return entry && entry.title == TITLE_1;
+  }, "The title matches the original title after first visit");
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await PlacesTestUtils.addVisits({ uri: TEST_URL, title: TITLE_2 });
   info("Wait for a title change notification.");
   await promiseTitleChanged;
   await BrowserTestUtils.waitForCondition(async function() {
-    return (await PlacesUtils.history.fetch(TEST_URL)).title == TITLE_2;
-  }, "The title matches the orignal title after updating visit");
+    let entry = await PlacesUtils.history.fetch(TEST_URL);
+    return entry && entry.title == TITLE_2;
+  }, "The title matches the original title after updating visit");
 
   let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   registerCleanupFunction(async () => {
     await BrowserTestUtils.closeWindow(privateWin);
   });
   await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser, TEST_URL);
   // Wait long enough to be sure history didn't set a title.
   await new Promise(resolve => setTimeout(resolve, 1000));
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
@@ -26,35 +26,38 @@ add_task(async function test() {
     await BrowserTestUtils.closeWindow(win);
   });
 
   let promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
   await BrowserTestUtils.waitForCondition(async function() {
-    return (await PlacesUtils.history.fetch(TEST_URL)).title == "No Cookie";
+    let entry = await PlacesUtils.history.fetch(TEST_URL);
+    return entry && entry.title == "No Cookie";
   }, "The page should be loaded without any cookie for the first time");
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
   await BrowserTestUtils.waitForCondition(async function() {
-    return (await PlacesUtils.history.fetch(TEST_URL)).title == "Cookie";
+    let entry = await PlacesUtils.history.fetch(TEST_URL);
+    return entry && entry.title == "Cookie";
   }, "The page should be loaded with a cookie for the second time");
 
   await cleanup();
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
   await BrowserTestUtils.waitForCondition(async function() {
-    return (await PlacesUtils.history.fetch(TEST_URL)).title == "No Cookie";
+    let entry = await PlacesUtils.history.fetch(TEST_URL);
+    return entry && entry.title == "No Cookie";
   }, "The page should be loaded without any cookie again");
 
   // Reopen the page in a private browser window, it should not notify a title
   // change.
   let win2 = await BrowserTestUtils.openNewBrowserWindow({private: true});
   registerCleanupFunction(async () => {
     let promisePBExit = TestUtils.topicObserved("last-pb-context-exited");
     await BrowserTestUtils.closeWindow(win2);