Bug 1275330 - Fix console.log error in event-emitter.js by importing Console.jsm r=jryans

MozReview-Commit-ID: 1CyZHRhQQs6

--HG--
extra : transplant_source : u%EF%BA%C8%12%89%92%CB%FC%A2%9F%CF%2B%04V%13%87%A0x%E6
This commit is contained in:
Matthew Wein 2016-07-07 16:17:43 -07:00
Родитель 717b6d148b
Коммит fbcca5fe45
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -21,6 +21,8 @@
return Cu.import("resource://gre/modules/Promise.jsm", {}).Promise.defer;
case "Services":
return Cu.import("resource://gre/modules/Services.jsm", {}).Services;
case "resource://gre/modules/Console.jsm":
return Cu.import("resource://gre/modules/Console.jsm", {});
case "chrome":
return {
Cu,
@ -38,6 +40,7 @@
// See comment in JSM module boilerplate when adding a new dependency.
const { components } = require("chrome");
const { console } = require("resource://gre/modules/Console.jsm");
const Services = require("Services");
const defer = require("devtools/shared/defer");
let loggingEnabled = true;

Просмотреть файл

@ -74,10 +74,25 @@
}
function onlyOnce() {
ok(!beenHere2, "\"once\" listner has been called once");
ok(!beenHere2, "\"once\" listener has been called once");
beenHere2 = true;
emitter.emit("onlyonce");
testThrowingExceptionInListener();
}
function testThrowingExceptionInListener() {
function throwListener() {
emitter.off("throw-exception");
throw {
toString: () => "foo",
stack: "bar",
};
}
emitter.on("throw-exception", throwListener);
emitter.emit("throw-exception");
killItWhileEmitting();
}