Skip to content

Instantly share code, notes, and snippets.

View MikeRatcliffe's full-sized avatar
😁

Mike Ratcliffe MikeRatcliffe

😁
View GitHub Profile
@MikeRatcliffe
MikeRatcliffe / gist:8862556
Last active August 29, 2015 13:56
Why would this HighlighterActor method return too early?
/**
* Why would "node-highlight" be emitted before showBoxModel() is called.
*
* From logging I can clearly see initInspector > "node-highlight" > showBoxModel
**/
highlightNodeFront: function(nodeFront, options={}) {
let deferred = promise.defer();
...
this.toolbox.initInspector().then(() => {
// A listener is added in rule-view.js:
this.valueSpan.addEventListener("click", (event) => {
let target = event.target;
if (target.nodeName === "a") {
event.stopPropagation();
event.preventDefault();
this.browserWindow.openUILinkIn(target.href, "tab");
}
}, false);

###Problem

jQuery and other libraries often use a poor man's bind:

// jQuery's proxy method.
let outer = {
  fn: {
    proxy: function(fn) {
 return function() {
[53015] ###!!! ABORT: file /Users/mratcliffe/Desktop/fx-team/ipc/chromium/src/base/histogram.cc, line 732
#01: (anonymous namespace)::JSHistogram_Add(JSContext*, unsigned int, JS::Value*) (Telemetry.cpp:1205, in XUL)
#02: js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) (jscntxtinlines.h:232, in XUL)
#03: Interpret(JSContext*, js::RunState&) (Interpreter.cpp:2517, in XUL)
#04: js::RunScript(JSContext*, js::RunState&) (Interpreter.cpp:432, in XUL)
#05: js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) (Interpreter.cpp:501, in XUL)
#06: js::CallOrConstructBoundFunction(JSContext*, unsigned int, JS::Value*) (jsfun.cpp:1572, in XUL)
#07: js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) (jscntxtinlines.h:232, in XUL)
#08: Interpret(JSContext*, js::RunState&) (Interpreter.cpp:2517, in XUL)
#09: js::RunScript(JSContext*, js::RunState&) (Interpreter.cpp:432, in XUL)
# HG changeset patch
# Parent d92174bd091849c9256d8e5841fd3e19e3e22aad
# User Michael Ratcliffe <[email protected]>
# Date 1415801786 0
Bug 1091796 - Add a telemetry probe to track dark theme usage r=pbrosset,bgrins,me
diff --git a/browser/base/content/browser-devedition.js b/browser/base/content/browser-devedition.js
--- a/browser/base/content/browser-devedition.js
+++ b/browser/base/content/browser-devedition.js
@MikeRatcliffe
MikeRatcliffe / gist:23bdfb9f9cc061c73366
Created March 10, 2015 14:48
Storage Actor Message Passing
diff --git a/toolkit/devtools/server/actors/childtab.js b/toolkit/devtools/server/actors/childtab.js
--- a/toolkit/devtools/server/actors/childtab.js
+++ b/toolkit/devtools/server/actors/childtab.js
@@ -24,16 +24,18 @@ let { TabActor } = require("devtools/ser
*/
function ContentActor(connection, chromeGlobal)
{
this._chromeGlobal = chromeGlobal;
TabActor.call(this, connection, chromeGlobal);
this.traits.reconfigure = false;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>zzz</string>
</array>
<key>name</key>
@MikeRatcliffe
MikeRatcliffe / MozillaTest.tmLanguage
Created March 26, 2015 13:09
MozillaTest.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>test</string>
</array>
<key>name</key>
<string>Mozilla Test Output</string>
@MikeRatcliffe
MikeRatcliffe / MachBuildOutput.tmLanguage
Created March 26, 2015 13:12
MachBuildOutput.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>out</string>
</array>
<key>name</key>
/* 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/. */
"use strict";
const {Cu, Cc, Ci} = require("chrome");
const events = require("sdk/event/core");
const protocol = require("devtools/server/protocol");
try {