{"id":246,"date":"2023-06-12T19:25:38","date_gmt":"2023-06-12T19:25:38","guid":{"rendered":"https:\/\/liverickson.com\/blog\/?p=246"},"modified":"2023-08-31T21:49:05","modified_gmt":"2023-08-31T21:49:05","slug":"til-adding-a-not-yet-landed-patch-into-my-local-firefox-build","status":"publish","type":"post","link":"https:\/\/liverickson.com\/blog\/?p=246","title":{"rendered":"TIL: Adding a Not-Yet-Landed Patch into my Local Firefox Build"},"content":{"rendered":"\n<p>I wrote a recent TIL about building Firefox from source, and it was in service of landing <a href=\"https:\/\/phabricator.services.mozilla.com\/D151319\">this particular patch<\/a>. Warning &#8211; there be demons ahead.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/liverickson.com\/blog\/wp-content\/uploads\/2023\/06\/image-1-1024x598.png\" alt=\"\" class=\"wp-image-247\" style=\"width:840px;height:490px\" width=\"840\" height=\"490\" srcset=\"https:\/\/liverickson.com\/blog\/wp-content\/uploads\/2023\/06\/image-1-1024x598.png 1024w, https:\/\/liverickson.com\/blog\/wp-content\/uploads\/2023\/06\/image-1-300x175.png 300w, https:\/\/liverickson.com\/blog\/wp-content\/uploads\/2023\/06\/image-1-768x448.png 768w, https:\/\/liverickson.com\/blog\/wp-content\/uploads\/2023\/06\/image-1.png 1199w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/figure>\n\n\n\n<p><strong>Local Firefox is built&#8230; now what?<\/strong><\/p>\n\n\n\n<p>I wanted to build Firefox from source in order to implement the changes found in the patch stack linked above. That&#8217;s the beauty of open source &#8211; I was able to be sent a patch that someone wrote last summer, and even though it hasn&#8217;t been made production-ready and merged, I can start working with it immediately. <\/p>\n\n\n\n<p>In theory, I could have used mercurial to cherry-pick these commits into my local version. I didn&#8217;t do that. Instead, I went through the 8-stack and started with the first dependency, copied the code down into my repo using a combination of vim and VSCodium (a version of VS Code that has the Microsoft bits stripped out). I re-built Firefox after each patch, to reduce the surface area for errors along the way. <\/p>\n\n\n\n<p>When I finally built the last of the eight patches, I went to the local URL <code>chrome:\/\/browser\/content\/history-plus\/index.html<\/code> as instructed in the Phabricator link, and&#8230; nothing.<\/p>\n\n\n\n<p><strong>CORS, Of Course<\/strong><\/p>\n\n\n\n<p>When I popped open the developer tools, I noticed that it was the dreaded CORS error. Now, I can sometimes work my way through these on a good day, when I&#8217;m not working with a home-grown browser stack, but today I had No Patience. YOLO. <\/p>\n\n\n\n<p>I changed some of the WARNING YOU MIGHT BREAK THINGS settings in <code>about:config<\/code>, specifically:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>security.fileuri.strict_origin_policy<\/code> (to false)<\/li>\n\n\n\n<li><code>security.mixed_content.block_active_content <\/code>(to false)<\/li>\n\n\n\n<li><code>security.mixed_content.block_display_content<\/code> (to true)<\/li>\n<\/ul>\n\n\n\n<p>I&#8217;m reasonably confident in my abilities and sandbox that I didn&#8217;t cause permanent harm for this particular use case, but if you&#8217;re a friendly and want to explain to me why I&#8217;m wrong, please do.<\/p>\n\n\n\n<p><strong>Wait, so what&#8217;s it actually doing?<\/strong><\/p>\n\n\n\n<p>The full Phabricator stack that I linked to above is doing a few different things:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>It&#8217;s enabling <a href=\"https:\/\/www.sqlite.org\/fts5.html\">FTS5 for SQLite,<\/a> which allows text search<\/li>\n\n\n\n<li>It&#8217;s creating a new actor to cache content from pages you visit, then storing this cache, compressed, into the SQLite database that is built-in to the browser<\/li>\n\n\n\n<li>It adds a script to scrape and fill out the history that gets cached (note: I&#8217;m not sure if the Marionette script is only required for testing, or if it&#8217;s necessary to have the functionality work. I included it)<\/li>\n\n\n\n<li>It adds a component to show the cached results to the <code>history-plus\/index.html<\/code> page. <\/li>\n<\/ol>\n\n\n\n<p><strong>Now what?<\/strong><\/p>\n\n\n\n<p>Now, the shiny screenshot you see above appears when I navigate to the index.html page of the history-plus component that I&#8217;ve added. When I visit new pages, they&#8217;re showing up here. If the page has proper metadata, there is some descriptive text that shows up (hence the presumed choice of &#8220;history-plus&#8221; &#8211; it&#8217;s your history, plus context from the page). <\/p>\n\n\n\n<p>There are a few things on my now-growing to-do list:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build this on my Mac<\/li>\n\n\n\n<li>Figure out how to fix my own site post metadata so that the summarized text shows up<\/li>\n\n\n\n<li>Poke around with the script to try to scrape more of the webpage content<\/li>\n\n\n\n<li>Find a way to interface with the SQLite DB on my local computer to ingest it in privateGPT.<\/li>\n<\/ul>\n\n\n\n<p>Happy Monday!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to build Firefox from source in order to implement the changes found in the patch stack linked above. That&#8217;s the beauty of open source &#8211; I was able to be sent a patch that someone wrote last summer, and even though it hasn&#8217;t been made production-ready and merged, I can start working with it immediately. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":0,"activitypub_interaction_policy_quote":"","activitypub_status":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=246"}],"version-history":[{"count":2,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/246\/revisions"}],"predecessor-version":[{"id":308,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/246\/revisions\/308"}],"wp:attachment":[{"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/liverickson.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}