{"id":2715,"date":"2015-04-18T16:40:07","date_gmt":"2015-04-18T21:40:07","guid":{"rendered":"http:\/\/mikeconley.ca\/blog\/?p=2715"},"modified":"2023-12-20T16:25:11","modified_gmt":"2023-12-20T21:25:11","slug":"the-joy-of-coding-ep-9-more-view-source-hacking-2","status":"publish","type":"post","link":"https:\/\/mikeconley.ca\/blog\/2015\/04\/18\/the-joy-of-coding-ep-9-more-view-source-hacking-2\/","title":{"rendered":"The Joy of Coding (Ep. 10): The Mystery of the Cache Key"},"content":{"rendered":"<p>In this episode, I kept my camera off, since I was having some audio-sync issues<sup id=\"rf1-2715\"><a href=\"#fn1-2715\" title=\"I should have those resolved for Episode 11!\" rel=\"footnote\">1<\/a><\/sup>.<\/p>\n<p>I was also under some time-pressure, because I had a meeting scheduled for 2:30 ET<sup id=\"rf2-2715\"><a href=\"#fn2-2715\" title=\"And when the stream finished, I found out the meeting had been postponed to next week, meaning that next week will also be a short episode. :(\" rel=\"footnote\">2<\/a><\/sup>, giving me exactly 1.5 hours to do what I needed to do.<\/p>\n<p>And what did I need to do?<\/p>\n<p>I needed to figure out why an nsISHEntry, when passed to nsIWebPageDescriptor&#8217;s loadPage, was not enough to get the document out from the HTTP cache in some cases. 1.5 hours to figure it out &#8211; the pressure was on!<\/p>\n<p>I don&#8217;t recall writing a single line of code. Instead, I spent most of my time inside XCode, walking through various scenarios in the debugger, trying to figure out what was going on. And I eventually figured it out! Read this footnote for the TL;DR:<sup id=\"rf3-2715\"><a href=\"#fn3-2715\" title=\"Basically, the nsIChannel used to retrieve data over the network is implemented by HttpChannelChild in the content process. HttpChannelChild is really just a proxy to a proper nsIChannel on the parent-side. On the child side, HttpChannelChild does not implement nsICachingChannel, which means we cannot get a cache key from it when creating a session history entry. With no cache key, comes no ability to retrieve the document from the network cache via nsIWebDescriptor&#8217;s loadPage.\" rel=\"footnote\">3<\/a><\/sup><\/p>\n<p><a href=\"https:\/\/www.evernote.com\/l\/AbJQ_hIPJH1OuYDdwGUCMH7zi7L2bPIIhcw\">Episode Agenda<\/a><\/p>\n<h2>References<\/h2>\n<p><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1025146\">Bug 1025146 &#8211; [e10s] Never load the source off of the network when viewing source<\/a> &#8211; <a href=\"https:\/\/www.evernote.com\/l\/AbKJ3Z1m90ZLuZuThyXIsGaLuRi-dHUmETg\">Notes<\/a><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/air.mozilla.org\/the-joy-of-coding-mconley-livehacks-on-firefox-episode-10\/video\/\" width=\"896\" height=\"524\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<hr class=\"footnotes\"><ol class=\"footnotes\" style=\"list-style-type:decimal\"><li id=\"fn1-2715\"><p >I should have those resolved for Episode 11!&nbsp;<a href=\"#rf1-2715\" class=\"backlink\" title=\"Return to footnote 1.\">&#8617;<\/a><\/p><\/li><li id=\"fn2-2715\"><p >And when the stream finished, I found out the meeting had been postponed to next week, meaning that next week will also be a short episode. \ud83d\ude41&nbsp;<a href=\"#rf2-2715\" class=\"backlink\" title=\"Return to footnote 2.\">&#8617;<\/a><\/p><\/li><li id=\"fn3-2715\"><p >Basically, the nsIChannel used to retrieve data over the network is implemented by HttpChannelChild in the content process. HttpChannelChild is really just a proxy to a proper nsIChannel on the parent-side. On the child side, HttpChannelChild does not implement nsICachingChannel, which means we cannot get a cache key from it when creating a session history entry. With no cache key, comes no ability to retrieve the document from the network cache via nsIWebDescriptor&#8217;s loadPage.&nbsp;<a href=\"#rf3-2715\" class=\"backlink\" title=\"Return to footnote 3.\">&#8617;<\/a><\/p><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>In this episode, I kept my camera off, since I was having some audio-sync issues1. I was also under some time-pressure, because I had a meeting scheduled for 2:30 ET2, giving me exactly 1.5 hours to do what I needed to do. And what did I need to do? I needed to figure out why [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,874,1117,861,79],"tags":[1108,1069,125,1103,35,1126],"class_list":["post-2715","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-firefox-mozilla-2","category-livecoding","category-mozilla-2","category-technology","tag-cpow","tag-e10s","tag-firefox","tag-livehacking","tag-mozilla","tag-view-source"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prmTy-HN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2715","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/comments?post=2715"}],"version-history":[{"count":2,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2715\/revisions"}],"predecessor-version":[{"id":2717,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2715\/revisions\/2717"}],"wp:attachment":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/media?parent=2715"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/categories?post=2715"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/tags?post=2715"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}