Bug 1486757 - Check that pageInfo is also valid in waitForAnnotation in downloads's head.js to avoid intermittents. r=paolo
authorMark Banner <standard8@mozilla.com>
Tue, 28 Aug 2018 13:54:34 +0000
changeset 481942 bcf51e940502c1d622857fc8632454b89ed7374a
parent 481941 f9d93a20e6d6c5c5fca0fa3309d96b3f2328714b
child 481943 1ac72ebb37efc717e7f5f41aa778b9dabfe9afb8
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerspaolo
bugs1486757
milestone63.0a1
Bug 1486757 - Check that pageInfo is also valid in waitForAnnotation in downloads's head.js to avoid intermittents. r=paolo Differential Revision: https://phabricator.services.mozilla.com/D4442
toolkit/components/downloads/test/unit/head.js
--- a/toolkit/components/downloads/test/unit/head.js
+++ b/toolkit/components/downloads/test/unit/head.js
@@ -584,17 +584,17 @@ function isValidDate(aDate) {
 
 /**
  * Waits for the download annotations to be set for the given page, required
  * because the addDownload method will add these to the database asynchronously.
  */
 function waitForAnnotation(sourceUriSpec, annotationName) {
   return TestUtils.waitForCondition(async () => {
     let pageInfo = await PlacesUtils.history.fetch(sourceUriSpec, {includeAnnotations: true});
-    return pageInfo.annotations.has(annotationName);
+    return pageInfo && pageInfo.annotations.has(annotationName);
   }, `Should have found annotation ${annotationName} for ${sourceUriSpec}`);
 }
 
 /**
  * Position of the first byte served by the "interruptible_resumable.txt"
  * handler during the most recent response.
  */
 var gMostRecentFirstBytePos;