[Project_owners] Problem with JSLib on trunk (Gecko 1.9.1)

Pete Collins pete at mozdevgroup.com
Mon Nov 3 06:35:09 PST 2008


There is a new File global script object now?

Ideally I think jsLib should go in the direction of putting all it's 
objects behind a jslib namespace.

This will however break backwards compatibility and that is something I 
don't want do.

You might need to do this:

  File = null;
  include(jslib_file);

  var f = new File(du.getPrefsDir());

Right here is where the global object is defined:

  
http://mxr.mozilla.org/mozilla-central/source/dom/src/base/nsDOMClassInfo.cpp#3447

I think it should be called "DOMFile" and *not* "File".

--pete


Philip Chee wrote:
> On trunk the following code doesn't work:
>
> var du = new DirUtils();
> var f = new File(du.getPrefsDir());
>
> The second line causes the error:
>
> Error: Cannot convert WrappedNative to function =
> NS_ERROR_XPC_CANT_CONVERT_WN_TO_FUN
>
> Looking at the properties of File.prototype I get:
>
> Properties for object:
> [xpconnect wrapped native prototype]
>
>
> getAsText: function getAsText() {
>     [native code]
> }
> getAsDataURL: function getAsDataURL() {
>     [native code]
> }
> getAsBinary: function getAsBinary() {
>     [native code]
> }
>
> This doesn't look like the jslib File() object at all. Looking through
> DevMo I see that nsIDOMFile was added in Firefox 3. So it seems we have
> a namespace clash.
>
> <https://developer.mozilla.org/En/NsIDOMFile>
>
> Unfortunately the extension I'm trying to update (Cookie Panel) is
> orphaned, so I don't know what to do. On the JSLib side I guess you
> could rename their File() object to JslibFile() or namespace it to
> JsLib.File()
>
> Phil
>
>   

-- 
Pete Collins - Founder, Mozdev Group Inc.
www.mozdevgroup.com
Mozilla Software Development Solutions
tel: 1-719-302-5811
fax: 1-719-302-5813



More information about the Project_owners mailing list