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:
            cgThings.append(CGGeneric('printf("getter: ' + nativeMethodName + 
'\\n");\n'))
        else:
            cgThings.append(CGGeneric('printf("method: ' + nativeMethodName + 
'\\n");\n'))

What about the document URL? Is it also possible to print it somewhere in the 
code in a way that the document URL will appear exactly before all the embedded 
methods / setters / getters?

You can do something similar to the beginning of mozilla::dom::CheckPermissions to get an nsPIDOMWindow*, and then call GetDocumentURI() on it.

On Monday, January 19, 2015 at 3:29:52 PM UTC+1, Josh Matthews wrote:
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, Tomasz wrote:
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 files, which include (among others) the 
following statements:


* http://www.aaa.com/dir1/file1.htm
var x = document.getElementById("demo");

* http://www.bbb.com/dirT/file44.htm
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);
</script>

I would like to automatically log the execution of these functions as:

http://www.aaa.com/dir1/file1.htm | getElementById
http://www.bbb.com/dirT/file44.htm | getElementById
http://www.bbb.com/dirT/file44.htm | getContext
http://www.bbb.com/dirT/file44.htm | fillRect

If it is possible, I would also like to separately log all the set / read 
properties, as:

http://www.bbb.com/dirT/file44.htm | fillStyle

I know that the JavaScript API functions are implemented in Firefox in 2 ways: 
as C++ functions or JavaScript functions. However, I do not care how the 
functions are internally implemented - I just want to log all the executions. 
Is there any easy way to do that besides adding logging statements to every 
single JavaScript function we want to log?

Thank you for all your suggestions in advance.

Best regards,
Tomasz

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


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

Reply via email to