Post Reply 
Firefox Noscript and Sidki's JS Insertion
Mar. 03, 2009, 01:50 AM
Post: #18
RE: Firefox Noscript and Sidki's JS Insertion
I just had a brainwave; what if we create our own version of NoScript where all "http://local.ptron/" JS files are skipped, allowing them to load?

"\extensions\{73a6fe31-595d-460b-a920-fcc0f8843232}\components"
noscriptService.js, line 3390, the processScriptElements function.

Code:
processScriptElements: function(document, sites) {
    var scripts = document.getElementsByTagName("script");
    var scount = scripts.length;
    if (scount) {
      const HTMLElement = CI.nsIDOMHTMLElement;
      sites.scriptCount += scount;
      var script, scriptSrc;
      var nselForce = this.nselForce && sites.length && this.isJSEnabled(sites[sites.length - 1]);
      var isHTMLScript;
      while (scount-- > 0) {
        script = scripts.item(scount);
        isHTMLScript = script instanceof HTMLElement;
        if (isHTMLScript) {
          scriptSrc = script.src;
        } else if(script) {
          scriptSrc = script.getAttribute("src");
          if (!/^[a-z]+:\/\//i.test(scriptSrc)) continue;
        } else continue;
        
        scriptSrc = this.getSite(scriptSrc);
        if (scriptSrc) {
          sites.push(scriptSrc);
          if (nselForce && isHTMLScript && !this.isJSEnabled(scriptSrc)) {
            this.showNextNoscriptElement(script);
          }
        }
      }
    }
  },

We just need to throw in a "if (..src = "http://local.ptron") { ... } else { ... }" statement.

I wonder if there are any legal issues...

EDIT: Actually, I think it's around line 3339...
Visit this user's website
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Firefox Noscript and Sidki's JS Insertion - Guest - Sep. 07, 2008, 11:32 PM
RE: Firefox Noscript and Sidki's JS Insertion - Kye-U - Mar. 03, 2009 01:50 AM

Forum Jump: