Skip to content

Instantly share code, notes, and snippets.

View fitzgen's full-sized avatar
🙃

Nick Fitzgerald fitzgen

🙃
View GitHub Profile
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
function openToolbox() {
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.showToolbox(target, "jsdebugger");
}
function closeToolbox() {
let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
return gDevTools.closeToolbox(target);
function* asyncIterator() {
let value, done;
while ({value, done} = (yield null), !done) {
console.log("got", value);
}
console.log("done");
}
it = asyncIterator();
it.next();
Cu.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
let browser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
let contentWindow = browser.contentWindow;
let dbg = new Debugger(contentWindow);
let start = Date.now();
dbg.memory.captureDominatorTree(contentWindow)
"use strict";
var immut = (function () {
var descriptor = {
value: null
};
return function immut() {
if (arguments.length % 2 !== 0)
# Proposed Format
{
...
7. sources: ["baz.ts", "foo.js", "bar.js"]
...
9. mediaTypes: ["application/javascript", "application/x.typescript"],
10. sourcesMediaTypes: "CAA",
}
diff --git a/browser/devtools/debugger/test/head.js b/browser/devtools/debugger/test/head.js
index 1c97620..5dd4070 100644
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -734,17 +734,24 @@ function closeDebuggerAndFinish(aPanel, aFlags = {}) {
"unless you're absolutely sure about what you're doing.");
}
return teardown(aPanel, aFlags).then(finish);
}
var d = Object.create(Date.prototype);
Date.call(d);
d instanceof Date // true
d.getTime() // throws an Error!
let foo = 1;
let bar = 2;
let obj = { foo, bar };
obj.foo // 1
obj.bar // 2
var smc = new SourceMapConsumer(theSourceMapJSON);
var smg = SourceMapGenerator.fromSourceMap(smc);
smc.sources.forEach(function (s) {
smg.setSourceContent(s, somehowGetTheSourceContentsOf(s));
});
// This is your modified map.
smg.toJSON();
@fitzgen
fitzgen / gist:95f8b2ea672d773f3537
Created August 2, 2014 22:12
Generators + prototypes
function* G() { yield this.x; }
G.prototype = { x: 5 };
console.log([...G()]);