Bug 208162

Summary: [WTF] Attach WARN_UNUSED_RETURN to makeScopeExit and fix existing wrong usage
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: Web Template FrameworkAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, benjamin, cdumez, cmarcelo, darin, dbates, emilio, esprehn+autocc, ews-watchlist, gyuyoung.kim, keith_miller, mark.lam, msaboff, rmorisset, rniwa, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 208171, 206343    
Attachments:
Description Flags
Patch rmorisset: review+

Description Yusuke Suzuki 2020-02-24 15:51:25 PST
Fix r254739.
Comment 1 Yusuke Suzuki 2020-02-24 16:03:00 PST
Created attachment 391592 [details]
Patch
Comment 2 Robin Morisset 2020-02-24 16:06:40 PST
Comment on attachment 391592 [details]
Patch

r=me
Comment 3 Yusuke Suzuki 2020-02-24 16:07:31 PST
Land it after ensuring all the EWS bots get green.
Comment 4 Saam Barati 2020-02-24 16:39:56 PST
Comment on attachment 391592 [details]
Patch

oops. r=me too
Comment 5 Yusuke Suzuki 2020-02-24 16:55:13 PST
OK, building worked. Landing.
Comment 6 Yusuke Suzuki 2020-02-24 16:57:48 PST
Committed r257285: <https://trac.webkit.org/changeset/257285>
Comment 7 Radar WebKit Bug Importer 2020-02-24 16:58:18 PST
<rdar://problem/59747287>
Comment 8 Darin Adler 2020-02-24 16:59:59 PST
Comment on attachment 391592 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391592&action=review

> Source/WebCore/html/HTMLLinkElement.cpp:305
> +            auto scopeExit = makeScopeExit([&] { m_isHandlingBeforeLoad = previous; });

Seems like for this we should figure out what behavior was broken by not setting m_isHandlingBeforeLoad to true, and make a test that would detect that mistake!
Comment 9 Yusuke Suzuki 2020-02-24 17:38:42 PST
Comment on attachment 391592 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391592&action=review

>> Source/WebCore/html/HTMLLinkElement.cpp:305
>> +            auto scopeExit = makeScopeExit([&] { m_isHandlingBeforeLoad = previous; });
> 
> Seems like for this we should figure out what behavior was broken by not setting m_isHandlingBeforeLoad to true, and make a test that would detect that mistake!

Yeah, look like we are lacking the test for this case. To me, this looks like HTMLLinkElement is detached and reinserted during emitting before-load event is attached, but need some investigation.
Filed https://bugs.webkit.org/show_bug.cgi?id=208171
Comment 10 Darin Adler 2020-02-24 17:46:59 PST
Comment on attachment 391592 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391592&action=review

>>> Source/WebCore/html/HTMLLinkElement.cpp:305
>>> +            auto scopeExit = makeScopeExit([&] { m_isHandlingBeforeLoad = previous; });
>> 
>> Seems like for this we should figure out what behavior was broken by not setting m_isHandlingBeforeLoad to true, and make a test that would detect that mistake!
> 
> Yeah, look like we are lacking the test for this case. To me, this looks like HTMLLinkElement is detached and reinserted during emitting before-load event is attached, but need some investigation.
> Filed https://bugs.webkit.org/show_bug.cgi?id=208171

Oh, I forgot that this was the one that inspired this entire exercise!
Comment 11 Yusuke Suzuki 2020-02-24 18:58:48 PST
Comment on attachment 391592 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391592&action=review

>>>> Source/WebCore/html/HTMLLinkElement.cpp:305
>>>> +            auto scopeExit = makeScopeExit([&] { m_isHandlingBeforeLoad = previous; });
>>> 
>>> Seems like for this we should figure out what behavior was broken by not setting m_isHandlingBeforeLoad to true, and make a test that would detect that mistake!
>> 
>> Yeah, look like we are lacking the test for this case. To me, this looks like HTMLLinkElement is detached and reinserted during emitting before-load event is attached, but need some investigation.
>> Filed https://bugs.webkit.org/show_bug.cgi?id=208171
> 
> Oh, I forgot that this was the one that inspired this entire exercise!

The good thing is that, we also found this case in JSC Parser.cpp :). While it is only used for debug assertions, anyway, having this annotation is super useful!
Thanks Emilio!