From b8da0721edefa86ec9f2a0f0f41ae5d857bc1661 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Tue, 11 Oct 2005 18:04:05 +0000 Subject: [PATCH] bug 311952: xpinstall should use its own runtime, so its JS isn't bound by Gecko's JS invarients. r=dveditz sr=brendan --- xpinstall/src/nsSoftwareUpdateRun.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/xpinstall/src/nsSoftwareUpdateRun.cpp b/xpinstall/src/nsSoftwareUpdateRun.cpp index 7cf62f19ad1..fce1c2b1d9a 100644 --- a/xpinstall/src/nsSoftwareUpdateRun.cpp +++ b/xpinstall/src/nsSoftwareUpdateRun.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* vim: set ts=4 sw=4 et tw=80: */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -525,17 +526,8 @@ extern "C" void RunInstallOnThread(void *data) &scriptLength); if ( finalStatus == NS_OK && scriptBuffer ) { - PRBool ownRuntime = PR_FALSE; - - nsCOMPtr rtsvc = - do_GetService("@mozilla.org/js/xpc/RuntimeService;1", &rv); - if(NS_FAILED(rv) || NS_FAILED(rtsvc->GetRuntime(&rt))) - { - // service not available (wizard context?) - // create our own runtime - ownRuntime = PR_TRUE; - rt = JS_Init(4L * 1024L * 1024L); - } + // create our runtime + rt = JS_NewRuntime(4L * 1024L * 1024L); rv = SetupInstallContext( hZip, jarpath, installInfo->GetURL(), @@ -601,9 +593,8 @@ extern "C" void RunInstallOnThread(void *data) finalStatus = nsInstall::UNEXPECTED_ERROR; } - // clean up Runtime if we created it ourselves - if ( ownRuntime ) - JS_DestroyRuntime(rt); + // Clean up after ourselves. + JS_DestroyRuntime(rt); } } // force zip archive closed before other cleanup