forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1559244 - Step 1: make BrowserTestUtils@crashBrowser function wor…
…k with JSWindowActor. r=mconley Differential Revision: https://phabricator.services.mozilla.com/D37318 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
6 changed files
with
100 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
testing/mochitest/BrowserTestUtils/BrowserTestUtilsChild.jsm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* vim: set ts=2 sw=2 sts=2 et tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
"use strict"; | ||
|
||
var EXPORTED_SYMBOLS = ["BrowserTestUtilsChild"]; | ||
|
||
class BrowserTestUtilsChild extends JSWindowActorChild { | ||
receiveMessage(aMessage) { | ||
switch (aMessage.name) { | ||
case "BrowserTestUtils:CrashFrame": { | ||
// This is to intentionally crash the frame. | ||
// We crash by using js-ctypes and dereferencing | ||
// a bad pointer. The crash should happen immediately | ||
// upon loading this frame script. | ||
|
||
const { ctypes } = ChromeUtils.import( | ||
"resource://gre/modules/ctypes.jsm" | ||
); | ||
|
||
let dies = function() { | ||
ChromeUtils.privateNoteIntentionalCrash(); | ||
let zero = new ctypes.intptr_t(8); | ||
let badptr = ctypes.cast(zero, ctypes.PointerType(ctypes.int32_t)); | ||
badptr.contents; | ||
}; | ||
|
||
dump("\nEt tu, Brute?\n"); | ||
dies(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters