Subj : Re: [SpiderMonkey] JS_DefineObject returns null after moving to newest To : Brian Barnes From : Brendan Eich Date : Sat Jul 19 2003 10:16 am Brian Barnes wrote: > It's not throwing an error (should have mentioned that), but I > figured out what it is. This is behavior I depended on in 1.4 to > make objects you couldn't add properties to, so if you had mistyped > the name of a property you'd get a error instead of adding a new > property. > > I did this by hooking up a resolving function, i.e.: > > JSClass dim3_class={"dim3_class",JSCLASS_HAS_PRIVATE, > > JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub, > > JS_EnumerateStub,scripts_resolve_object,JS_ConvertStub,JS_FinalizeStub}; Ah, sorry I missed that resolve hook -- but I still wouldn't have known that was the problem, because there was no intentional change to cause defining a property (which should blow away any pre-existing property, unless you are passing in JSPROP_GETTER or JSPROP_SETTER) to lookup (which resolves). > scripts_resolve_object just always threw an error, but for me, every > ambiguous property was an error. Before it wasn't getting called on > JS_DefineObject, but now it is. So I have to think of some other way > around this -- I probably shouldn't have depended on this, anyway. > > I get the idea my little hack work isn't the proper way to do this :) Can you do me a favor and show me the stack backtrace when scripts_resolve_object is called indirectly from your (doomed to fail, with the new version of the engine) call to JS_DefineProperty? /be .