WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
138539
Fix various cases of incorrect cross-thread capture of non-thread-safe RefCounted
https://bugs.webkit.org/show_bug.cgi?id=138539
Summary
Fix various cases of incorrect cross-thread capture of non-thread-safe RefCou...
Darin Adler
Reported
2014-11-08 18:15:22 PST
Fix various cases of incorrect cross-thread capture of non-thread-safe RefCounted
Attachments
Patch
(26.79 KB, patch)
2014-11-08 18:19 PST
,
Darin Adler
no flags
Details
Formatted Diff
Diff
Patch
(35.21 KB, patch)
2014-11-08 21:00 PST
,
Darin Adler
ap
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2014-11-08 18:19:51 PST
Created
attachment 241243
[details]
Patch
Darin Adler
Comment 2
2014-11-08 18:20:51 PST
This covers all the places I could find trying to use isolatedCopy to capture something and pass it to a new thread, but dealing with the last deref on the main thread incorrectly.
WebKit Commit Bot
Comment 3
2014-11-08 18:23:15 PST
Attachment 241243
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp:332: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 1 in 10 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alexey Proskuryakov
Comment 4
2014-11-08 18:54:53 PST
Comment on
attachment 241243
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=241243&action=review
> Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp:421 > + StringCapture capturedURL(url.string());
This idiom makes URL forget that it was invalid - we get a string, and then push it back into a URL without checks. I think that we need to explicitly check for url being valid here and everywhere else.
Alexey Proskuryakov
Comment 5
2014-11-08 19:11:00 PST
Or better yet, introduce a URLCapture class.
Darin Adler
Comment 6
2014-11-08 20:36:06 PST
I’ll add URLCapture.
Darin Adler
Comment 7
2014-11-08 21:00:05 PST
Created
attachment 241247
[details]
Patch
WebKit Commit Bot
Comment 8
2014-11-08 21:01:19 PST
Attachment 241247
[details]
did not pass style-queue: ERROR: Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp:332: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 1 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alexey Proskuryakov
Comment 9
2014-11-08 21:37:11 PST
Comment on
attachment 241247
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=241247&action=review
Very nice!
> Source/WebCore/platform/URL.h:269 > + URL releaseURL();
This function ended up unused, would you still like to keep it?
> Source/WebCore/platform/URL.h:272 > + void operator=(const URLCapture&) = delete;
It is unusual to have a copy constructor, but delete operator=. I'm not sure if that's legitimate.
Darin Adler
Comment 10
2014-11-09 09:18:16 PST
Comment on
attachment 241247
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=241247&action=review
>> Source/WebCore/platform/URL.h:269 >> + URL releaseURL(); > > This function ended up unused, would you still like to keep it?
I simply copied StringCapture. I think the two should stay in sync, but I am not sure if either needs this. I think we should have either url() or releaseURL(), but I don’t think we need both.
>> Source/WebCore/platform/URL.h:272 >> + void operator=(const URLCapture&) = delete; > > It is unusual to have a copy constructor, but delete operator=. I'm not sure if that's legitimate.
I simply copied StringCapture. I think the two should stay in sync. I don’t feel strongly about this design issue; it’s a little arbitrary to not have operator=, but seems OK to me. Note that the only reason we have a copy constructor in this class is because that’s what’s used to capture. If we could make it legal only for capture and make any other copying illegal, I think we would do that.
Darin Adler
Comment 11
2014-11-09 09:25:24 PST
Committed
r175792
: <
http://trac.webkit.org/changeset/175792
>
Antti Koivisto
Comment 12
2014-11-09 15:15:03 PST
(In reply to
comment #10
)
> I don’t feel strongly about this design issue; it’s a little arbitrary to > not have operator=, but seems OK to me. Note that the only reason we have a > copy constructor in this class is because that’s what’s used to capture. If > we could make it legal only for capture and make any other copying illegal, > I think we would do that.
Right, I tried to make it harder to use this class for anything else beyond capturing.
Alexey Proskuryakov
Comment 13
2014-11-09 16:08:11 PST
I was thinking about the rule of three <
http://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming
)>. I certainly don't feel strongly about this at all. If there is anything to change here, it's probably to delete operator=(URLCapture&&) as well.
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