michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let Cu = Components.utils; michael@0: michael@0: // Ideally we would use CrashTestUtils.jsm, but that's only available for michael@0: // xpcshell tests - so we just copy a ctypes crasher from it. michael@0: Cu.import("resource://gre/modules/ctypes.jsm"); michael@0: let crash = function() { // this will crash when called. michael@0: let zero = new ctypes.intptr_t(8); michael@0: let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t)); michael@0: badptr.contents michael@0: }; michael@0: michael@0: michael@0: TestHelper = { michael@0: init: function() { michael@0: addMessageListener("thumbnails-test:crash", this); michael@0: }, michael@0: michael@0: receiveMessage: function(msg) { michael@0: switch (msg.name) { michael@0: case "thumbnails-test:crash": michael@0: privateNoteIntentionalCrash(); michael@0: crash(); michael@0: break; michael@0: } michael@0: }, michael@0: } michael@0: michael@0: TestHelper.init();