Skip to content

Instantly share code, notes, and snippets.

View juliandescottes's full-sized avatar

Julian Descottes juliandescottes

View GitHub Profile
@juliandescottes
juliandescottes / MARIONETTE_NOTES.md
Last active March 21, 2024 09:21
Marionette notes

Wep Platform Tests

Update metadata

./mach wpt-update /Users/jdescottes/Development/wpt-update/

After downloading the relevant wpt-report.json files from try. Always try to take a variety of platforms (eg 1 linux 1 android, or more generally one which fails for specific conditions and a successful one).

View WPT tests differences

function matchURLPattern(pattern, input) {
return pattern.test(input);
}
function parseURLPattern(patternObj) {
if (patternObj.type === "string") {
return new URLPattern(patternObj.pattern);
} else {

WebDriver BiDi

Support custom browser to client messages

  • to install and to remove pre-load (bootstrap) -> "to add and to remove" (to be in sync with the command names?)

Two suggestions below to slightly rephrase some paragraphs in the code example:

  • While this was already helpful to just call those pre-defined functions from within any script.evaluate or script.callFunction command their return value needed to be returned via the command’s response.

-> "This was already helpful to perform some setup logic, or to expose functions that could be called from script.evaluate or script.callFunction commands later on. However there was no way to properly handle dynamic situations, like monitoring DOM mutations and notify the client about the details."

// Here goes the list of tests from the manifest, with the skip-if etc...
const tests = ``;
// JS and python don't follow the same alphabetical order for special characters
// the safest is to take the output from the linter and add it here.
const expectedOrder = ``.split("\n");
const sortTests = str => {
const lines = str.split("\n");
const tests = [];
@juliandescottes
juliandescottes / the-one-bookmarklet.js
Created December 2, 2014 22:19
Spawn a tiny UI to create a bookmarklet. (see comment for the bookmark-ready javascript code)
(function () {
/**
* Adapted from http://ted.mielczarek.org/code/mozilla/bookmarklet.html
*/
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// PARADOX ! Inception-style
var paradox = function(setSize,p){
Math.sqrt(2*setSize*Math.log(1/(1-p)))
};
// So that's the generic formula.
// Applied to the usual "over 50% of prob to have 2 people with the same birthday"
paradox(365, 0.5); // => 22.49
# coding=UTF-8
import base64
import contextlib
import os
import pdb
import struct
import time
import urllib
from datetime import datetime
@juliandescottes
juliandescottes / createmessagehandler.js
Last active February 10, 2022 16:36
createmessagehandler.js
const { RootMessageHandlerRegistry } = ChromeUtils.import(
"chrome://remote/content/shared/messagehandler/RootMessageHandlerRegistry.jsm"
);
const { RootMessageHandler } = ChromeUtils.import(
"chrome://remote/content/shared/messagehandler/RootMessageHandler.jsm"
);
const { WindowGlobalMessageHandler } = ChromeUtils.import(
"chrome://remote/content/shared/messagehandler/WindowGlobalMessageHandler.jsm"
);
const moduleLayout = {
root: {
windowglobal: {},
contentprocess: {
worker: {},
},
},
};
@juliandescottes
juliandescottes / mass_alert_acknowledge.js
Created August 23, 2021 08:41
Acknowledge alers on Perfherder UI
function getPageNumber() {
const previous = document.querySelector("[aria-label='Previous']");
return previous.closest("[aria-label*='Page']").getAttribute("aria-label").replace("Page ", "") * 1;
}
(async () => {
while (getPageNumber() > 1) {
document.querySelectorAll("[data-testid*='summary'].form-check-input").forEach(e => e.click())
await new Promise(r => setTimeout(r, 3000));
document.querySelectorAll('.btn-secondary [data-icon="check"]').forEach(e => e.parentNode.click())