NS_ConvertUTF16toUTF8(NS_STATIC_CAST(PRUnichar*, propname_str)).get());
NS_ConvertUTF16toUTF8(NS_REINTERPRET_CAST(PRUnichar*, propname_str)).get());
CopyJSPropertyArray(JSContext *cx, JSObject *aSource, JSObject *aDest,                    JSIdArray *props){  jsint length = props->length;  for (jsint i = 0; i < length; ++i) {    jsval propname_value;    if (!::JS_IdToValue(cx, props->vector[i], &propname_value) ||        !JSVAL_IS_STRING(propname_value)) {      NS_WARNING("Failed to copy non-string-named window property");      return NS_ERROR_FAILURE;    }    JSString *propname = JSVAL_TO_STRING(propname_value);    jschar *propname_str = ::JS_GetStringChars(propname);    NS_ENSURE_TRUE(propname_str, NS_ERROR_FAILURE);    // We exclude the "location" property because restoring it this way is    // problematic.  It will "just work" without us explicitly saving or    // restoring the value.    if (!nsCRT::strcmp(NS_STATIC_CAST(PRUnichar*, propname_str),                       NS_LITERAL_STRING("location").get())) {      continue;    }    size_t propname_len = ::JS_GetStringLength(propname);    JSPropertyOp getter, setter;    uintN attrs;    JSBool found;    if (!::JS_GetUCPropertyAttrsGetterAndSetter(cx, aSource, propname_str,                                                propname_len, &attrs, &found,                                                &getter, &setter))      return NS_ERROR_FAILURE;    NS_ENSURE_TRUE(found, NS_ERROR_UNEXPECTED);    jsval propvalue;    if (!::JS_LookupUCProperty(cx, aSource, propname_str,                               propname_len, &propvalue))      return NS_ERROR_FAILURE;    PRBool res = ::JS_DefineUCProperty(cx, aDest, propname_str, propname_len,                                       propvalue, getter, setter, attrs);#ifdef DEBUG_PAGE_CACHE    if (res)      printf("Copied window property: %s\n",             NS_ConvertUTF16toUTF8(NS_STATIC_CAST(PRUnichar*,                                                  propname_str)).get());#endif    if (!res) {#ifdef DEBUG      printf("failed to copy property: %s\n",             NS_ConvertUTF16toUTF8(NS_STATIC_CAST(PRUnichar*,                                                  propname_str)).get());#endif      return NS_ERROR_FAILURE;    }  }  return NS_OK;}