var runtime = Components.classes["@mozilla.org/xre/app-info;1"] .getService(Components.interfaces.nsIXULRuntime); var abi = runtime.OS + "_" + runtime.XPCOMABI; var lib_name; this.data_loc = ""; //================================================================== // Detect shared library name to load
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {interfaces: Ci,utils: Cu} = Components; | |
| Cu.import('resource://gre/modules/Services.jsm'); | |
| /*start - windowlistener*/ | |
| var windowListener = { | |
| //DO NOT EDIT HERE | |
| onOpenWindow: function (aXULWindow) { | |
| // Wait for the window to finish loading | |
| let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow); | |
| aDOMWindow.addEventListener("load", function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {classes: Cc, interfaces: Ci, utils: Cu} = Components; | |
| var myTimer = Cc['@mozilla.org/timer;1'].createInstance(Ci.nsITimer); | |
| var myTimerCookie; | |
| var myTimerInterval = 5000; | |
| // we need an nsITimerCallback compatible interface for the callbacks. | |
| var myTimerEvent = { | |
| notify: function(timer) { | |
| Cu.reportError('Timer Fired!'); | |
| //do stuff here, this stuff will finish and then timer will start countdown of myTimerInterval. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Cu.import('resource://gre/modules/ctypes.jsm'); | |
| /* | |
| * Alright then, lets start with copy array `a` into `b`, by reusing and modifying `memset`. | |
| * Note: memset refered to is found here: http://stackoverflow.com/questions/24466228/memset-has-no-dll-so-how-ctype-it | |
| */ | |
| function memcpy(dst, src, size) { | |
| for (var i = 0; i < size; ++i) { | |
| dst[i] = src[i]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Cu.import('resource://gre/modules/ctypes.jsm'); | |
| function doit() { | |
| try { | |
| _x11 = ctypes.open('libX11.so.6'); | |
| } catch (e) { | |
| try { | |
| var libName = ctypes.libraryName('X11'); | |
| } catch (e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sys/types.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| int main() { | |
| int fd; | |
| struct flock lock, savelock; | |
| printf("F_GETLK: %d\n", F_GETLK); |
OlderNewer