1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-03 14:05:47 +01:00

Another stab at nuking bootstrap.js sandbox at shutdown. We'll see how this goes...

This commit is contained in:
Kris Maglione
2014-02-16 16:55:01 -08:00
parent 70a5fc23ed
commit 08e00164b2
3 changed files with 13 additions and 6 deletions

9
common/bootstrap.js vendored
View File

@@ -1,4 +1,4 @@
// Copyright (c) 2010-2011 by Kris Maglione <maglione.k@gmail.com> // Copyright (c) 2010-2014 by Kris Maglione <maglione.k@gmail.com>
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
@@ -63,7 +63,7 @@ let resources = [];
let getURI = null; let getURI = null;
let JSMLoader = { let JSMLoader = {
SANDBOX: Cu.nukeSandbox && false, SANDBOX: Cu.nukeSandbox,
get addon() addon, get addon() addon,
@@ -426,10 +426,11 @@ function shutdown(data, reason) {
JSMLoader.atexit(strReason); JSMLoader.atexit(strReason);
JSMLoader.cleanup(strReason); JSMLoader.cleanup(strReason);
bootstrap_jsm.require = null;
if (JSMLoader.SANDBOX) if (JSMLoader.SANDBOX)
Cu.nukeSandbox(bootstrap); Cu.nukeSandbox(bootstrap);
bootstrap_jsm.require = null; else
Cu.unload(BOOTSTRAP); Cu.unload(BOOTSTRAP);
bootstrap = null; bootstrap = null;
bootstrap_jsm = null; bootstrap_jsm = null;

View File

@@ -313,7 +313,9 @@ function iterOwnProperties(obj) {
function deprecated(alternative, fn) { function deprecated(alternative, fn) {
if (isObject(fn)) if (isObject(fn))
return Class.Property(iter(fn).map(([k, v]) => [k, callable(v) ? deprecated(alternative, v) : v]) return Class.Property(iter(fn).map(([k, v]) => [k,
callable(v) ? deprecated(alternative, v)
: v])
.toObject()); .toObject());
let name, let name,
@@ -331,6 +333,8 @@ function deprecated(alternative, fn) {
alternative); alternative);
return func.apply(this, arguments); return func.apply(this, arguments);
} }
if (func.name)
deprecatedMethod.realName = func.name;
return callable(fn) ? deprecatedMethod : Class.Property({ return callable(fn) ? deprecatedMethod : Class.Property({
get: function () deprecatedMethod, get: function () deprecatedMethod,

View File

@@ -826,8 +826,10 @@ var JavaScript = Module("javascript", {
leave: function leave(params) { leave: function leave(params) {
leave.superapply(this, arguments); leave.superapply(this, arguments);
if (!params.push) if (!params.push) {
modes.delay(function () { modes.pop(); }); modes.delay(function () { modes.pop(); });
Cu.nukeSandbox(this.context);
}
}, },
updatePrompt: function updatePrompt() { updatePrompt: function updatePrompt() {