Porting Requestly to Firefox as Web Extension

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

  1. Content Scripts: Supported
  2. Background Scripts: Supported
  3. 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
  4. NameSpacing: Currently all APIs are accessible through chrome.* but later on this will be moved to browser.*
    • Does not require immediate change but we may have to modularize the code using browserify and instantiate different packages for different browsers
  5. Packaging: Firefox needs xpi extension instead of zip.
    • 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.
  6. Tabs: Partially Supported for our needs.
    • In Firefox, you need the tabs permission if you want to include url in the queryInfo parameter to tabs.query()
  7. webRequest: Partially supported but meets our needs.
    • In Firefox requests can be redirected only if their original URL uses the http or https scheme
  8. 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.
  9. Context Menus: Partially supported. page_action and browser_action are not supported.
    • We need to change browser_action to all for the time this is supported in firefox.

For More details, Refer Mozilla documentation on chrome APIs Incompatibilities

  1. Mozilla Web Extension Wiki
  2. Porting Chrome Extension to FF Web Extension
  3. Requestly Github Issue
comments powered by Disqus