-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
this.add("downloadManager", "@mozilla.org/download-manager;1", "nsIDownloadManager");
this.add("environment", "@mozilla.org/process/environment;1", "nsIEnvironment");
this.add("extensionManager", "@mozilla.org/extensions/manager;1", "nsIExtensionManager");
- this.add("externalApp", "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher")
+ this.add("externalApp", "@mozilla.org/uriloader/external-helper-app-service;1", "nsPIExternalAppLauncher");
this.add("externalProtocol", "@mozilla.org/uriloader/external-protocol-service;1", "nsIExternalProtocolService");
this.add("favicon", "@mozilla.org/browser/favicon-service;1", "nsIFaviconService");
this.add("file:", this.PROTOCOL + "file", "nsIFileProtocolHandler");
this.add("focus", "@mozilla.org/focus-manager;1", "nsIFocusManager");
- this.add("history", "@mozilla.org/browser/global-history;2",
- ["nsIBrowserHistory", "nsIGlobalHistory2", "nsINavHistoryService", "nsPIPlacesDatabase"]);
+ this.add("history", "@mozilla.org/browser/nav-history-service;1",
+ ["nsIBrowserHistory", "nsINavHistoryService", "nsPIPlacesDatabase"]);
this.add("io", "@mozilla.org/network/io-service;1", "nsIIOService");
this.add("json", "@mozilla.org/dom/json;1", "nsIJSON", "createInstance");
this.add("listeners", "@mozilla.org/eventlistenerservice;1", "nsIEventListenerService");
this.addClass("Persist", "@mozilla.org/embedding/browser/nsWebBrowserPersist;1", "nsIWebBrowserPersist");
this.addClass("Pipe", "@mozilla.org/pipe;1", "nsIPipe", "init");
this.addClass("Process", "@mozilla.org/process/util;1", "nsIProcess", "init");
- this.addClass("Pump", "@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump", "init")
+ this.addClass("Pump", "@mozilla.org/network/input-stream-pump;1", "nsIInputStreamPump", "init");
this.addClass("StreamChannel","@mozilla.org/network/input-stream-channel;1",
["nsIInputStreamChannel", "nsIChannel"], "setURI");
this.addClass("StreamCopier", "@mozilla.org/network/async-stream-copier;1","nsIAsyncStreamCopier", "init");
if (!service.interfaces.length)
return res.wrappedJSObject || res;
- service.interfaces.forEach(function (iface) res.QueryInterface(Ci[iface]));
+ service.interfaces.forEach(function (iface) res instanceof Ci[iface]);
if (service.init && args.length) {
if (service.callable)
res[service.init].apply(res, args);
if (service.quiet === false)
throw e.stack ? e : Error(e);
- if (typeof util !== "undefined")
+ if (typeof util !== "undefined" && util != null)
util.reportError(e);
else
dump("dactyl: Service creation failed for '" + service.class + "': " + e + "\n" + (e.stack || Error(e).stack));
* class.
*/
addClass: function addClass(name, class_, ifaces, init, quiet) {
- const self = this;
this.services[name] = { class: class_, interfaces: Array.concat(ifaces || []), method: "createInstance", init: init, quiet: quiet };
if (init)
memoize(this.services[name], "callable",
function () callable(XPCOMShim(this.interfaces)[this.init]));
- this[name] = function Create() self._create(name, arguments);
+ this[name] = (function Create() this._create(name, arguments)).bind(this);
update.apply(null, [this[name]].concat([Ci[i] for each (i in Array.concat(ifaces))]));
return this[name];
},
} catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
-// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: