Bug 958167 - Use Inspector DevToolsUtils.makeInfallible in inspector actor instead of its own version. r=fitzgen
MozReview-Commit-ID: 4U7DCDFhQ6Y
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -75,16 +75,17 @@ const {
getFrameElement
} = require("devtools/shared/layout/utils");
const {getLayoutChangesObserver, releaseLayoutChangesObserver} =
require("devtools/server/actors/layout");
loader.lazyRequireGetter(this, "CSS", "CSS");
const {EventParsers} = require("devtools/shared/event-parsers");
+const { makeInfallible } = require("devtools/shared/DevToolsUtils");
const FONT_FAMILY_PREVIEW_TEXT = "The quick brown fox jumps over the lazy dog";
const FONT_FAMILY_PREVIEW_TEXT_SIZE = 20;
const PSEUDO_CLASSES = [":hover", ":active", ":focus"];
const HIDDEN_CLASS = "__fx-devtools-hide-shortcut__";
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const IMAGE_FETCHING_TIMEOUT = 500;
@@ -146,29 +147,16 @@ loader.lazyGetter(this, "DOMParser", fun
loader.lazyGetter(this, "eventListenerService", function () {
return Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
});
loader.lazyGetter(this, "CssLogic", () => require("devtools/shared/inspector/css-logic").CssLogic);
-// XXX: A poor man's makeInfallible until we move it out of transport.js
-// Which should be very soon.
-function makeInfallible(handler) {
- return function (...args) {
- try {
- return handler.apply(this, args);
- } catch(ex) {
- console.error(ex);
- }
- return undefined;
- };
-}
-
// A resolve that hits the main loop first.
function delayedResolve(value) {
let deferred = promise.defer();
Services.tm.mainThread.dispatch(makeInfallible(() => {
deferred.resolve(value);
}), 0);
return deferred.promise;
}