blob: 648641c1c873b89ab176375cb41d5d221f977812 [file] [log] [blame]
Jeff Thompson745026e2012-10-13 12:49:20 -07001/* This file is created by running make-ndn-js.jsm.sh in this directory.
2 * It concatenates ndn-js-header.txt with all the ndn-js source files to
3 * make ndn-js.jsm .
Jeff Thompsone9f11942012-12-09 12:36:24 -08004 * The file ../../tools/build/ndn-js.js must already be built.
Jeff Thompson146d7de2012-11-17 16:15:28 -08005 * author: Jeff Thompson
Jeff Thompson745026e2012-10-13 12:49:20 -07006 * See COPYING for copyright and distribution information.
Jeff Thompson08ab3cd2012-10-08 02:56:20 -07007 */
8
Jeff Thompson6ac75d22013-02-04 22:41:34 -08009var EXPORTED_SYMBOLS = ["Closure", "ContentObject", "DataUtils", "Exclude", "Interest", "MimeTypes", "NDN",
Jeff Thompson963d2da2012-12-02 23:31:22 -080010 "Name", "Sha256", "XpcomTransport"];
Jeff Thompson08ab3cd2012-10-08 02:56:20 -070011
12Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
13Components.utils.import("resource://gre/modules/NetUtil.jsm");
14
Jeff Thompson08ab3cd2012-10-08 02:56:20 -070015// jsbn.js needs the navigator object which isn't defined in XPCOM, so make a local hack.
16var navigator = {
17 appName: "Netscape"
18};
19
20// Some code calls console.log without checking LOG>0. Until this is cleaned up, make a local hack console.
21var console = {
22 log: function(message) {
23 dump(message + "\n");
24 }
25};
26
Jeff Thompsone4c36142012-12-14 00:56:53 -080027// The NDN class uses setTimeout and clearTimeout, so define them using XPCOM.
28function setTimeout(callback, delay) {
29 var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
30 timer.initWithCallback({notify: callback}, delay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
31 return timer;
32}
33
34function clearTimeout(timer) {
35 timer.cancel();
36}