Skip to content

Instantly share code, notes, and snippets.

/**
* Open Browser Toolbox after building your Nightly with the patch from bug 965872 applied.
* Go to Scratchpad Tab
* Run this script
*/
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let { require } = devtools;
let {StorageFront} = require("devtools/server/actors/storage");

What

A proposal for updating our style inspector and style editor.

For now it is a rough draft put together quickly. It will need to be refined a lot and will require discussions and, later, should be turned into a plan with bugs being filed.

Many of the things described below already work this way today, I just haven't had the chance yet to describe them as such. A list highlighting what exists today, what doesn't and what should be changed has yet to be created.

Why

To achieve 2 main goals:

var words = ["a",
"abilities",
"ability",
"abilitys",
"able",
"about",
"above",
"absence",
"absolute",
"absolutely",
@grssam
grssam / unload.js
Created February 22, 2012 07:00
unload() function
/**
* Provide a way to remove / undo any changes made
* either at the unloading of the script/add-on in which this function is used
* or at the unloading of the container, if provided
*
* @param callback
* function to call when unloading of the script or container.
* This function should undo all the changes made.
* @param container
* Optional, the scope of the function.
@grssam
grssam / quotes
Created May 28, 2012 13:38 — forked from paulrouget/quotes
What robcee says
<robcee> where's my hat?,
-------
<robcee> u r teh smartest,
-------
<robcee> I WILL TAKE THIS BULLET FOR YOU,
-------
* robcee swears violently
* robcee continues swearing,
-------
<robcee> hey everybody, forget email. Let's all go skiing. (toboggans also acceptable),
@grssam
grssam / restartCommand.js
Created June 26, 2012 14:05
restart command
/**
* Restart command
*
* @param number delay
* delay in seconds for the restart
* @param boolean disableFastload
* disabled loading from cache upon restart.
*
* Examples :
* >> restart
@grssam
grssam / sorttabs.js
Created June 26, 2012 18:11
Sorts Tabs
/**
* Sort Tabs command
*
* @param number url_part
* a matching string to match the url of tabs.
* if this value is provided, the tabs not matching the criteria would not be shifted.
* @param boolean reverse
* true for reversing the direction of sort
*/
@grssam
grssam / s.js
Created July 13, 2012 07:42 — forked from paulrouget/s.js
/* ------- */
// Clean mess from previous session
Components.utils.import("resource:///modules/source-editor.jsm");
let nbox = gBrowser.getNotificationBox();
while (nbox.lastChild.id == "foobar-container" ||
nbox.lastChild.id == "foobar-splitter") {
nbox.removeChild(nbox.lastChild);
}
/* ------- */
// Build container
@grssam
grssam / read_file_per_line.js
Created July 26, 2012 09:32
Read a local file line by line
let {Ci: interfaces, Cc: classes, Cu: utils} = Components;
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
let file = ios.newURI(<file address>, null, null).QueryInterface(Ci.nsIFileURL).file;;
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = /* The character encoding you want, using UTF-8 here */ "UTF-8";
let fis = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
fis.init(file, -1, -1, 0);
let lis = fis.QueryInterface(Ci.nsILineInputStream);
@grssam
grssam / exit.js
Created September 6, 2012 09:49
Exit command for GCLI
Components.utils.import("resource:///modules/devtools/gcli.jsm");
gcli.addCommand({
name: "exit",
description: "Exits GCLI and closes the Developer Toolbar",
returnType: "null",
exec: function Exit(args, context) {
let window = context.environment.chromeDocument.defaultView;
let document = window.document;