test_basic.js (750B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 add_task(async function () { 5 Assert.ok("console" in this); 6 7 let p = new Promise(resolve => { 8 function consoleListener() { 9 addConsoleStorageListener(this); 10 } 11 12 consoleListener.prototype = { 13 observe(aSubject) { 14 let obj = aSubject.wrappedJSObject; 15 Assert.strictEqual(obj.arguments[0], 42, "Message received!"); 16 Assert.strictEqual(obj.ID, "jsm", "The ID is JSM"); 17 Assert.ok(obj.innerID.endsWith("test_basic.js"), "The innerID matches"); 18 19 removeConsoleStorageListener(this); 20 resolve(); 21 }, 22 }; 23 24 new consoleListener(); 25 }); 26 27 console.log(42); 28 await p; 29 });