openwpm / OpenWPM

A web privacy measurement framework
https://openwpm.readthedocs.io
Other
1.34k stars 314 forks source link

Callstack Instrument fails to capture some parts of the stack #845

Open vringar opened 3 years ago

vringar commented 3 years ago

@hadiamjad pointed out on Matrix that the callstack instrument captures less than the Firefox debugger shows.

Firefox output

OpenWPM output

vringar commented 3 years ago

It would be nice to get the raw string output from OpenWPM instead of an image since that's easier to read/understand (at least for me).

hadiamjad commented 3 years ago
2/a</e.prototype.addCreative@https://ced-ns.sascdn.com/diff/templates/ts/dist/banner/sas-banner-1.2.js:1:16788;null
16/o</e.prototype.init@https://ced-ns.sascdn.com/diff/templates/ts/dist/banner/sas-banner-1.2.js:1:13108;null
onLoad@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=35212&async=1&visit=s&tmstp=6304051897&tag=sas_35212&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:111:27;null
l@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=35212&async=1&visit=s&tmstp=6304051897&tag=sas_35212&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:58:1483;null
sas.utils.Latch/this.notify@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=35212&async=1&visit=s&tmstp=6304051897&tag=sas_35212&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:58:1639;null
sas.utils.loadScript/r</<@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=35212&async=1&visit=s&tmstp=6304051897&tag=sas_35212&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:58:3392;null
e/sas.utils._callbacks[c]<@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=40121&async=1&visit=s&tmstp=6304051897&tag=sas_40121&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:58:2866;null
sas.events.addLoadEvent/e<@https://www3.smartadserver.com/ac?nwid=0&siteid=81298&pgid=632202&fmtid=40121&async=1&visit=s&tmstp=6304051897&tag=sas_40121&sh=768&sw=1366&pgDomain=https%3A%2F%2Fwww.atresplayer.com%2F&noadcbk=sas.noad&isLazy=0&isAdRefresh=0:58:1260;null
r@https://statics.atresmedia.com/atresplayer/webapp/vendor.873e38b533.js:9:76012;null
hadiamjad commented 3 years ago

this might be the reason: https://github.com/mozilla/OpenWPM/issues/678?

vringar commented 3 years ago

Yes, that seems like the reason. Can you check if that setting is set?

hadiamjad commented 3 years ago

Where I can find this setting in openWPM?

vringar commented 3 years ago

https://github.com/mozilla/OpenWPM/blob/8dad9fd2129f8375575813baaa19992efdde47de/test/test_profile.py#L109-L134 If you add this command to the command sequence you can check whether the pref is set.

vringar commented 3 years ago

I just realized that this answer is a little short. Should I explain myself further or is this enough to get you going?

hadiamjad commented 3 years ago

No, it's understandable, I'll update you on this soon.

hadiamjad commented 3 years ago

Here, I have added TestConfigSetCommand at line 68 and it raises AssertionError. Looks like flag is not set.

Screenshot (102)

vringar commented 3 years ago

You can set the pref by using the BrowserParams like this:

browser_params[i].prefs = {"javascript.options.asyncstack": True}

Which I'm hoping is going to fix the issue.

hadiamjad commented 3 years ago

Nope, unfortunately, it's still not working.

hadiamjad commented 3 years ago

Interestingly when I tried capturing the call stack directly from selenium, it has the same problem.

image

vringar commented 3 years ago

Hmm, could you file a bug with Selenium then to see if maybe they can fix this?