1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-17 03:15:45 +01:00

Constify certain script global properties. Provide 'unload' method.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-05 05:31:13 -05:00
parent 4d7794d888
commit 60059bcbc3
2 changed files with 19 additions and 6 deletions

View File

@@ -154,7 +154,7 @@ var IO = Module("io", {
params = params || {};
let time = Date.now();
contexts.withSavedValues(["context"], function _source() {
return contexts.withSavedValues(["context"], function _source() {
contexts.context = null;
try {
var file = util.getFile(filename) || io.File(filename);
@@ -172,7 +172,8 @@ var IO = Module("io", {
// handle pure JavaScript files specially
if (/\.js$/.test(filename)) {
try {
dactyl.loadScript(uri.spec, Contexts.Script(file, params.group));
var context = Contexts.Script(file, params.group);
dactyl.loadScript(uri.spec, context);
dactyl.helpInitialized = false;
}
catch (e) {
@@ -190,7 +191,7 @@ var IO = Module("io", {
else if (/\.css$/.test(filename))
styles.registerSheet(uri.spec, false, true);
else {
let context = Contexts.Context(file, params.group);
context = Contexts.Context(file, params.group);
modules.commands.execute(file.read(), null, params.silent || "loud",
null, {
context: context,
@@ -206,6 +207,7 @@ var IO = Module("io", {
dactyl.echomsg("finished sourcing " + filename.quote(), 2);
dactyl.log("Sourced: " + filename, 3);
return context;
}
catch (e) {
if (!(e instanceof FailedAssertion))