How to get the current profile directory on webextension?

Hi. everyone.
I recently need to develop an addon.
On that, I need to get the directory path of current profile.
I can do it without using webextension, but I can’t find the apis related this on webextension document.
So I want somebody to help me finding out the apis that carry out this.
Regards.

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: