tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsGeckoUtils.cpp (827B)


      1 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
      2 * This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include <jni.h>
      7 
      8 #include <stdlib.h>
      9 #include <string.h>
     10 #include "APKOpen.h"
     11 
     12 extern "C" __attribute__((visibility("default"))) void MOZ_JNICALL
     13 Java_org_mozilla_gecko_mozglue_GeckoLoader_putenv(JNIEnv* jenv, jclass,
     14                                                  jstring map) {
     15  const char* str;
     16  // XXX: java doesn't give us true UTF8, we should figure out something
     17  // better to do here
     18  str = jenv->GetStringUTFChars(map, nullptr);
     19  if (str == nullptr) return;
     20  putenv(strdup(str));
     21  jenv->ReleaseStringUTFChars(map, str);
     22 }