mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-06-11 05:08:51 +00:00
a680bdc637
Since these are just interpreted comments, there's 0 impact on actual code. This removes all lines that match /* vim: set(.*)tw=80: */ with S&R -- there are a few others scattered around which will be removed manually in a second part.
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
// Test that the we can see console messages from the add-on
|
|
|
|
const ADDON_ID = "browser_dbg_addon4@tests.mozilla.org";
|
|
const ADDON_PATH = "addon4.xpi";
|
|
|
|
function getCachedMessages(webConsole) {
|
|
let deferred = promise.defer();
|
|
webConsole.getCachedMessages(["ConsoleAPI"], (aResponse) => {
|
|
if (aResponse.error) {
|
|
deferred.reject(aResponse.error);
|
|
return;
|
|
}
|
|
deferred.resolve(aResponse.messages);
|
|
});
|
|
return deferred.promise;
|
|
}
|
|
|
|
function test() {
|
|
Task.spawn(function* () {
|
|
let addon = yield addTemporaryAddon(ADDON_PATH);
|
|
let addonDebugger = yield initAddonDebugger(ADDON_ID);
|
|
|
|
let webConsole = addonDebugger.webConsole;
|
|
let messages = yield getCachedMessages(webConsole);
|
|
is(messages.length, 1, "Should be one cached message");
|
|
is(messages[0].arguments[0].type, "object", "Should have logged an object");
|
|
is(messages[0].arguments[0].preview.ownProperties.msg.value, "Hello from the test add-on", "Should have got the right message");
|
|
|
|
let consolePromise = addonDebugger.once("console");
|
|
|
|
console.log("Bad message");
|
|
Services.obs.notifyObservers(null, "addon-test-ping", "");
|
|
|
|
let messageGrip = yield consolePromise;
|
|
is(messageGrip.arguments[0].type, "object", "Should have logged an object");
|
|
is(messageGrip.arguments[0].preview.ownProperties.msg.value, "Hello again", "Should have got the right message");
|
|
|
|
yield addonDebugger.destroy();
|
|
yield removeAddon(addon);
|
|
finish();
|
|
});
|
|
}
|