Instantly share code, notes, and snippets.

View Firefox-pinchy2.js
* pinchy preferences.
* Execute in a Browser Scratchpad.
* 1. Open Firefox Developer Tools (cmd-opt-i)
* 2. Open Settings (gear icon)
* 3. Check "Enable browser chrome and add-on debugging toolboxes"
* and "Enable remote debugging" in "Advanced Settings"
* 4. Maybe restart the browser
* 5. Open Scratchpad (shift-F4)

Keybase proof

I hereby claim:

  • I am robcee on github.
  • I am robcee ( on keybase.
  • I have a public key ASAzKAG5vptxYxAV21g2bwR0P0r4vtl5VZku8cCaZZPhkQo

To claim this, I am signing this object:

View scratchpad.js
* This is a JavaScript Scratchpad.
* Enter some JavaScript, then Right Click or choose from the Execute Menu:
* 1. Run to evaluate the selected text (Cmd-R),
* 2. Inspect to bring up an Object Inspector on the result (Cmd-I), or,
* 3. Display to insert the result in a comment after the selection. (Cmd-L)
View scratchpad-gist.js
/* 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 */
var __SCRATCHPAD__ = !(typeof(window) == "undefined");
if (__SCRATCHPAD__ && (typeof(window.gBrowser) == "undefined")) {
throw new Error("Must be run in a browser scratchpad.");
// If we're developing in scratchpad, shutdown the previous run
View gist:9061250
// open a web console
let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
// console.profile();
let targét = devtools.TargetFactory.forTab(gBrowser.selectedTab);
let startTime =;
let endTime;
gDevTools.showToolbox(targét, "inspector").then(() => {

Writing an Actor

A Simple Hello World

Here's a simple Hello World actor. It is a global actor (not associated with a given browser tab).

let protocol = require("devtools/server/protocol");
let {method, Arg, Option, RetVal} = protocol;
View gist:5509561

This interface is partly implemented in Firefox Nightly builds. Some parts are not implemented, some APIs may yet change, and anything marked "(future plan)" is a long way off. You can [ fork this specification on github] to draft and discuss revisions.

The Debugger constructor makes objects with methods for debugging code running in global objects in other compartments. Given a Debugger instance, you can:

  • add debuggee global objects to its purview using its addDebuggee method;
  • request notification of basic debugging events like stack frame entry and debugger statement execution by providing appropriate handler functions;
  • set breakpoints in scripts;
  • set watchpoints on objects and their properties;
  • examine the debuggee's stack frames and lexical enviroments;
  • inspect and manipulate its objects;

Web Console output rewrite, bug 778766

This document describes the ongoing work for the Web Console output rewrite / reimplementation. Feedback is requested.


Current issues

Issues currently affecting the Web Console output:

  • page navigation/reload issues:
View scratchdebug.patch
diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -23,19 +23,22 @@ Cu.import("resource://gre/modules/Servic
View nexus4bot.js
* This Scratchpad will poll the Google Play Store every hour and
* look for the words "Sold Out" in their banner div. If they're
* not there, you'll get an alert that it's in!
* This Scratchpad needs to run in Browser Context!
var duration = 1000 * 60 * 60; // ms * sec * min = 1 hour