WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
179981
Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
https://bugs.webkit.org/show_bug.cgi?id=179981
Summary
Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code s...
Darin Adler
Reported
2017-11-23 12:19:17 PST
Fix dictionary leak in lookup, convert FindOptions to OptionSet, tweak code style nearby
Attachments
Patch
(123.45 KB, patch)
2017-11-23 13:06 PST
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(125.79 KB, patch)
2017-11-23 19:21 PST
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews126 for ios-simulator-wk2
(2.12 MB, application/zip)
2017-11-23 20:53 PST
,
EWS Watchlist
no flags
Details
Patch
(126.20 KB, patch)
2017-11-24 11:33 PST
,
Darin Adler
sam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2017-11-23 13:06:13 PST
Comment hidden (obsolete)
Created
attachment 327512
[details]
Patch
EWS Watchlist
Comment 2
2017-11-23 13:08:34 PST
Comment hidden (obsolete)
Attachment 327512
[details]
did not pass style-queue: ERROR: Source/WTF/wtf/OptionSet.h:133: Missing spaces around | [whitespace/operators] [3] ERROR: Source/WTF/wtf/OptionSet.h:138: Missing spaces around | [whitespace/operators] [3] Total errors found: 2 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3
2017-11-23 19:21:51 PST
Comment hidden (obsolete)
Created
attachment 327520
[details]
Patch
EWS Watchlist
Comment 4
2017-11-23 19:24:59 PST
Comment hidden (obsolete)
Attachment 327520
[details]
did not pass style-queue: ERROR: Source/WTF/wtf/OptionSet.h:133: Missing spaces around | [whitespace/operators] [3] ERROR: Source/WTF/wtf/OptionSet.h:138: Missing spaces around | [whitespace/operators] [3] Total errors found: 2 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
EWS Watchlist
Comment 5
2017-11-23 20:53:56 PST
Comment hidden (obsolete)
Comment on
attachment 327520
[details]
Patch
Attachment 327520
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/5345274
New failing tests: editing/text-iterator/findString.html editing/text-iterator/find-string-on-flat-tree.html
EWS Watchlist
Comment 6
2017-11-23 20:53:57 PST
Comment hidden (obsolete)
Created
attachment 327523
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Darin Adler
Comment 7
2017-11-24 11:33:06 PST
Created
attachment 327555
[details]
Patch
EWS Watchlist
Comment 8
2017-11-24 11:35:20 PST
Attachment 327555
[details]
did not pass style-queue: ERROR: Source/WTF/wtf/OptionSet.h:133: Missing spaces around | [whitespace/operators] [3] ERROR: Source/WTF/wtf/OptionSet.h:138: Missing spaces around | [whitespace/operators] [3] Total errors found: 2 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 9
2017-11-24 15:39:11 PST
Comment on
attachment 327555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327555&action=review
> Source/WTF/wtf/OptionSet.h:151 > + constexpr friend OptionSet operator|(OptionSet lhs, OptionSet rhs) > + { > + return fromRaw(lhs.m_storage | rhs.m_storage); > + } > + > + constexpr friend OptionSet operator|(OptionSet lhs, T rhs) > + { > + return lhs | OptionSet { rhs }; > + } > + > constexpr friend OptionSet operator-(OptionSet lhs, OptionSet rhs) > { > - return OptionSet::fromRaw(lhs.m_storage & ~rhs.m_storage); > + return fromRaw(lhs.m_storage & ~rhs.m_storage); > + } > + > + constexpr friend OptionSet operator-(OptionSet lhs, T rhs) > + { > + return lhs - OptionSet { rhs }; > }
It would be good to add test cases for these to the existing OptionSet tests in TestWebKitAPI.
> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h:111 > + std::tuple<String, RetainPtr<PDFSelection>, RetainPtr<NSDictionary>> lookupTextAtLocation(const WebCore::FloatPoint&, WebHitTestResultData&) const;
I am surprised you don't have to #include <tuple>
Darin Adler
Comment 10
2017-11-24 17:08:06 PST
Comment on
attachment 327555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327555&action=review
>> Source/WTF/wtf/OptionSet.h:151 >> } > > It would be good to add test cases for these to the existing OptionSet tests in TestWebKitAPI.
I will do that. In a separate patch.
>> Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h:111 >> + std::tuple<String, RetainPtr<PDFSelection>, RetainPtr<NSDictionary>> lookupTextAtLocation(const WebCore::FloatPoint&, WebHitTestResultData&) const; > > I am surprised you don't have to #include <tuple>
Someone includes it I guess.
Darin Adler
Comment 11
2017-11-24 17:10:04 PST
Committed
r225142
: <
https://trac.webkit.org/changeset/225142
>
Radar WebKit Bug Importer
Comment 12
2017-11-24 17:11:27 PST
<
rdar://problem/35685066
>
Matt Lewis
Comment 13
2017-11-27 10:59:28 PST
This change has caused an API timeout on Sierra for the test: WKWebViewCandidateTests.ClickingInTextFieldDoesNotThrashCandidateVisibility
https://build.webkit.org/builders/Apple%20Sierra%20Debug%20WK2%20(Tests)/builds/4175/steps/run-api-tests/logs/stdio
https://build.webkit.org/builders/Apple%20Sierra%20Debug%20WK2%20(Tests)/builds/4175
Tim Horton
Comment 14
2017-11-27 13:15:40 PST
Comment on
attachment 327555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327555&action=review
> Source/WebCore/editing/mac/DictionaryLookup.mm:67 > + NSDictionary *retainedOptions = nil; > + auto result = [classLULookupDefinitionModule tokenRangeForString:string range:range options:&retainedOptions]; > + *options = adoptNS(retainedOptions);
What led you to this leak? What indication is there that options is not autoreleased?
Darin Adler
Comment 15
2017-11-30 09:43:13 PST
(In reply to Tim Horton from
comment #14
)
> What led you to this leak?
Reading the source code.
> What indication is there that options is not autoreleased?
I read the source code of the LULookupDefinitionModule. Maybe I misread it?
Darin Adler
Comment 16
2017-11-30 09:45:22 PST
(In reply to Darin Adler from
comment #15
)
> > What indication is there that options is not autoreleased? > > I read the source code of the LULookupDefinitionModule. Maybe I misread it?
I did misread it! Oops, will fix right away.
Darin Adler
Comment 17
2017-11-30 09:46:16 PST
Reading the tokenRangeForString source code I saw a copy, but missed an autorelease later in the function.
Darin Adler
Comment 18
2017-11-30 09:48:54 PST
Comment on
attachment 327555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327555&action=review
>> Source/WebCore/editing/mac/DictionaryLookup.mm:67 >> + *options = adoptNS(retainedOptions); > > What led you to this leak? What indication is there that options is not autoreleased?
My bad, I misread the source code to this function. I will fix this right now.
Darin Adler
Comment 19
2017-11-30 09:58:23 PST
Patch too big to just land without review, opening new
bug 180202
with my patch.
Tim Horton
Comment 20
2017-11-30 09:58:56 PST
(In reply to Darin Adler from
comment #19
)
> Patch too big to just land without review, opening new
bug 180202
with my > patch.
I already fixed this in
https://trac.webkit.org/changeset/225196/webkit
Tim Horton
Comment 21
2017-11-30 09:59:17 PST
(In reply to Tim Horton from
comment #20
)
> (In reply to Darin Adler from
comment #19
) > > Patch too big to just land without review, opening new
bug 180202
with my > > patch. > > I already fixed this in
https://trac.webkit.org/changeset/225196/webkit
Just somehow managed to not mention it here :(
Darin Adler
Comment 22
2017-11-30 10:03:45 PST
Oops, OK.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug