From 35a9aaf421808f36db95154c953c04a3ae6a61d0 Mon Sep 17 00:00:00 2001 From: Bianca Danforth Date: Thu, 30 Aug 2018 17:47:40 -0700 Subject: [PATCH 1/2] Fix #41: Modify framing headers when extracting prices in background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the prohibitive 'x-frame-options' header from product pages attempting to load in our background page's iframe, so that they load successfully and the price for the product can be extracted. Also adds 'height' and 'width' to the background page iframes, so that their viewport sizes are comparable to that of a desktop computer for proximity-based Fathom rules. -- I’m going to explain how to check that it works, since it was confusing for me; there is one partial check and one more complete check: _Partial check: Demonstrates that the example page will not load as-is._ On [this page](https://www.amazon.com/KitchenAid-KL26M1XER-Professional-6-Qt-Bowl-Lift/dp/B01LYV1U30?smid=ATVPDKIKX0DER&pf_rd_p=0c7b792f-241a-4510-94f4-dd184a76f201&pf_rd_r=AZD7BGV3JZGTB23F30X3), for the `handleWebRequest` function in `./src/background/index.js`, if I just return `{responseHeaders: details.responseHeaders}` without modifying, I get the following errors: ``` Security Error: Content at https://www.amazon.com/KitchenAid-KL26M1XER-Professional-6-Qt-Bowl-Lift/dp/B01LYV1U30?smid=ATVPDKIKX0DER&pf_rd_p=0c7b792f-241a-4510-94f4-dd184a76f201&pf_rd_r=AZD7BGV3JZGTB23F30X3#moz-commerce-background may not load data from moz-extension://ccd17807-a1c5-9a4b-8e51-04ecfb6d7675/_generated_background_page.html. Load denied by X-Frame-Options: https://www.amazon.com/KitchenAid-KL26M1XER-Professional-6-Qt-Bowl-Lift/dp/B01LYV1U30?smid=ATVPDKIKX0DER&pf_rd_p=0c7b792f-241a-4510-94f4-dd184a76f201&pf_rd_r=AZD7BGV3JZGTB23F30X3#moz-commerce-background does not permit cross-origin framing. ``` If I remove the `x-frame-options` header completely and return the remaining headers, I get no errors. _Complete check: Demonstrates that two example pages load, one as-is (has no x-frame-options header) and one with modification (has an x-frame-options header)_ Also, I have verified that the `product_info.js` content script loads in the background