You may also want to try to reset the javascript runtime interpreter, if you ran other script in the same session.
I think this can be done only from the script editor, Execute/Reset Javascript Runtime.
To my surprise the execution of the scripts are not independent, and most scripts think they have the global name space for themselves. They may even add definitions to some built in objects. In general this is not a problem (especially for relatively small scripts like PreviewAgregator), because the last one wins, but this can cause unexpected results especially if you have an errant script.
The impact can be demonstated by installing the two following scripts:
ShowGetGlobals.js:
"use strict";
// This is a test script
#feature-id Tests > ShowGetGlobal
#feature-info Show on the Console if the global variable 'pjsrTestGlobal' has some value
#define TITLE "ShowGetGlobal"
#define VERSION "1.0"
// Get a global variable to show execution context dependencies
Console.show();
if (typeof pjsrTestGlobal == "undefined") {
Console.writeln("Global variable pjsrTestGlobal is undefined");
} else {
Console.writeln("Global variable pjsrTestGlobal has value '" + pjsrTestGlobal + "'");
}
and ShowSetGlobal.js
"use strict";
// This a test script
#feature-id Tests > ShowSetGlobal
#feature-info Set the global variable 'pjsrTestGlobal' to some value
#define TITLE "ShowSetGlobal"
#define VERSION "1.0"
// Set a global variable to show execution context dependencies
Console.show();
var pjsrTestGlobal = "Some string";
Console.writeln("Global variable pjsrTestGlobal set to '" + pjsrTestGlobal + "'");
Execute ShowGetGlobal to see that the global variable is not defined, then ShowSetGlobal to set it, and ShowGetGlobal to show that it persisted across script execution. Reset the script runtime and run ShowGetGlobal to see that the global variable was indeed removed. You can make the same test directly in the editor, without installing the script, but I wanted to test if the same happened for scripts launched from the Script menu.
This may not be your problem, but reseting the Javascript runtime is worth trying in case of really bizarre behavior of a script.
-- bitli
PS to Juan: An option to reset the script engine at each script execution to be in the safe side, especially when developing?