Skip to content

Instantly share code, notes, and snippets.

View MikeRatcliffe's full-sized avatar
😁

Mike Ratcliffe MikeRatcliffe

😁
View GitHub Profile
# HG changeset patch
# Parent d92174bd091849c9256d8e5841fd3e19e3e22aad
# User Michael Ratcliffe <mratcliffe@mozilla.com>
# 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
[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)

###Problem

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

// jQuery's proxy method.
let outer = {
  fn: {
    proxy: function(fn) {
 return function() {
// 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);
@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(() => {
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests that disabling JavaScript for a tab works as it should.
const TEST_URI = "http://mochi.test:8888/browser/browser/devtools/framework/" +
"test/browser_toolbox_options_disable_cache.html";
let doc;
let toolbox;
@MikeRatcliffe
MikeRatcliffe / gist:6522030
Last active December 22, 2015 19:49
Disable cache
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
docShell.defaultLoadFlags = Ci.nsIRequest.LOAD_BYPASS_CACHE |
Ci.nsIRequest.INHIBIT_CACHING;
window.location.reload(true);
let rootContainer = this.getContainer(this._rootNode);
rootContainer.childrenDirty = true;
this._updateChildren(rootContainer);
However before you post a message on the forum and to speed up things, don't forget to include as much informations as you can (if it's possible ;) ):
* The version of Cairo-Dock ('cairo-dock -v' in a terminal).
cairo-dock -v
cairo-dock: Symbol `g_openglConfig' has different size in shared object, consider re-linking
cairo-dock: Symbol `myDocksParam' has different size in shared object, consider re-linking
3.2.1
* Your GNU/Linux distribution (Debian, Ubuntu, Fedora, etc.).
Fedora 19

So you want to write an actor

Starting out with primitive types

So you have an idea for a Firefox developer tool. You (obviously) want it to work on Fennec and Firefox OS, so it needs to use the remote debugging protocol. You have a backend:

function SimpleBackend() { }

SimpleBackend.prototype = {