diff --git a/browser_patches/README.md b/browser_patches/README.md index df28be78bf..0dbdd0523e 100644 --- a/browser_patches/README.md +++ b/browser_patches/README.md @@ -85,6 +85,10 @@ Set the `DEBUG=pw:browser` environment variable to see it. ## Firefox +### Debug build + +When compiling set the `FF_DEBUG_BUILD=1` environment variable. + #### Stack trace In `//mozglue/misc/StackWalk.cpp` add @@ -96,7 +100,9 @@ In `//mozglue/misc/StackWalk.cpp` add In native code use ```c++ -nsTraceRefcnt::WalkTheStack(stderr); +#include "mozilla/StackWalk.h" +// ... +MozWalkTheStack(stderr); ``` If the stack trace is still mangled `cat` it to `tools/rb/fix_linux_stack.py` diff --git a/browser_patches/firefox/build.sh b/browser_patches/firefox/build.sh index 63915e1b4c..f3f1086bed 100755 --- a/browser_patches/firefox/build.sh +++ b/browser_patches/firefox/build.sh @@ -66,6 +66,10 @@ echo "mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/${OBJ_FOLDER}" >> .mozconfig echo "ac_add_options --disable-crashreporter" >> .mozconfig echo "ac_add_options --disable-backgroundtasks" >> .mozconfig +if [[ -n $FF_DEBUG_BUILD ]]; then + echo "ac_add_options --enable-debug" >> .mozconfig +fi + if [[ "$(uname)" == MINGW* || "$(uname)" == "Darwin" ]]; then # This options is only available on win and mac. echo "ac_add_options --disable-update-agent" >> .mozconfig diff --git a/browser_patches/firefox/install-preferences.js b/browser_patches/firefox/install-preferences.js index a1d850e14e..f82f791d54 100644 --- a/browser_patches/firefox/install-preferences.js +++ b/browser_patches/firefox/install-preferences.js @@ -31,7 +31,7 @@ async function installFirefoxPreferences(distpath) { if (os.platform() === 'linux') executablePath = path.join(distpath, 'firefox'); else if (os.platform() === 'darwin') - executablePath = path.join(distpath, 'Nightly.app', 'Contents', 'MacOS', 'firefox'); + executablePath = path.join(distpath, (process.env.FF_DEBUG_BUILD ? 'NightlyDebug.app' : 'Nightly.app'), 'Contents', 'MacOS', 'firefox'); else if (os.platform() === 'win32') executablePath = path.join(distpath, 'firefox.exe');