Skip to content

Instantly share code, notes, and snippets.

@kergalym
kergalym / SessionSaver.jsm
Created October 1, 2018 16:44
firefox-61.0/browser/components/sessionstore/SessionSaver.jsm
/* 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/. */
"use strict";
var EXPORTED_SYMBOLS = ["SessionSaver"];
ChromeUtils.import("resource://gre/modules/Timer.jsm", this);
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 26, 2024 21:58
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser! If you absolutely need to use browser instead of desktop app, use an extension to add the string Electron/ anywhere in your user-agent.

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
  2. Join a vc
  3. Stream any window (can be notepad or something)
  4. Press Ctrl+Shift+I to open DevTools
"use strict";
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
function useHttpServer() {
let server = new HttpServer();
server.start(-1);
Services.prefs.setCharPref(
"browser.region.network.url",
@hotsoft-desenv2
hotsoft-desenv2 / process-content.js
Created May 20, 2020 13:32
view-source:chrome://global/content/process-content.js
/* 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/. */
"use strict";
// Creates a new PageListener for this process. This will listen for page loads
// and for those that match URLs provided by the parent process will set up
// a dedicated message port and notify the parent process.
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
/*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 12e4b25ea66e1..5e1176d0806b8 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -17,6 +17,13 @@ const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
+XPCOMUtils.defineLazyGetter(this, "log", () => {
+ const { Logger } = ChromeUtils.import(
// Run me from a scratchpad.
(function() {
ChromeUtils.import("resource://gre/modules/SyncedBookmarksMirror.jsm");
ChromeUtils.import("resource://services-sync/util.js");
const RECORDS_TO_INSERT = 10000;
function randUpTo(n) {
return Math.floor(Math.random() * n);
}
@rhelmer
rhelmer / gist:b18f50f668b0d6336997c30f6727dcfd
Last active April 26, 2024 21:56
WIP moving shield-addon-utils in-tree
diff --git a/toolkit/components/extensions/ext-toolkit.json b/toolkit/components/extensions/ext-toolkit.json
--- a/toolkit/components/extensions/ext-toolkit.json
+++ b/toolkit/components/extensions/ext-toolkit.json
@@ -152,6 +152,14 @@
["runtime"]
]
},
+ "study": {
+ "url": "chrome://extensions/content/parent/ext-study.js",
+ "schema": "chrome://extensions/content/schemas/study.json",
@leplatrem
leplatrem / 0.md
Last active April 26, 2024 21:56
notes for Bug 1563226
var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
function objectConverter(columns) {
return new Function("d", "return {" + columns.map(function(name, i) {
return JSON.stringify(name) + ": d[" + i + '] || ""';
}).join(",") + "}");
}
function customConverter(columns, f) {
var object = objectConverter(columns);
return function(row, i) {
return f(object(row), i, columns);