外部スクリプトの読み込み var Foo = "foo"; var Bar = "bar"; // 外部スクリプト読み込み var source = readFile("d:\\script.js", "UTF-8"); // 外部スクリプト実行 var sandbox = new Components.utils.Sandbox(window); sandbox.__proto__ = window; Components.utils.evalInSandbox(source, sandbox); // 外部スクリプトの実行結果を取得 sandbox.__proto__ = {}; for(let[key, value] in sandbox){ if(key == "Bar") continue; // Bar の上書きを拒否 window[key] = value; } print(