I've fussed over this making it better and better. I think we're ready for prime time. Patch to follow.
Looks good. Get input from some other folks, perhaps blake, I'm sure Phoenix can (and should) use this.
Created attachment 99450 [details] [diff] [review] nativeDOM.js v.1.1 I had rginda have a look at this from a JS standpoint. This fixes his issues: - Checks the exception for the one we want to eat, throws all others. - return null instead of undefined; undefined can be assigned to, null can't. - small optimization in getNativePropertyProxyFor() - remove unnecessary consts in _getNativesForProp()
Attachment #99392 - Attachment is obsolete: true
Comment on attachment 99450 [details] [diff] [review] nativeDOM.js v.1.1 sr=jag
Attachment #99450 - Flags: superreview+
Talking with jag on IRC, we came to the conclusion that an XPCOMProxy object would be a better idea. Clients would say something like... var proxy = new XPCOMProxy (obj); // create getter/setter pairs for these property names. proxy.fetch ("foo", "bar", ...); // for..in over this object, creating properties for each key found. property.fetch (Components.interfaces.nsIFoo);
16 years ago
Comment on attachment 99450 [details] [diff] [review] nativeDOM.js v.1.1 I have this working, but waiting on changes in bug 169321 to land first, since this relies on that.
Attachment #99450 - Flags: needs-work+
Oh, there is a workaround for that bug that brendan mentioned. I'll attach a patch anyway either later tonight or tomorrow morning that implements rginda's suggestion. I'd prefer to do this though with the fix in bug 169321.
I'm missing the motivation here -- can someone give a pep-talk? /be
Responded to Brendan via private e-mail.
Created attachment 107789 [details] [diff] [review] Updated patch Implements the syntax proposal from rginda and jag.
Attachment #99450 - Attachment is obsolete: true
16 years ago
Comment on attachment 107789 [details] [diff] [review] Updated patch sr=jst
Attachment #107789 - Flags: superreview?(jst) → superreview+
+ var ary = aName.match(/([^(]*)(\(\))?$/); + var name = ary; + + // If we are passed a string like "foo()", ary will be of type string, + // and contain "()". If passed "foo", then it will be of type undefined. + if (typeof ary === "string") + this._doImportMethod(name); + else + this._doImportProperty(name); IMHO this is very ugly. if (name.slice(-2) == "()") this._doImportMethod(name.slice(0, -2)); else this._doImportProperty(name);
Comment on attachment 107789 [details] [diff] [review] Updated patch Fix Neil's nit and r=jag
Attachment #107789 - Flags: review?(jaggernaut) → review+
Unless of course the regexp is faster than two slices.
Fix checked in.
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.