Skip to content

Instantly share code, notes, and snippets.

// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@past
past / upgrade.patch
Created July 12, 2011 23:44
sample-debug-actors compatibility fix
diff --git a/install.rdf b/install.rdf
index 24209ac..32758b2 100644
--- a/install.rdf
+++ b/install.rdf
@@ -12,7 +12,7 @@
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> <!-- Firefox -->
<em:minVersion>7.0a1</em:minVersion>
- <em:maxVersion>7.0a1</em:maxVersion>
+ <em:maxVersion>8.0a1</em:maxVersion>
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource:///modules/devtools/gcli.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
var addonCommandSpec = {
name: 'addon',
description: 'Manipulate Add-ons'
}
var dbg = new Debugger();
for (var g of dbg.findAllGlobals())
try {
dbg.addDebuggee(g);
} catch (e) {
dump("ignoring the debugger's compartment\n");
}
for (var s of dbg.findScripts())
dump(s.url+"\n");
dump("Done.\n");
$ cat .mozconfig
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg
mk_add_options MOZ_MAKE_FLAGS="-s -j8"
ac_add_options --enable-debug
#ac_add_options --enable-optimize
ac_add_options --enable-profiling
ac_add_options --with-ccache
ac_add_options --enable-chrome-format=symlink
CC=clang
var windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let top = windowMediator.getMostRecentWindow("navigator:browser");
let browser = top.gBrowser.selectedBrowser;
let chromeWin = browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
let windowUtils = chromeWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
chromeWin;
/*
* Manually start and stop a debugger server.
* Run as a Scratchpad executing in a Browser context.
*/
Components.utils.import("resource://gre/modules/devtools/dbg-server.jsm");
var result;
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
result = DebuggerServer.openListener(6000);
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-ff-dbg
ac_add_options --enable-debug
ac_add_options --enable-optimize
ac_add_options --enable-profiling
ac_add_options --with-ccache
ac_add_options --enable-chrome-format=symlink
CC=clang
CXX=clang++
diff --git a/toolkit/devtools/debugger/server/dbg-script-actors.js b/toolkit/devtools/debugger/server/dbg-script-actors.js
--- a/toolkit/devtools/debugger/server/dbg-script-actors.js
+++ b/toolkit/devtools/debugger/server/dbg-script-actors.js
@@ -502,6 +502,7 @@ ThreadActor.prototype = {
let breakpoints = this._breakpointStore[aLocation.url];
let actor;
+try {
if (breakpoints[aLocation.line].actor) {
actor = breakpoints[aLocation.line].actor;
var Ci = Components.interfaces;
var Cc = Components.classes;
let eventListenerService = Cc["@mozilla.org/eventlistenerservice;1"]
.getService(Ci.nsIEventListenerService);
let dbg = new Debugger();
let DOwindow = dbg.addDebuggee(content.window);
let nodes = content.window.document.querySelectorAll("*");