Skip to content

Instantly share code, notes, and snippets.

View brendandahl's full-sized avatar

Brendan Dahl brendandahl

  • Google
  • San Francisco, CA
View GitHub Profile
@brendandahl
brendandahl / scratchpad-custom-elements.diff
Last active January 25, 2018 19:54
Scratchpad - Replacing Overlays
index 8b9aff040b6d..ebff698f235d 100644
--- a/devtools/client/scratchpad/scratchpad.xul
+++ b/devtools/client/scratchpad/scratchpad.xul
@@ -15,7 +15,6 @@
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://devtools/skin/scratchpad.css"?>
-<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<window id="main-window"
This file has been truncated, but you can view the full file.
DEBUG:cargo::update: executing; cmd=cargo-update; args=["/home/bdahl/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo", "update", "-p", "gkrust-shared", "--aggressive"]
TRACE:cargo::util::toml: read_manifest; path=/home/bdahl/projects/gecko/toolkit/library/rust/Cargo.toml; source-id=file:///home/bdahl/projects/gecko/toolkit/library/rust
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/toolkit/library/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/toolkit/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/gecko/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/projects/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/bdahl/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /home/Cargo.toml
DEBUG:cargo::core::workspace: find_root - trying /Cargo.toml
DEBUG:cargo::core::workspace: find_members - only me as a member
@brendandahl
brendandahl / test_element_from_point.html
Created January 17, 2018 00:16
Test element from point
<html>
<head></head>
<body>
<div style="width:400px; heigh: 400px">Hello</div>
<script type="text/javascript">
var el = document.elementFromPoint(10, 10);
dump(">>> element=" + (el ? el.textContent : "null") + "\n");
</script>
</body>
</html>
@brendandahl
brendandahl / xul_overlay_usage.md
Last active February 26, 2024 07:11
XUL Overlay Usage in Firefox

XUL Overlays Usage

There are three ways to use an overlay 1) explicitly, 2) dynamically, and 3) runtime dynamic.

Overlays Used

Explicit

Loaded using <?xul-overlay in xul file.

@brendandahl
brendandahl / snap_screen.js
Last active October 24, 2017 17:17
Snapshot a page in Firefox
// Current window
var el = window.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
el.width = window.innerWidth;
el.height = window.innerHeight;
var ctx = el.getContext("2d");
SpecialPowers.wrap(ctx).drawWindow(window, 0, 0, window.innerWidth, window.innerHeight, "rgba(0,0,0,0)",
ctx.DRAWWINDOW_USE_WIDGET_LAYERS | ctx.DRAWWINDOW_DRAW_VIEW | ctx.DRAWWINDOW_DRAW_CARET);
dump("\n" + el.toDataURL() + "\n");
// Parent window in e10s mode
@brendandahl
brendandahl / gist:08c5a40ecf357e2f098de30d95fd76b8
Last active October 3, 2017 20:42
Remove non-deterministic output from gekco log
cat headless.txt | sed -E 's/GECKO\([0-9]+\)/GECKO/g' | sed -E 's/0x[a-f0-9]+/0xADRESS/g' | sed -E 's/pid = [0-9]+/pid/g' | sed -E 's/id = \{[0-9a-f\-]+\}/id/g' | sed -E 's/\[[0-9]+\] WARNING:/[] WARNING:/g' | sed -E 's/took [0-9]+ms/took xms/g' | sed -E 's/[0-9]+ INFO/x INFO/g' | sed -E 's/INFO None[0-9]+/INFO Nonex/g' | sed -E 's/[0-9]+:[0-9]+:[0-9]+ INFO /INFO /g' | sed -E 's/\[[0-9]+, Main Thread\]/THREAD_ID Main Thread/g' > headless_filt.txt
LLDB: b js::math_atan2_handle
GDB: break js::math_atan2_handle
@brendandahl
brendandahl / gist:60ce0d769c21321c209548f2ae049b5d
Created July 11, 2017 18:26
rebase mozilla central to inbound
git rebase --onto mozilla/inbound mozilla/central fullscreen-crash
@brendandahl
brendandahl / slimer.js
Created February 18, 2017 02:00
Snapshot a page with slimer.js
var webpage = require('webpage').create();
webpage
.open('http://localhost:8000')
.then(function() {
// store a screenshot of the page
webpage.viewportSize = { width:650, height:320 };
webpage.render('/home/bdahl/projects/gecko/page.png',
{ onlyViewport:true });
slimer.exit();
});
@brendandahl
brendandahl / linking_error_debug.md
Last active January 5, 2017 20:04
Debugging a Linking Error
  1. Is library referenced in the link command?

  2. Does the library have the method?

nm <library path> | grep -i <method name> | grep -v " U "

Note: if the symbol type is lowercase 't', then the symbol is not exported!

  1. Are both libraries/executables compiled with or without RTTI?