Subj : Re: Class protection from multiple script execution using the same To : Matthew Mondor From : Brendan Eich Date : Mon Jul 26 2004 03:35 pm Matthew Mondor wrote: > I tried using JS_SealObject(), however this also caused assignments to > fail on existing properties in the user JS code, even if the properties > were not readonly. It really sealed it in that sense :). Indeed! > As a side note: I noticed that readonly properties cannot be assigned new > values from user code, as expected, but that it does not generate an error > of any kind. The operation just seems to silently be ignored. Is that the > intended behavior? Yes, per ECMA-262 Edition 3. Not what my JS implementations for Netscape did, but somehow the technical committee agreed on silent failure to change the value, with the result of the assignment being the right-hand side of assignment's value (which is misleading). Fooey. > If so, is there a way to track these user code bugs? > Perhaps overriding the setProperty() method or such in this case? Or using > debugger hooks? I did not attempt to use debugging features yet, but it > seems to be something I will have to do soon anyways for various reasons. You can use watchpoints, but they're not meant to scale up to a large set size. You could make the property read/write/shared, but in your setProperty hook, actually report an error and return false. That would emulate the pre-ECMA behavior of Netscape's JS implementations. > Thanks for the replies btw, you seem to be doing very good work on this > newsgroup answering technical questions of most postings, it is very > appreciated that you took the time to answer my questions. Thanks! Someone has to do it, and often Sterling or Shanti or another knowledgeable or on-the-ball hacker helps answer questions, so thanks to them too. /be .