How to get the current profile directory on webextension?

There is no API to get the profile path, and Mozilla won’t add any either: https://bugzilla.mozilla.org/show_bug.cgi?id=1414887

That being said, under certain circumstances the location of your extension can be contained in stack traces (I don’t remember how exactly, but this definitely happed in content scripts in Firefox ~52. At the time it was a problem I had to avoid) and there is a number of more or less reliable ways to find the current profile location from within a native messaging app: