[Project_owners] Re: JavaScript Error: "redeclaration of const JS_LIB_LOADED"

Pete Collins pete at mozdevgroup.com
Wed Oct 26 10:27:18 EDT 2005


>
>Well now the error just moves to the next line:
>
>Error: [JavaScript Error: "redeclaration of const JS_LIBRARY" {file:
>"chrome://mozimage/content/jslib.js" line: 7}]
>Source File: chrome://mozimage/content/jslib.js
>Line: 7
>
>  
>

Yea, one way to avoid this problem is for jsLib clients to initialize 
jsLib using it's initializer

  jslib.init(this);

This is the recommended way to initialize jsLib.

This type of problem will happen w/ any javascript file that is included 
twice or loaded into the same context twice..

eg:
  <script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js" />
  <script type="application/x-javascript" 
src="chrome://jslib/content/jslib.js" />


This above can happen is jslib is used in a xul file and then an overlay ...

I'll see if I can come up w/ and easy way to avoid these errors without 
risking too much regression ....

Do note that using the try block will prevent script execution outside 
of the reloaded file from stopping so for now these are just annoying 
errors.

--pete

-- 
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