omegafox/patches/debug-url-navigation.patch
daijro a8e9ffaa64 README: Add debug flow chart
Added more information for anyone interested in building/debugging Camoufox.
2024-10-10 05:07:13 -05:00

27 lines
1.1 KiB
Diff

diff --git a/browser/base/content/browser-init.js b/browser/base/content/browser-init.js
index bee5309c04..3d0df30224 100644
--- a/browser/base/content/browser-init.js
+++ b/browser/base/content/browser-init.js
@@ -246,6 +246,22 @@ var gBrowserInit = {
// Update UI if browser is under remote control.
gRemoteControl.updateVisualCue();
+ // Camoufox: print URL changes to console
+ if (ChromeUtils.isCamouDebug()) {
+ ChromeUtils.camouDebug("Debug mode ON.");
+ gBrowser.addTabsProgressListener({
+ onLocationChange(aBrowser, aWebProgress, aRequest, aLocation, aFlags) {
+ if (aBrowser === gBrowser.selectedBrowser) {
+ ChromeUtils.camouDebug("URL changed to: " + aLocation.spec);
+ }
+ }
+ });
+
+ gURLBar.addEventListener("change", () => {
+ ChromeUtils.camouDebug("URL bar value changed to: " + gURLBar.value);
+ });
+ }
+
// If we are given a tab to swap in, take care of it before first paint to
// avoid an about:blank flash.
let tabToAdopt = this.getTabToAdopt();