1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-29 07:45:46 +01:00

Use evalInSandbox for :js rather than the subscript loader so that we can preserve file names/line numbers.

This commit is contained in:
Kris Maglione
2010-10-04 21:33:39 -04:00
parent a21c2510e3
commit 2012279ad9
10 changed files with 46 additions and 53 deletions

View File

@@ -5,12 +5,21 @@
"use strict";
(function () {
const jsmodules = {}
const modules = { __proto__: jsmodules };
const BASE = "chrome://dactyl/content/";
function newContext(proto) {
let sandbox = Components.utils.Sandbox(window);
if (jsmodules.__proto__ != window)
jsmodules.__proto__ = window;
// Hack:
sandbox.Object = jsmodules.Object;
sandbox.Math = jsmodules.Math;
sandbox.__proto__ = proto || modules;
return sandbox;
}
const jsmodules = {};
const modules = { __proto__: jsmodules, jsmodules: jsmodules, newContext: newContext, window: window };
modules.modules = modules;
const BASE = "chrome://dactyl/content/";
const loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);