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