[Project_owners] privileged and unprivileged javascript prototypes

Eric Jung grimholtz at yahoo.com
Sun Nov 6 17:22:39 EST 2005


Thanks, Neil. I'd like to execute this code for every window, then.
So what I tried was:

In XUL overlay:
  window.addEventListener("load", function() {myext.init();}, false);

In myext.js:

  var myext = {

    init : function() {
      document.getElementById("appcontent")
        .addEventListener("load", this.pageLoad, true);
    },

    pageLoad : function() {
      String.prototype.foo = "foo";
    }
  };

Yet this attribute/property still doesn't seem available in HTML
pages. I suspect I must somehow get the Window object in pageLoad()
and call String.prototype.foo on that. Is that correct?

Thank you very much,
Eric Jung


--- Neil <neil at parkwaycc.co.uk> wrote:

> Eric Jung wrote:
> 
> >In my extension, I write:
> >
> >  String.prototype.foo = "foo";
> >
> >The foo property/attribute is then accessible in my extension on
> all String objects, but not on String objects created in javascript
> from remote websites (i.e., outside my extension). Is there any way
> to make this property/attribute available to them, as well?
> >  
> >
> Each window has its own String prototype
> (theWindow.String.prototype).
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



		
__________________________________ 
Start your day with Yahoo! - Make it your home page! 
http://www.yahoo.com/r/hs


More information about the Project_owners mailing list