root-jscomponentloader-script
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 65 5674a3e586f318223a76af5d678101ee58d80805
permissions -rw-r--r--
State as of now

diff --git a/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/js/src/xpconnect/loader/mozJSComponentLoader.cpp
--- a/js/src/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/src/xpconnect/loader/mozJSComponentLoader.cpp
@@ -740,17 +740,6 @@ class JSPrincipalsHolder
     JSPrincipals *mPrincipals;
 };
 
-class JSScriptHolder
-{
- public:
-    JSScriptHolder(JSContext *cx, JSScript *script)
-        : mCx(cx), mScript(script) {}
-    ~JSScriptHolder() { ::JS_DestroyScript(mCx, mScript); }
- private:
-    JSContext *mCx;
-    JSScript *mScript;
-};
-
 class FastLoadStateHolder
 {
  public:
@@ -1219,8 +1208,7 @@ mozJSComponentLoader::GlobalForLocation(
         return NS_ERROR_FAILURE;
     }
 
-    // Ensure that we clean up the script on return.
-    JSScriptHolder scriptHolder(cx, script);
+    JSObject *scriptObject = JS_NewScriptObject(cx, script);
 
     // Flag this script as a system script
     // FIXME: BUG 346139: We actually want to flag this exact filename, not