Introduction
Requestly is a beautiful chrome extension for modifying network requests. It has hit the ground hard and announced its presence in market sound and fair. Its usage has grown tremendously over last few months. As of March 2016, Chrome store shows 7.5K users. Due to simple interface with infinite possibilities it is becoming popular among web devs for testing and debugging purposes. I have received multiple requests for developing Requestly on Firefox. It was certainly not easy to build Requestly with Firefox Add-On APIs but the support of Web Extension APIs in Firefox has made the job easy. This article is the first step in direction for porting Requestly to Firefox.
Analysis of Chrome APIs Incompatibilities
- Content Scripts: Supported
- Background Scripts: Supported
- Storage API: Partially Supported with following road blockers:
chrome.storage.sync
is not supported. We can use ‘chrome.storage.local` for the time.chrome.storage
is not accessible in Content Scripts. Bugzilla Link
- NameSpacing: Currently all APIs are accessible through
chrome.*
but later on this will be moved tobrowser.*
- Does not require immediate change but we may have to modularize the code using browserify and instantiate different packages for different browsers
- Packaging: Firefox needs
xpi
extension instead ofzip
.
- This is in roadmap that webextensions should be accepted as zip but initially we may have to rename zip to xpi before uploading to FF store.
- Tabs: Partially Supported for our needs.
- In Firefox, you need the
tabs
permission if you want to include url in the queryInfo parameter totabs.query()
- webRequest: Partially supported but meets our needs.
- In Firefox requests can be redirected only if their original URL uses the http or https scheme
- Manifest: Firefox manifest.json has mandatory
applications
key and we can’t use this in chrome extensions.
- We need to maintain two different manifest files for chrome and browser and build system should pick them as per browser.
- Context Menus: Partially supported.
page_action
andbrowser_action
are not supported.
- We need to change
browser_action
toall
for the time this is supported in firefox.
For More details, Refer Mozilla documentation on chrome APIs Incompatibilities