mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Bug 588563 - Add a ctypes global within the jetpack process, r=dwitte
--HG-- extra : rebase_source : 91334359c5b597f99bfce7c7a58af50e889bd19a
This commit is contained in:
parent
ff3599a552
commit
f98142c97e
@ -114,6 +114,9 @@ JetpackChild::Init(base::ProcessHandle aParentProcessHandle,
|
||||
JS_NewGlobalObject(mCx, const_cast<JSClass*>(&sGlobalClass));
|
||||
if (!implGlobal ||
|
||||
!JS_InitStandardClasses(mCx, implGlobal) ||
|
||||
#ifdef BUILD_CTYPES
|
||||
!JS_InitCTypesClass(mCx, implGlobal) ||
|
||||
#endif
|
||||
!JS_DefineFunctions(mCx, implGlobal,
|
||||
const_cast<JSFunctionSpec*>(sImplMethods)))
|
||||
return false;
|
||||
|
@ -14,7 +14,7 @@ function createJetpack(args)
|
||||
|
||||
if (!args.skipRegisterError)
|
||||
jp.registerReceiver("core:exception", function(msgName, e) {
|
||||
dump("Received exception from remote code: " + e + "\n");
|
||||
dump("Received exception from remote code: " + uneval(e) + "\n");
|
||||
do_check_true(false);
|
||||
});
|
||||
|
||||
|
7
js/jetpack/tests/unit/impl_jetpack_ctypes.js
Normal file
7
js/jetpack/tests/unit/impl_jetpack_ctypes.js
Normal file
@ -0,0 +1,7 @@
|
||||
const CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
|
||||
|
||||
registerReceiver("testCTypes", function(name, libdir) {
|
||||
var library = ctypes.open(libdir + '/' + CTYPES_TEST_LIB);
|
||||
let test_void_t = library.declare("test_void_t_cdecl", ctypes.default_abi, ctypes.void_t);
|
||||
sendMessage("onCTypesTested", test_void_t() === undefined);
|
||||
});
|
12
js/jetpack/tests/unit/test_jetpack_ctypes.js
Normal file
12
js/jetpack/tests/unit/test_jetpack_ctypes.js
Normal file
@ -0,0 +1,12 @@
|
||||
function run_test() {
|
||||
var jetpack = createJetpack({
|
||||
scriptFile: do_get_file("impl_jetpack_ctypes.js")
|
||||
});
|
||||
jetpack.registerReceiver("onCTypesTested", function(name, ok) {
|
||||
do_check_true(ok, "onCTypesTested");
|
||||
do_test_finished();
|
||||
});
|
||||
var jetpacktestdir = do_get_file('../../jsctypes-test/unit').path;
|
||||
jetpack.sendMessage("testCTypes", jetpacktestdir);
|
||||
do_test_pending();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user