Skip to content

Instantly share code, notes, and snippets.

View domfarolino's full-sized avatar

Dominic Farolino domfarolino

View GitHub Profile

Link rel=stylesheet

Somehow make Link rel=stylesheet's [fetch and process the linked resource] algorithm do the following:

  • If el [contributes a script-blocking style sheet], increment el's [node document]'s [script-blocking style sheet counter by one.

(^Either by passing some custom steps to [default fetch and process the linked resource], or overriding the algorithm)

The [process the linked resource] algorithm for this type of resource is as follows, given el, success, and response:

  1. ...
diff --git a/third_party/blink/common/loader/throttling_url_loader_unittest.cc b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
index 592695073167..0d0d7b0ea2da 100644
--- a/third_party/blink/common/loader/throttling_url_loader_unittest.cc
+++ b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
@@ -513,10 +513,12 @@ TEST_F(ThrottlingURLLoaderTest, ModifyURLAndDeferRedirect) {
throttle_->set_will_start_request_callback(
base::BindRepeating([](blink::URLLoaderThrottle::Delegate* /* delegate */,
bool* defer) { *defer = true; }));
+ base::RunLoop run_loop;
+ auto quit_closure = run_loop.QuitClosure();
@domfarolino
domfarolino / format.sh
Last active December 3, 2022 18:53
clang-format on all C++ files in a directory
find . -maxdepth 20 -name \*.cc -not -path "./bazel*" -exec clang-format -i --style=Chromium {} > file \;
find . -maxdepth 20 -name \*.h -not -path "./bazel*" -exec clang-format -i --style=Chromium {} > file \;
# From https://stackoverflow.com/questions/28896909/
# find $PWD/base -type f \( -name "*.h" -o -name "*.cpp" \) -exec clang-format -style=Chromium --dry-run --Werror {} +
@domfarolino
domfarolino / file-descriptors.md
Last active May 22, 2023 13:12
Sending file descriptors over UNIX sockets

Sending file descriptors over UNIX sockets

When a process executes another process, either by one of the exec() family of functions, fork(), etc., the child process inherits all of the parent's file descriptors. This means if a parent has two file descriptors that are entangled (i.e., a read end and a write end), the parent process can simply write to the write end, and the child process can read from the read end.

 ┌────────────────┐