Bug 1264106 - Fix browser_ConsoleAPI_originAttributes.js permafail on DevEdition. r=baku
authorLuca Greco <lgreco@mozilla.com>
Wed, 13 Apr 2016 00:48:01 +0200
changeset 332162 9f720f8aea14dbbb20cec93a5bbe5591cce2e3d8
parent 332161 8c852c602947803ab731dc0dbb45994b60781360
child 332163 5c0f6e954333bd6fc1c6c2ad067284af4dca7caf
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1264106
milestone48.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 1264106 - Fix browser_ConsoleAPI_originAttributes.js permafail on DevEdition. r=baku - the test case was failing because of an additional error message which is logged only on DevEdition. - this patch makes the assertions on the cached messages more resilient to this kind of changes in the logged messages, by filtering the cached messages and then making assertions on the length of the messages found. MozReview-Commit-ID: GIPOkWzM9Bo
dom/tests/browser/browser_ConsoleAPI_originAttributes.js
--- a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js
+++ b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js
@@ -24,23 +24,23 @@ const ConsoleObserver = {
 
       is(consoleAPIMessage.arguments[0], EXPECTED_CONSOLE_MESSAGE_CONTENT,
          "the consoleAPIMessage contains the expected message");
 
       ok(consoleAPIMessage.originAttributes, "the consoleAPImessage contains originattributes");
       is(consoleAPIMessage.originAttributes.addonId, FAKE_ADDON_ID,
          "the consoleAPImessage's originAttributes contains the expected addonId");
 
-      let cachedMessages = ConsoleAPIStorage.getEvents();
-
-      is(cachedMessages.length, 1, "found one console api messsage as expected");
+      let cachedMessages = ConsoleAPIStorage.getEvents().filter((msg) => {
+        return msg.originAttributes && msg.originAttributes.addonId == FAKE_ADDON_ID;
+      });
 
-      ok(cachedMessages[0].originAttributes, "the consoleAPImessage contains originattributes");
-      is(cachedMessages[0].originAttributes.addonId, FAKE_ADDON_ID,
-         "the consoleAPImessage's originAttributes contains the expected addonId");
+      is(cachedMessages.length, 1, "found the expected cached console messages from the addon");
+      is(cachedMessages[0] && cachedMessages[0].originAttributes.addonId, FAKE_ADDON_ID,
+         "the cached message's originAttributes contains the expected addonId");
 
       finish();
     }
   }
 };
 
 function test()
 {