Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-26 Thread Tomasz
In what cases were the early-return cases actually hit? They correspond to things like out-of-memory conditions and should not have been getting hit... Here: cgThings.append(CGGeneric('if (!stack) { \n'))

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-26 Thread Tomasz
Hmm. It's possible that stack came back null if the call into the binding wasn't actually from script. Add a null-check (this part _should_ end up with an indented block and all that). Well, I got my function working. Using immediate returns from the functions was not a good solution as

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-26 Thread Boris Zbarsky
On 1/26/15 12:48 PM, Tomasz wrote: In what cases were the early-return cases actually hit? They correspond to things like out-of-memory conditions and should not have been getting hit... Here: cgThings.append(CGGeneric('if (!stack) {

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-26 Thread Boris Zbarsky
On 1/26/15 11:49 AM, Tomasz wrote: Using immediate returns from the functions was not a good solution as it was breaking functions where some operations were performed after our code In what cases were the early-return cases actually hit? They correspond to things like out-of-memory

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-26 Thread Tomasz
So summarizing, I will describe here all the necessary changes to be done in order to get my solution working. The produced log is as that: --- Mon Jan 26 19:13:15 2015 | GETTER: [Style], FILE:

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Boris Zbarsky
On 1/23/15 12:06 PM, Tomasz wrote: Both versions (with returns and conditional statements) compile fine. However, neither of them works. Both versions crash on browser startup on: JS_GetProperty(cx, stack, source, source) Hmm. It's possible that stack came back null if the call into the

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Tomasz
Well, in the version with returns it is: cgThings.append(CGGeneric(' JS::RootedJSObject* stack(cx); \n')) cgThings.append(CGGeneric(' if (!JS::CaptureCurrentStack(cx, stack,

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Tomasz
Remove 'signaling_unittests' from the list of tests in http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/test/moz.build Yes, it worked. Now the code compiles. There are, however, several other problems, which I am describing below. Filing a bug on Core: WebRTC,

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Boris Zbarsky
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

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Ehsan Akhgari
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::RootedJSObject*

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Boris Zbarsky
On 1/23/15 10:33 AM, Tomasz wrote: cgThings.append(CGGeneric(' if (JS::CaptureCurrentStack(cx, stack, 1)) { \n')) cgThings.append(CGGeneric('JS::RootedJS::Value source(cx); \n')) Also, this is very very wrong.

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-23 Thread Tomasz
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::RootedJSObject* stack(cx);

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-22 Thread Boris Zbarsky
On 1/22/15 9:30 AM, Tomasz wrote: So, any idea how to fix the following error? Remove 'signaling_unittests' from the list of tests in http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/test/moz.build ? Uh.. why is that #including the binding _cpp_ file? That's broken.

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-22 Thread Tomasz
Odd. The directory it's in is in LOCAL_INCLUDES in dom/bindings/moz.build... Try adding it there in dom/bindings/test/moz.build as well? Thank you, however, the problem still exists. Including nsGlobalWindow.h in the test directory only causes other early errors saying that the file is

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-21 Thread Tomasz
What you need to do is to make sure that nsGlobalWindow.h is included in each generated binding file. The simplest way to do that is to add the line bindingHeaders[nsGlobalWindow.h] = True where all the other such lines are (e.g. right after the line that sets

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-21 Thread Tomasz
You can add nsGlobalWindow.h to the list at http://mxr.mozilla.org/mozilla-central/source/dom/base/moz.build#42 to rectify this. Thank you, this is fixed. However, the second problem still exists. Including nsGlobalWindow.h (only that, without any other modifications) causes the

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-21 Thread Boris Zbarsky
On 1/21/15 11:22 AM, Tomasz wrote: --- 2:18.70 /home/tomasz/CPPProjects/mozilla-central/obj-x86_64-unknown-linux-gnu/dom/bindings/TestDictionaryBinding.cpp:11:28: fatal error: nsGlobalWindow.h: No such file or directory

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-21 Thread Josh Matthews
On 2015-01-21 11:22 AM, Tomasz wrote: What you need to do is to make sure that nsGlobalWindow.h is included in each generated binding file. The simplest way to do that is to add the line bindingHeaders[nsGlobalWindow.h] = True where all the other such lines are (e.g. right after the

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-20 Thread Tomasz
You can do something similar to the beginning of mozilla::dom::CheckPermissions to get an nsPIDOMWindow*, and then call GetDocumentURI() on it. Thank you Ehsan. I tried to do that, but I did not afford to make that working. Probably, because I have totally no experience with Firefox code

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-20 Thread Ehsan Akhgari
On 2015-01-20 11:42 AM, Tomasz wrote: You can do something similar to the beginning of mozilla::dom::CheckPermissions to get an nsPIDOMWindow*, and then call GetDocumentURI() on it. Thank you Ehsan. I tried to do that, but I did not afford to make that working. Probably, because I have

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-20 Thread Boris Zbarsky
On 1/20/15 11:42 AM, Tomasz wrote: cgThings.append(CGGeneric('nsPIDOMWindow* cwindow = xpc::WindowGlobalOrNull(obj);\n')) Yep, that looks good. error: cannot convert 'nsGlobalWindow*' to 'nsPIDOMWindow*' in initialization Right, because WindowGlobalOrNull returns nsGlobalWindow*, but the

Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-19 Thread Tomasz
Hi all, I would like to modify the Firefox source code in order to log every execution of any JavaScript API function (or object method) invoked by any JavaScript code on any website together with the full URL to the file which contained the JavaScript code. For example, we have the following

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-19 Thread Josh Matthews
Half of the battle is modifying CGPerSignatureCall in Codegen.py - that will get you the name of the DOM implementation method being invoked and deals with both DOM methods and DOM getters/setters. Getting the owning document URL is a separate struggle. Cheers, Josh On 2015-01-19 7:57 AM,

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-19 Thread Tomasz
Thank you very much, it works as expected. The code, which I added to the function, is: if setter: cgThings.append(CGGeneric('printf(setter: ' + nativeMethodName + '\\n);\n')) elif getter: cgThings.append(CGGeneric('printf(getter: ' + nativeMethodName +

Re: Does anybody know how to modify the source code in order to log the executions of the JavaScript functions?

2015-01-19 Thread Ehsan Akhgari
On 2015-01-19 11:33 AM, Tomasz wrote: Thank you very much, it works as expected. The code, which I added to the function, is: if setter: cgThings.append(CGGeneric('printf(setter: ' + nativeMethodName + '\\n);\n')) elif getter: