Bug 78191

Summary: WebCore::Range's setStart() and setEnd() should be called with exception code variable
Product: WebKit Reporter: Sean Wang <xuewen.ok>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: rniwa, tonikitoo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: Other   
Attachments:
Description Flags
Patch ap: review-, ap: commit-queue-

Description Sean Wang 2012-02-08 18:29:36 PST
The declaration of WebCore::Range::setStart and WebCore::Range::setEnd are:
    void setStart(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
    void setEnd(PassRefPtr<Node> container, int offset, ExceptionCode& = ASSERT_NO_EXCEPTION);
They assert that the exception code parameter should not be bypassed, but in the WebCore::Range::Range(), it calls them without the ExceptionCode parameter, that will cause an assertion failure.
The code is at Source/WebCore/dom/Range.cpp:94
    setStart(startContainer, startOffset);
    setEnd(endContainer, endOffset);
Comment 1 Sean Wang 2012-02-08 19:47:52 PST
Created attachment 126225 [details]
Patch
Comment 2 Alexey Proskuryakov 2012-02-09 10:27:51 PST
Comment on attachment 126225 [details]
Patch

This change doesn't make sense to me. The whole reason for having a default argument is to not pass an argument explicitly.

Why is passing it explicitly needed in this particular case? Bug description says that an assertion is triggered, but ChangeLog says that no logic is changed. Does this fix an assertion failure or not? If there is an assertion sometimes, what test case triggers it?
Comment 3 Sean Wang 2012-03-28 01:02:53 PDT
Sorry, I misunderstood the macro ASSERT_NO_EXCEPTION.
So close this bug.