Skip to content

Instantly share code, notes, and snippets.

View gregtatum's full-sized avatar

Greg Tatum gregtatum

View GitHub Profile
@gregtatum
gregtatum / clean-stack.js
Last active July 20, 2016 20:29
Functions to return the current callstack in a clean format in Firefox Devtools
/**
* Returns the current stack in a clean, readable fashion.
*/
function cleanStack() {
let maxFnLength = 0
const tuples = (new Error()).stack
.trim()
.split('\\\\n')
.map(line => {
let [fn, path] = line.split(' -> ')
@gregtatum
gregtatum / index.js
Created July 26, 2016 02:06
requirebin sketch
var roundCorner = require('round-corner')
// Main runs immediately, just to organize the code a bit.
;(function main () {
// Set up the canvas, place it on the screen, and get the 2d context.
var ctx = initCtx()
// Create our line segment
var line = [
[125, 500],
@gregtatum
gregtatum / index.js
Created July 26, 2016 02:08
requirebin sketch
var roundCorner = require('round-corner')
// Main runs immediately, just to organize the code a bit.
;(function main () {
var path = createPathElement()
// Create our line segment.
var line = [
[125, 500],
[200, 50],
@gregtatum
gregtatum / firefox-require.js
Last active September 28, 2016 13:40
Firefox Require
var {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
#!/usr/bin/python
import argparse
import json
import os
import sys
from collections import defaultdict
parser = argparse.ArgumentParser(description='Summarize a Cleopatra profile')
<html>
<head>
<style>
</style>
</head>
<body>
<script>
function times(n, fn) {
const results = []
for(let i=0; i < n; i++) {
var {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
var {require} = Components.utils.import("resource://devtools/shared/Loader.jsm", {});
var {generateCssProperties} = require("devtools/server/actors/css-properties");
var db = {
cssProperties: cssProperties(),
pseudoElements: pseudoElements()
}
console.log(db);
diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js
index 5cbacca..a88d38f 100644
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -123,10 +123,6 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId) {
this._showDevEditionPromo = this._showDevEditionPromo.bind(this);
this._updateTextBoxMenuItems = this._updateTextBoxMenuItems.bind(this);
this._onPerformanceFrontEvent = this._onPerformanceFrontEvent.bind(this);
- this._onBottomHostWillChange = this._onBottomHostWillChange.bind(this);
- this._toggleMinimizeMode = this._toggleMinimizeMode.bind(this);
diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js
index 5cbacca..a88d38f 100644
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -123,10 +123,6 @@ function Toolbox(target, selectedTool, hostType, contentWindow, frameId) {
this._showDevEditionPromo = this._showDevEditionPromo.bind(this);
this._updateTextBoxMenuItems = this._updateTextBoxMenuItems.bind(this);
this._onPerformanceFrontEvent = this._onPerformanceFrontEvent.bind(this);
- this._onBottomHostWillChange = this._onBottomHostWillChange.bind(this);
- this._toggleMinimizeMode = this._toggleMinimizeMode.bind(this);
clear()
var profiler = Components.classes["@mozilla.org/tools/profiler;1"]
.getService(Components.interfaces.nsIProfiler);
var settings = {
entries: 1000000,
interval: 0.4,
features: ["js", "stackwalk", "threads", "leaf"],
threads: ["GeckoMain", "Compositor"]
}