toolkit/components/thumbnails/test/thumbnails_crash_content_helper.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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();

mercurial