Skip to content

Instantly share code, notes, and snippets.

View bgrins's full-sized avatar

Brian Grinstead bgrins

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="devtools-webconsole"
macanimationtype="document"
fullscreenbutton="true"
title=""
windowtype="devtools:webconsole"
@bgrins
bgrins / data.md
Last active January 19, 2018 20:57
# of spans mem with xbl mem w/out xbl
1 327400 260648
10 328904 263176
100 396088 294088
1000 982120 577352
10000 6825992 3451208
<style>
body {
margin: 0;
}
/* Style the element from the outside */
/*
fancy-tabs {
margin-bottom: 32px;
<meta charset="utf-8" />
<style>
/* Trying to emulate the pretty printing on data:text/xml,<foo><bar><baz>wat</baz>asdf</bar></foo> */
details, details + span { display: inline-block; }
details[open] { display: block; }
body > details { margin-inline-start: 0;}
body > details[open] + span { margin-inline-start: 1em;}
details { margin-inline-start: 1em;}
details[open] + span, div.children { margin-inline-start: 2em; }
// https://treeherder.mozilla.org/#/jobs?repo=try&revision=aaccf2c1ff6b66b52bcfa1390b78bb781b86f672&filter-tier=1&filter-tier=2&filter-tier=3&selectedJob=148874008
var fs = require("fs");
var bsplit = require('buffer-split');
function readLines(path) {
const buf = fs.readFileSync(path); // omitting encoding returns a Buffer
const delim = Buffer.from('\n');
const result = bsplit(buf, delim);
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xbl/builtin/android/platformHTMLBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xbl/builtin/emacs/platformHTMLBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xbl/builtin/mac/platformHTMLBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xbl/builtin/unix/platformHTMLBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xbl/builtin/win/platformHTMLBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/dom/xml/resources/XMLPrettyPrint.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/layout/style/xbl-marquee/xbl-marquee.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/toolkit/components/printing/content/printPreviewBindings.xml
https://raw.githubusercontent.com/mozilla/gecko-dev/master/toolkit/components/prompts/content/tabprompts.xml
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<bindings id="autocompleteBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
// Doesn't bubble to parentNode, but does fire on gBrowser (the bindingParent for gBrowser.selectedBrowser)
gBrowser.addEventListener("bar", () => { console.log("No explicit bubbling, but bubbled to gBrowser") });
gBrowser.selectedBrowser.parentNode.addEventListener("bar", () => { console.log("No explicit bubbling, did not bubble to parentNode") });
gBrowser.selectedBrowser.dispatchEvent(new CustomEvent("bar"));
// If you tell the CustomEvent to bubble, then it does bubble to the parentNode (and gBrowser):
gBrowser.addEventListener("bar", () => { console.log("Explicit bubbling, did bubble to gBrowser") });
gBrowser.selectedBrowser.parentNode.addEventListener("bar", () => { console.log("Explicit bubbling, did bubble to parentNode") });
gBrowser.selectedBrowser.dispatchEvent(new CustomEvent("bar", { bubbles: true }));
@bgrins
bgrins / _run.sh
Last active August 17, 2017 21:34
./mach run --setpref dom.allow_XUL_XBL_for_file=true file:///path/to/minimal.xul
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
let cleanupAry = [];
function restart() {
Cc['@mozilla.org/toolkit/app-startup;1'].getService(Ci.nsIAppStartup)
.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
}