On 1/23/15 7:50 AM, Tomasz wrote:
This is not what I wanted :) I want to have the exact URLs of the particular 
files in which the calls were. So, if a particular method is called from a 
JavaScript from Doubleclick.net, I expect to get a URL of this JavaScript.

Yeah, you didn't say that up front.... ;)

  JS::Rooted<JSObject*> stack(cx);
  if (!JS::CaptureCurrentStack(cx, &stack, 1)) {
    return false;
  }
  JS::Rooted<JS::Value> source(cx);
  if (!JS_GetProperty(stack, "source", &source)) {
    return false;
  }
  if (source.isString()) {
    nsAutoJSString str;
    if (!str.init(cx, source.toString())) {
      return false;
    }
    printf("%s\n", NS_ConvertUTF16toUTF8(str).get());
  }

  // Obviously you can also print line/column numbers, since this is an
  // entire stack representation.

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to