[geary/wip/use-upstream-jsc-0.12: 3/3] Clean up JS util API courtesy the new bindings.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/use-upstream-jsc-0.12: 3/3] Clean up JS util API courtesy the new bindings.
- Date: Mon, 11 Feb 2019 03:54:01 +0000 (UTC)
commit e091f24b00ec421e1aadd5e360d1550e658ad5ef
Author: Michael James Gratton <mike vee net>
Date: Sun May 20 19:07:56 2018 +1000
Clean up JS util API courtesy the new bindings.
src/client/util/util-webkit.vala | 2 +-
src/engine/util/util-js.vala | 12 +++++-------
2 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/client/util/util-webkit.vala b/src/client/util/util-webkit.vala
index cba9eaf2..45a27c44 100644
--- a/src/client/util/util-webkit.vala
+++ b/src/client/util/util-webkit.vala
@@ -64,7 +64,7 @@ namespace WebKitUtil {
JS.Value? err = null;
JS.String js_str = js_str_value.to_string_copy(context, out err);
Geary.JS.check_exception(context, err);
- return Geary.JS.to_string_released((owned) js_str);
+ return Geary.JS.to_native_string(js_str);
}
/**
diff --git a/src/engine/util/util-js.vala b/src/engine/util/util-js.vala
index ea955e99..a98d7985 100644
--- a/src/engine/util/util-js.vala
+++ b/src/engine/util/util-js.vala
@@ -82,7 +82,7 @@ namespace Geary.JS {
global::JS.String js_str = value.to_string_copy(context, out err);
Geary.JS.check_exception(context, err);
- return Geary.JS.to_string_released((owned) js_str);
+ return to_native_string(js_str);
}
/**
@@ -111,7 +111,7 @@ namespace Geary.JS {
/**
* Returns a JSC {@link JS.String} as a Vala {@link string}.
*/
- public inline string to_string_released(owned global::JS.String js) {
+ public inline string to_native_string(global::JS.String js) {
size_t len = js.get_maximum_utf8_cstring_size();
uint8[] str = new uint8[len];
#if VALA_0_42
@@ -138,10 +138,8 @@ namespace Geary.JS {
global::JS.String js_name = new global::JS.String.create_with_utf8_cstring(name);
global::JS.Value? err = null;
global::JS.Value prop = object.get_property(context, js_name, out err);
- try {
- Geary.JS.check_exception(context, err);
- } finally {
- }
+ Geary.JS.check_exception(context, err);
+
return prop;
}
@@ -169,7 +167,7 @@ namespace Geary.JS {
throw new Error.EXCEPTION(
"JS exception thrown [%s]: %s"
- .printf(err_type.to_string(), to_string_released((owned) err_str))
+ .printf(err_type.to_string(), to_native_string(err_str))
);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]