[webkit-reviews] review requested: [Bug 42613] WebScriptObject Should Allow Safely Checking For Key Existence : [Attachment 62031] [PATCH] Adds `hasWebScriptKey`

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 19 21:13:01 PDT 2010


Joseph Pecoraro <joepeck at webkit.org> has asked	for review:
Bug 42613: WebScriptObject Should Allow Safely Checking For Key Existence
https://bugs.webkit.org/show_bug.cgi?id=42613

Attachment 62031: [PATCH] Adds `hasWebScriptKey`
https://bugs.webkit.org/attachment.cgi?id=62031&action=review

------- Additional Comments from Joseph Pecoraro <joepeck at webkit.org>
Wise words of Geoff Garen:

> I agree that throwing an exception from valueForUndefinedKey: is
> fragile. It's unfortunate that NSObject chose an exception as the
> default implementation. Perhaps WebScriptObject should have overridden
> this behavior from the beginning. On the other hand, maybe overriding
> the default would have been confusing to authors used to the default.
> [...]
> 
> I know that Safari, at least, depends on the exception throwing
> behavior to detect properties that are not present. We could always
> change Safari, but I'm worried that other clients may have the same
> dependency. So I don't think we should change valueForUndefinedKey:.
> 
> Joe: The hasKey: addition sounds fine, with one modification:
> WebScriptObject is trying to conform to the key-value coding protocol,
> and it takes care to call out its own additions to the protocol
> using a special prefix. So, to match "removeWebScriptKey:", which
> is an addition to key-value coding, I would suggest "hasWebScriptKey:".

That is the approach I took here.


More information about the webkit-reviews mailing list