Skip to content

Debugging JS web compat issues

Josh Matthews edited this page Jun 16, 2020 · 3 revisions

Tips:

  • build with --features js_backtrace to automatically receive JS and Rust backtraces whenever an exception is reported
  • run with --unminify-js to store unminified versions of any external scripts that are executed in the unminified-js directory
  • run with --local-script-source=unminified-js to be able to modify the JS that is executed to add debugging information
  • run with --pref dom.servo_helpers.enabled to get access to window.js_backtrace() to print the current JS and Rust backtrace to stdout
  • RUST_LOG=net::http_loader, then compare the output against the network monitor for the same site in Firefox
  • RUST_LOG=ws,net::websocket_loader, then look for unexpected websocket failures
  • use --userscripts=resources/user-agent-js and modify resources/user-agent-js/00.example.js to add polyfills or stubs for missing web APIs
  • add onunhandledrejection = function(e) { console.error(e.reason); } to a user script
  • if in lldb in a C++ spidermonkey stack frame, use call DumpBacktrace(cx) to see the current JS backtrace in stdout

Preferences to bypass some missing APIs

  • dom.svg.enabled
  • dom.gamepad.enabled
  • dom.webrtc.enabled
Clone this wiki locally