Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8802743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:09:46+00:00 2026-06-14T01:09:46+00:00

What is the simplest way to make the firefox addon, which repeats this chrome

  • 0

What is the simplest way to make the firefox addon, which repeats this chrome functionality:

chrome.webRequest.onBeforeRequest.addListener(
  function(info) {
    if(info.url.indexOf("notifier") + 1){
        return {redirectUrl: "https://domain.null/1.js"};
    }

  },
  {
    urls: [
      "*://domain2.null/*"
    ],
    types: ["script"]
  }, ["blocking"]);

I know about nsIContentPolicy in firefox, but I don’t understand how to use it.

All opinions, advice, and help will be appreciated

Answer

I’ve determined the problem with the restartless extension.
To block content we can use nsIContentPolicy as Wladimir said. We also can inject script to page with windowListener (aWindow.gBrowser).

For example, this practice works perfectly: https://github.com/jvillalobos/AMO-Admin-Assistant/blob/master/src/bootstrap.js

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:09:48+00:00Added an answer on June 14, 2026 at 1:09 am

    I don’t think that this can be done without major hacks right now. This is subject of bug 765934 that will add a redirectTo() method to the nsIHttpChannel interface. Once it is implemented code like this should work:

    const Ci = Components.interfaces;
    const Cu = Components.utils;
    
    Cu.import("resource://gre/modules/Services.jsm");
    Cu.import("resource://gre/modules/XPCOMUtils.jsm");
    
    var observer = {
      QueryInterface: XPCOMUtils.generateQI([
        Ci.nsIObserver,
        Ci.nsISupportsWeakReference
      ]),
    
      observe: function(subject, topic, data)
      {
        if (topic == "http-on-modify-request" &&
            subject instanceof Ci.nsIHttpChannel)
        {
          var uri = subject.URI;
          if (uri.host == "domain2.null" && /\.js(\?|$)/.test(uri.path))
          {
            var redirectUri = Services.io.newURI("https://domain.null/1.js",
                                                 null, null);
            subject.redirectTo(redirectUri);
          }
        }
      }
    };
    
    Services.obs.addObserver(observer, "http-on-modify-request", true);
    

    For reference: Services.jsm, XPCOMUtils.jsm, observer notifications, nsIHttpChannel, nsIURI

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the simplest way to make just this plot grayscale (or perhaps black
This question is somewhat related to What’s the simplest way to make a HTTP
The simplest way to follow this explanation is a NServiceBus Pub/Sub sample which contains
What is the easiest/simplest way to delay inside a function without having to delay
I'm looking for the simplest way to make text in the cells of a
What's the simplest way to make sure models trim leading and trailing white space
I have writen about custom IEnumerator . Whats the simplest way to make IEnumerable
What's the simplest way to find the path to the file in which I
What is the simplest way to make QWebView recognize and properly load Flash on
What is the simplest way to make a page accessible by username/password? In school

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.