Bug 887334 - Push a JSContext in nsGlobalWindow::SecurityCheckURL. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Wed, 17 Jul 2013 11:53:54 -0700
changeset 138964 a1037583253f8da05f53bf03b54cfcc1d1ae5be4
parent 138963 7c93f74e004db9b6a11ad9b9b4202a893c719114
child 138965 5427f4d376c46a78913784982ea85995dce9ea7a
push id24977
push userryanvm@gmail.com
push dateFri, 19 Jul 2013 00:35:38 +0000
treeherdermozilla-central@0d0263a58f06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs887334
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 887334 - Push a JSContext in nsGlobalWindow::SecurityCheckURL. r=gabor
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -10864,23 +10864,25 @@ nsGlobalWindow::BuildURIfromBase(const c
   if (aCXused)
     *aCXused = cx;
   return NS_NewURI(aBuiltURI, nsDependentCString(aURL), charset.get(), baseURI);
 }
 
 nsresult
 nsGlobalWindow::SecurityCheckURL(const char *aURL)
 {
-  JSContext       *cx;
+  JSContext       *cxUsed;
   bool             freePass;
   nsCOMPtr<nsIURI> uri;
 
-  if (NS_FAILED(BuildURIfromBase(aURL, getter_AddRefs(uri), &freePass, &cx)))
+  if (NS_FAILED(BuildURIfromBase(aURL, getter_AddRefs(uri), &freePass, &cxUsed)))
     return NS_ERROR_FAILURE;
 
+  AutoPushJSContext cx(cxUsed);
+
   if (!freePass && NS_FAILED(nsContentUtils::GetSecurityManager()->
         CheckLoadURIFromScript(cx, uri)))
     return NS_ERROR_FAILURE;
 
   return NS_OK;
 }
 
 void