Skip to content

Instantly share code, notes, and snippets.

View jimblandy's full-sized avatar

Jim Blandy jimblandy

View GitHub Profile
@jimblandy
jimblandy / OSX PATH encoding
Created September 24, 2014 19:04
On OSX, the PATH environment variable may contain non-ASCII characters; python/which/which.py should handle those.
diff --git a/python/which/which.py b/python/which/which.py
--- a/python/which/which.py
+++ b/python/which/which.py
@@ -158,16 +158,18 @@ def whichgen(command, path=None, verbose
command>, <where path found>).
"""
matches = []
if path is None:
usingGivenPath = 0
path = os.environ.get("PATH", "").split(os.pathsep)
@jimblandy
jimblandy / functionDisplayName.js
Last active August 29, 2015 14:00
Firefox chrome JS function to return a function's inferred display name.
Cu.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
function functionDisplayName(obj) {
var dbg = new Debugger;
var globalDO = dbg.addDebuggee(new Components.utils.Sandbox(this));
return globalDO.makeDebuggeeValue(obj).unwrap().displayName;
};
var obj = {};
diff --git a/toolkit/devtools/client/dbg-client.jsm b/toolkit/devtools/client/dbg-client.jsm
--- a/toolkit/devtools/client/dbg-client.jsm
+++ b/toolkit/devtools/client/dbg-client.jsm
@@ -1055,7 +1055,7 @@ ThreadClient.prototype = {
after: function (aResponse) {
if (aResponse.error) {
// There was an error resuming, back to paused state.
- self._state = "paused";
+ this._state = "paused";
}
@jimblandy
jimblandy / gist:5682302
Created May 31, 2013 00:39
Move some debugger utility functions into their own JSM.
# HG changeset patch
# Parent 015b63c17e3997e8594ed973c3ec87be64dfc284
diff --git a/toolkit/devtools/DevToolsUtils.jsm b/toolkit/devtools/DevToolsUtils.jsm
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/DevToolsUtils.jsm
@@ -0,0 +1,93 @@
+/* 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
@jimblandy
jimblandy / gist:5672487
Created May 29, 2013 18:17
Proposed doc fixes for ThreadSources and friensd
# HG changeset patch
# Parent 2614431da3808090e45d804c1e2e98d3a737a442
diff --git a/toolkit/devtools/client/dbg-client.jsm b/toolkit/devtools/client/dbg-client.jsm
--- a/toolkit/devtools/client/dbg-client.jsm
+++ b/toolkit/devtools/client/dbg-client.jsm
@@ -1064,7 +1064,8 @@ ThreadClient.prototype = {
after: function (aResponse) {
if (aResponse.error) {
// There was an error resuming, back to paused state.
function createRootActor(aConnection)
{
let root = new RootActor(
aConnection,
{
tabList: [],
globalActorFactories: DebuggerServer.globalActorFactories,
});
root.applicationType = "content-child";
return root;
Make nsServerSocket::InitWithAddress provide more detailed error results.
try: -b do -n -p all -u all -t none
https://tbpl.mozilla.org/?tree=Try&rev=901415367701
diff --git a/netwerk/base/src/nsServerSocket.cpp b/netwerk/base/src/nsServerSocket.cpp
--- a/netwerk/base/src/nsServerSocket.cpp
+++ b/netwerk/base/src/nsServerSocket.cpp
@@ -289,7 +289,7 @@ nsServerSocket::InitWithAddress(const PR
if (!mFD)
{
Add support for Unix-domain sockets to nsIServerSocket.idl and @mozilla.org/network/server-socket;1.
diff --git a/netwerk/base/public/nsIServerSocket.idl b/netwerk/base/public/nsIServerSocket.idl
--- a/netwerk/base/public/nsIServerSocket.idl
+++ b/netwerk/base/public/nsIServerSocket.idl
@@ -95,6 +95,54 @@ interface nsIServerSocket : nsISupports
[noscript] void initWithAddress([const] in PRNetAddrPtr aAddr, in long aBackLog);
/**
+ * initWithFilename

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(target) { this.target() }

SimpleBackend.prototype = {

js> var parentMM = Components.classes['@mozilla.org/parentprocessmessagemanager;1'].getService(Components.interfaces.nsIMessageBroadcaster)
js> parentMM.loadFrameScript
function loadFrameScript() {
[native code]
}
js> parentMM.loadFrameScript('file:///home/jimb/moz/printfoo.js')
[Parent 31198] ###!!! ASSERTION: hmm? CanCallNow failed in XPCWrappedNative::CallMethod. We are finding out about this late!: 'rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO', file /home/jimb/moz/dbg/js/xpconnect/src/XPCWrappedNative.cpp, line 2344
typein:18: NS_NOINTERFACE: Component does not have requested interface [nsIFrameScriptLoader.loadFrameScript]
js>