Skip to content

Instantly share code, notes, and snippets.

View jimblandy's full-sized avatar

Jim Blandy jimblandy

View GitHub Profile
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)
{
function createRootActor(aConnection)
{
let root = new RootActor(
aConnection,
{
tabList: [],
globalActorFactories: DebuggerServer.globalActorFactories,
});
root.applicationType = "content-child";
return root;
@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.
@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
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 / 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 = {};
@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 / IUbiCoreDump.idl
Created September 25, 2014 00:44
Proposed ubi::Node core dump API
/* 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/. */
#include "nsISupports.idl"
#include "nsIFile.idl"
[scriptable, uuid(bitter-hatred-towards-all-that-is-good-and-decent)]
interface IUbiCoreDump : nsISupports
{
@jimblandy
jimblandy / lazy-Debugger.Frame-invalidation.md
Last active August 29, 2015 14:13
Lazy Debugger.Frame invalidation

Lazy Debugger.Frame invalidation

I think there is a representation for Debugger.Frames that does not require frames to be removed from the Debugger::frames FrameMap when they are popped. It does still require prompt notification of:

  • frame pops for Debugger.Frame instances that have an onPop handler set, to report the pop to Debugger's users; and

  • changes of a frame's representation (on-stack replacement; bailouts; etc.), to update the key in the map.

Not needing to report pops comes at the cost of a more expensive validity check before using a Debugger.Frame. But even so, we should be able to skip this check in some circumstances.

@jimblandy
jimblandy / byteSize-of-string.js
Created February 23, 2015 21:58
ubi::Node::size test for JSStrings
// Check JS::ubi::Node::size results for strings.
// We actually hard-code specific sizes into this test, even though they're
// implementation details, because in practice there are only two architecture
// variants to consider (32-bit and 64-bit), and if these sizes change, that's
// something SpiderMonkey hackers really want to know; they're supposed to be
// stable.
// Run this test only if we're using jemalloc. Other malloc implementations
// exhibit surprising behaviors. For example, 32-bit Fedora builds have