Skip to content

Instantly share code, notes, and snippets.

// Works fine
const { SearchService } = ChromeUtils.import(
"resource://gre/modules/SearchService.jsm"
);
but
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
@maximebories
maximebories / convert.md
Created March 30, 2023 20:04
FFmpeg command to convert webm to mp4 video files
ffmpeg -i input.webm -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k output.mp4

This ffmpeg command converts a .webm video file to a standard .mp4 file using the libx264 codec for video, aac codec for audio, and a CRF value of 22. The preset is set to 'slow' for higher quality encoding, and the audio bitrate is set to 128 kbps.

IndexedDB

  1. Set dom.indexedDB.storageOption.enabled to true, then restart the browser
  2. Go to a webpage, and in the devtools console, paste this in:
let request = indexedDB.open(name, { version: 1, storage: "persistent" });

DRM

commit e94e006c1126e4eea4889127b52fc2dc792a14b1
Author: Jason Laster <jlaster@mozilla.com>
Date: Sun May 3 21:22:43 2020 -0700
Add a new about-webreplay page
diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
index d4c0f2c39027..8ed25fc33431 100644
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
/* vim: sw=2 ts=2 sts=2 expandtab filetype=javascript
* 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 = [ "RelativeTimeUtils" ];
/**
@wellington1993
wellington1993 / Attachments.jsm
Created September 15, 2019 00:42
view-source:resource://services-settings/Attachments.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/. */
var EXPORTED_SYMBOLS = ["Downloader"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
script = """
ChromeUtils.import("resource://tps/tps.jsm");
ChromeUtils.import("resource://tps/auth/fxaccounts.jsm", TPS);
let callback = arguments[arguments.length - 1];
let account = {'username': 'test-7cf6790b64@restmail.net', 'password': 'bCWopzdr'}
async function signIn() {
await TPS.Authentication.signIn(account);
callback(true);
};
signIn();
@hotsoft-desenv2
hotsoft-desenv2 / XPCOMUtils.jsm
Created June 26, 2020 16:03
resource://gre/modules/XPCOMUtils.jsm
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
* vim: sw=2 ts=2 sts=2 et filetype=javascript
* 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/. */
/**
* Utilities for JavaScript components loaded by the JS component
* loader.
*
diff --git a/browser/components/BrowserContentHandler.jsm b/browser/components/BrowserContentHandler.jsm
--- a/browser/components/BrowserContentHandler.jsm
+++ b/browser/components/BrowserContentHandler.jsm
@@ -19,6 +19,7 @@ XPCOMUtils.defineLazyModuleGetters(this,
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
HeadlessShell: "resource:///modules/HeadlessShell.jsm",
HomePage: "resource:///modules/HomePage.jsm",
+ FirstStartup: "resource://gre/modules/FirstStartup.jsm",
LaterRun: "resource:///modules/LaterRun.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
{
"devtools.debugger.remote-enabled": true,
"latecustomization.manifestURL": "https://marketplace-dev.allizom.org/api/v2/late-customization/?carrier=telenor&region=ca",
"latecustomization.operatorInfo": { "operator": "acme", "region": "ca" }
}