Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
chillin

Jared Hirsch 6a68

🏖️
chillin
View GitHub Profile
@6a68
6a68 / foo.md
Created Jun 20, 2017
Firefox Browser Toolbox: just reopen it when you get NS_ERROR_CONNECTION_REFUSED :-)
View foo.md

I've seen this error so many times when I first open the Firefox Browser toolbox:

Error opening Browser Toolbox:
Component returned failure code: 0x804b000d (NS_ERROR_CONNECTION_REFUSED) [nsIInputStream.available]

The fix is almost always to close and reopen the toolbox, and it'll connect just fine.

@6a68
6a68 / foo.md
Last active May 9, 2017
Measuring the performance impact of Firefox Screenshots
View foo.md

I'm helping to land a Test Pilot experiment (Page Shot, now dubbed Firefox Screenshots) in Firefox.

We're landing it as a system addon~, preffed off, but it still has some unknown impact on memory consumption and startup performance.

This will be my first time profiling anything in Gecko, and it seems like it might be worth writing down my steps, both for others wanting to try it out, and to identify rough spots in the APIs or missing bits of documentation.

Steps:

@6a68
6a68 / foo.md
Last active Apr 10, 2017
how to get screenshots code into git-cinnabar to push to try
View foo.md

I keep forgetting this and relearning how to do it.

  1. apply patch from bug
    • go to bug 1346825

    • find the build system commit (currently attachment 8855871)

    • just apply the raw diff locally to the various files (for whatever reason, I often find patch barfs on the diff)

    • commit the changes locally

@6a68
6a68 / usps-phone-number.md
Created Apr 4, 2017
USPS customer service direct phone number
View usps-phone-number.md

The direct number to USPS customer service is: 678-279-7980.

Be prepared for a 30-60 minute wait, but you will actually speak to a person.


I spent hours digging through amazon/ebay/etc seller forums, and eventually uncovered the phone number above. When I called, I waited about an hour to speak to someone, then the person at the other end added a comment to my lost package case number, asking the person assigned to the case to actually work on it, and my

@6a68
6a68 / patch.diff
Created Mar 28, 2017
Patch that fixes browser/ test breakage
View patch.diff
diff --git a/browser/components/customizableui/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm
index aee38b72af35..cffbd5942c1d 100644
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -257,6 +257,20 @@ var CustomizableUIInternal = {
navbarPlacements.push("pocket-button");
}
+ function _screenshotsDisabled() {
+ return (Services.prefs.getPrefType("extensions.screenshots.system-disabled") &&
@6a68
6a68 / foo.js
Created Mar 15, 2017
trying to shutdown + restart embedded webextensions without a restart
View foo.js
// 1. This seems to work. Is it safe to use?
const { EmbeddedExtensionManager } = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
webext.started = false;
webext.startup(); // throws no errors, toolbar button reappears, messaging works
// 2. This doesn't work:
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
@6a68
6a68 / foo.md
Last active Mar 7, 2017
strings in page shot
View foo.md

strings in the page shot WebExtension

Total: 20 strings, 126 words

selector/ui.js

7 unique strings

24 words

@6a68
6a68 / foo.md
Created Nov 30, 2016
universal search: last minus one version
View foo.md
@6a68
6a68 / foo.md
Created Nov 30, 2016
universal search: last minus one version
View foo.md
@6a68
6a68 / foo.js
Created Nov 30, 2016
Firefox trick: use the hidden window to access DOM APIs without a window reference
View foo.js
// You may sometimes be doing something in non-UI add-on code,
// but want access to nice DOM APIs, like navigator.sendBeacon().
// Use the hidden window, which is accessible via the AppShell service:
// If you're in an SDK addon, do this to get a Cu reference:
// const { Cu } = require('chrome');
Cu.import('resource://gre/modules/Services.jsm');
// this is your window:
const win = Services.appShell.hiddenDOMWindow;
You can’t perform that action at this time.