[webkit-reviews] review granted: [Bug 8791] XPath should support custom namespace resolvers : [Attachment 12910] proposed fix

bugzilla-request-daemon at macosforge.org bugzilla-request-daemon at macosforge.org
Sun Feb 4 18:26:47 PST 2007


Darin Adler <darin at apple.com> has granted Darin Adler <darin at apple.com>'s
request for review:
Bug 8791: XPath should support custom namespace resolvers
http://bugs.webkit.org/show_bug.cgi?id=8791

Attachment 12910: proposed fix
http://bugs.webkit.org/attachment.cgi?id=12910&action=edit

------- Additional Comments from Darin Adler <darin at apple.com>
When it comes to reducing the amount of code in CodeGeneratorJS.pm, I'm
suggesting that JSCustomXPathNSResolver have a function that can do this entire
job:

+		     push(@implContent, "	 RefPtr<XPathNSResolver>
customResolver;\n");
+		     push(@implContent, "	 XPathNSResolver* resolver =
toXPathNSResolver(args[$paramIndex]);\n");
+		     push(@implContent, "	 if (!resolver) {\n");
+		     push(@implContent, "	     customResolver =
JSCustomXPathNSResolver::create(exec, args[$paramIndex]);\n");
+		     push(@implContent, "	     if
(exec->hadException())\n");
+		     push(@implContent, "		 return
jsUndefined();\n");
+		     push(@implContent, "	     resolver =
customResolver.get();\n");
+		     push(@implContent, "	 }\n");

so that CodeGeneratorJS.pm has just a single function call, check for
exception/null and return of jsUndefined(), which amounts to about half as much
code as what's there now.

Seems like you could do something similar with CodeGeneratorObjC.pm, with a
single function that returns a PassRefPtr<XPathNSResolver>.

+#include "XPathNSResolver.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>

This requires only Forward.h, not PassRefPtr.h (occurs twice).

r=me



More information about the webkit-reviews mailing list