addon-sdk/source/test/test-libxul.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/addon-sdk/source/test/test-libxul.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +// Test that we can link with libxul using js-ctypes
     1.9 +
    1.10 +const {Cu} = require("chrome");
    1.11 +const {ctypes} = Cu.import("resource://gre/modules/ctypes.jsm", {});
    1.12 +const {OS} = Cu.import("resource://gre/modules/osfile.jsm", {});
    1.13 +
    1.14 +exports.test = function(assert) {
    1.15 +  let path = OS.Constants.Path.libxul;
    1.16 +  assert.pass("libxul is at " + path);
    1.17 +  let lib = ctypes.open(path);
    1.18 +  assert.ok(lib != null, "linked to libxul successfully");
    1.19 +};
    1.20 +
    1.21 +require('test').run(exports);

mercurial