|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 let Cu = Components.utils; |
|
5 |
|
6 // Ideally we would use CrashTestUtils.jsm, but that's only available for |
|
7 // xpcshell tests - so we just copy a ctypes crasher from it. |
|
8 Cu.import("resource://gre/modules/ctypes.jsm"); |
|
9 let crash = function() { // this will crash when called. |
|
10 let zero = new ctypes.intptr_t(8); |
|
11 let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t)); |
|
12 badptr.contents |
|
13 }; |
|
14 |
|
15 |
|
16 TestHelper = { |
|
17 init: function() { |
|
18 addMessageListener("thumbnails-test:crash", this); |
|
19 }, |
|
20 |
|
21 receiveMessage: function(msg) { |
|
22 switch (msg.name) { |
|
23 case "thumbnails-test:crash": |
|
24 privateNoteIntentionalCrash(); |
|
25 crash(); |
|
26 break; |
|
27 } |
|
28 }, |
|
29 } |
|
30 |
|
31 TestHelper.init(); |