Bug 208162 - [WTF] Attach WARN_UNUSED_RETURN to makeScopeExit and fix existing wrong usage
Summary: [WTF] Attach WARN_UNUSED_RETURN to makeScopeExit and fix existing wrong usage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks: 208171 206343
  Show dependency treegraph
 
Reported: 2020-02-24 15:51 PST by Yusuke Suzuki
Modified: 2020-02-24 18:58 PST (History)
18 users (show)

See Also:


Attachments
Patch (3.93 KB, patch)
2020-02-24 16:03 PST, Yusuke Suzuki
rmorisset: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!