What is this warning?

Bug reports and enhancement requests
Post Reply
luntrus
Senior Member
Posts: 237
Joined: Sat Mar 21, 2009 6:29 pm

What is this warning?

Post by luntrus »

Hi forum friends,

After getting the latest version of the NoScript extension, I get these warnings:

Code: Select all

Warning: reference to undefined property Components.classes['@maone.net/flashgot-service;1']
Source File: file:///C:/Documents%20and%20Settings/luntrus/Application%20Data/Mozilla/Firefox/Profiles/67qr1zqs.default/extensions/%7Bb9db16a4-6edc-47ec-a1f4-b86292ed211d%7D/components/dhFlashgotDownloadProcessor.js
Line: 23
What is this related to?
And then there is this:
Warning: reference to undefined property CI.nsIEventTarget.DISPACTH_NORMAL
Source File: chrome://noscript/content/Thread.js
Line: 102

Code: Select all

var Thread = {
  
  hostRunning: true,
  activeQueues: 0,
  activeLoops: 0,
  
  get canSpin() {
    delete this.canSpin;
    return this.canSpin = this.current instanceof CI.nsIEventTarget;
  },
  
  runWithQueue: function(callback) {
    var thread = this.current;
    thread instanceof CI.nsIThreadInternal;
    try {
      this.activeQueues++;
      thread.pushEventQueue(null);
      return callback();
    } finally {
      thread.popEventQueue();
      this.activeQueues--;
    }
  },
  
  spinWithQueue: function(ctrl) {
    return this.runWithQueue(function() { return Thread.spin(ctrl); });
  },
  
  spin: function(ctrl) { 
    if (!this.canSpin) throw new Error("Thread: can't spin!");

    ctrl.startTime = ctrl.startTime || Date.now();
    ctrl.timeout = false;
    this.activeLoops++;
    this._spinInternal(ctrl);
    this.activeLoops--;
    ctrl.elapsed = Date.now() - ctrl.startTime;
    return ctrl.timeout;
  },
  
  _spinInternal: function(ctrl) {
    var t = ctrl.startTime;
    var maxTime = parseInt(ctrl.maxTime)
    if (maxTime) {
      while(ctrl.running && this.hostRunning) {
        this.yield();
        if (Date.now() - t > maxTime) {
          ctrl.timeout = true;
          ctrl.running = false;
          break;
        }
      }
    } else while(ctrl.running && this.hostRunning) this.yield();
  },
  
  yield: function() {
    this.current.processNextEvent(true);
  },
  
  yieldAll: function() {
    var t = this.current;
    while(t.hasPendingEvents()) t.processNextEvent(false);
  },
  
  get current() {
    delete this.current;
    var obj = "@mozilla.org/thread-manager;1" in CC 
      ? CC["@mozilla.org/thread-manager;1"].getService() 
      : CC["@mozilla.org/thread;1"].createInstance(CI.nsIThread);
    this.__defineGetter__("current", function() { return obj.currentThread; });
    return this.current; 
  },
  
  get currentQueue() {
    delete this.currentQueue;
    var eqs = null;
    const CTRID = "@mozilla.org/event-queue-service;1";
    if (CTRID in CC) {
      const IFace = CI.nsIEventQueueService;
      eqs = CC[CTRID].getService(IFace);
    }
    this.__defineGetter__("currentQueue", eqs
      ? function() { return eqs.getSpecialEventQueue(IFace.CURRENT_THREAD_EVENT_QUEUE); }
      : this.__lookupGetter__("current")
    );
    return this.currentQueue;  
  },
  
  delay: function(callback, time, self, args) {
    CC["@mozilla.org/timer;1"].createInstance(CI.nsITimer).initWithCallback({
      notify: this._delayRunner,
      context: { callback: callback, args: args || [], self: self || null }
    }, time || 1, 0);
  },
  
  asap: function(callback, self, args) {
    if (this.canSpin) {
      this.current.dispatch({
        run: function() {
          callback.apply(self, args || []);
        }
      }, CI.nsIEventTarget.DISPACTH_NORMAL);
    } else {
      this.delay(callback, 0, self, args);
    }
  },
  
  _delayRunner: function() {
    var ctx = this.context;
    try {
      ctx.callback.apply(ctx.self, ctx.args);
    } finally {
      this.context = null;
    }
  }
  
} 
luntrus
Last edited by therube on Mon Jul 27, 2009 2:38 pm, edited 2 times in total.
Reason: make file:// line a bit more readable, complete
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2pre) Gecko/20090725 Shiretoko/3.5.2pre
User avatar
Giorgio Maone
Site Admin
Posts: 9526
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: What is this warning?

Post by Giorgio Maone »

They're both warnings, and both due to your javascript.options.strict about:config preference being set to true.
One is from DownloadHelper which is checking if FlashGot is installed, the other is from a typo (now fixed) in NoScript which did not affect its functionality either, though.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729)
luntrus
Senior Member
Posts: 237
Joined: Sat Mar 21, 2009 6:29 pm

Re: What is this warning?

Post by luntrus »

Hi Giorgio Maone,

I knew in advance these warnings did not affect the functionality of the extension as such, but I think you also like to have feed-back of this sort so you can brush up the code and put a finger to the pulse how smoothly your extension runs. Reference to undefined property etc. is one of the major warnings I get for instance for yarip status (outside this scope and another extensions alltogether)} and this Warning: reference to undefined property this[arguments[0]]
Source File: XPCSafeJSObjectWrapper.cpp
Line: 450
What is the major cause of the reference to undefined property warnings?

Furthermore I like to thank you for making me a bit more code savvy and alert to what happens under the hood in the Firefox browser. I owe these forums a lot. You sure know how to inspire folks in this fans of NoScript community,

luntrus
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.2pre) Gecko/20090725 Shiretoko/3.5.2pre
Post Reply