[Webkit-unassigned] [Bug 31720] New: Incorrect code generated for IDL some attribute accessors
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 20 05:05:42 PST 2009
https://bugs.webkit.org/show_bug.cgi?id=31720
Summary: Incorrect code generated for IDL some attribute
accessors
Product: WebKit
Version: 528+ (Nightly build)
Platform: Macintosh
OS/Version: Mac OS X 10.5
Status: UNCONFIRMED
Severity: Minor
Priority: P2
Component: HTML DOM
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: patrik.j.persson at ericsson.com
Some exception specifications for DOM attribute accessors seem to
result in incorrect generated Objective-C++ code. I have seen two
cases, and suspect they are related, so I have bundled them into a
single report.
These cases are both based on an attribute named 'cookie', originally
specified in Document.idl as follows:
attribute [ConvertNullToNullString] DOMString cookie;
The observed output concerns the generated DOMDocument.mm.
I verified these results on r51076, host Mac OS X 10.6.2.
Nov 20, 2009.
CASE 1
======
The first case was encountered when trying to make the getter raise an
exception, but not the setter. I specified this in Document.idl as
follows:
attribute [ConvertNullToNullString] DOMString cookie
getter raises (DOMException);
I would expect the generated DOMDocument.mm to handle exceptions in
the getter, but not the setter. However, it seems to expect an
exception to be raised by the setter as well:
expected:
- (void)setCookie:(NSString *)newCookie
{
IMPL->setCookie(newCookie);
}
actual:
- (void)setCookie:(NSString *)newCookie
{
WebCore::ExceptionCode ec = 0;
IMPL->setCookie(newCookie, ec);
WebCore::raiseOnDOMError(ec);
}
A work-around appears to be to use a 'raises' clause with an empty
exception list:
attribute [ConvertNullToNullString] DOMString cookie
getter raises (DOMException),
setter raises (/*DOMException*/);
CASE 2
======
The second case was encountered when trying to make both setter and
getter raise exceptions. I believe this could be specified as follows:
attribute [ConvertNullToNullString] DOMString cookie
raises (DOMException);
This also resulted in incorrect generated code (Document.cpp raises
errors, but DOMDocument.mm does not expect them):
expected:
- (NSString *)cookie
{
WebCore::ExceptionCode ec = 0;
NSString *result = IMPL->cookie(ec);
WebCore::raiseOnDOMError(ec);
return result;
}
- (void)setCookie:(NSString *)newCookie
{
WebCore::ExceptionCode ec = 0;
IMPL->setCookie(newCookie, ec);
WebCore::raiseOnDOMError(ec);
}
actual:
- (NSString *)cookie
{
return IMPL->cookie();
}
- (void)setCookie:(NSString *)newCookie
{
IMPL->setCookie(newCookie);
}
A work-around appears to be separate 'raises' clauses for getter and
setter:
attribute [ConvertNullToNullString] DOMString cookie
getter raises (DOMException),
setter raises (DOMException);
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list