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
--- 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()
{