On 2015-01-23 10:33 AM, Tomasz wrote:
Thanks, however, this does not want to compile. I re-wrote it to a form which I
can include in the Python code:
--------------------------------------------------------------------------
cgThings.append(CGGeneric(' JS::Rooted<JSObject*> stack(cx);
\n'))
cgThings.append(CGGeneric(' if (JS::CaptureCurrentStack(cx,
&stack, 1)) { \n'))
cgThings.append(CGGeneric(' JS::Rooted<JS::Value> source(cx);
\n'))
cgThings.append(CGGeneric(' if (JS_GetProperty(stack, "source",
&source)) { \n'))
cgThings.append(CGGeneric(' if (source.isString()) {
\n'))
cgThings.append(CGGeneric(' nsAutoJSString str;
\n'))
cgThings.append(CGGeneric(' if (str.init(cx,
source.toString())) { \n'))
cgThings.append(CGGeneric(' printf("FULL: %s\\n",
NS_ConvertUTF16toUTF8(str).get()); \n'))
cgThings.append(CGGeneric(' }
\n'))
cgThings.append(CGGeneric(' }
\n'))
cgThings.append(CGGeneric(' }
\n'))
cgThings.append(CGGeneric(' }
\n'))
--------------------------------------------------------------------------
Unfortunately, I am getting a compilation error:
--------------------------------------------------------------------------
0:33.26
/home/tomasz/CPPProjects/mozilla-central/obj-x86_64-unknown-linux-gnu/dom/bindings/HTMLMediaElementBinding.cpp:
In function 'bool
mozilla::dom::HTMLMediaElementBinding::get_mozPreservesPitch(JSContext*,
JS::Handle<JSObject*>, mozilla::dom::HTMLMediaElement*, JSJitGetterCallArgs)':
0:33.26
/home/tomasz/CPPProjects/mozilla-central/obj-x86_64-unknown-linux-gnu/dom/bindings/HTMLMediaElementBinding.cpp:2115:50:
error: cannot convert 'JS::Rooted<JSObject*>' to 'JSContext*' for argument '1'
to 'bool JS_GetProperty(JSContext*, JS::HandleObject, const char*,
JS::MutableHandleValue)'
0:33.26 if (JS_GetProperty(stack, "source", &source)) {
0:33.26 ^
--------------------------------------------------------------------------
Try passing cx as the first argument to JS_GetProperty (it takes 4
arguments, not 3.)
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform