Bug 154183 - WebView public APIs should have thread violation checks.
Summary: WebView public APIs should have thread violation checks.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on: 154204
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-12 12:22 PST by Mark Lam
Modified: 2016-02-13 09:41 PST (History)
5 users (show)

See Also:


Attachments
proposed patch. (5.10 KB, patch)
2016-02-12 12:30 PST, Mark Lam
no flags Details | Formatted Diff | Diff
proposed patch 2: revised to use WebCoreThreadViolationCheckRoundThree(). (6.62 KB, patch)
2016-02-12 16:58 PST, Mark Lam
timothy: review-
Details | Formatted Diff | Diff
proposed patch 3: address Tim's feedback. (8.47 KB, patch)
2016-02-12 17:27 PST, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2016-02-12 12:22:40 PST
This will help clients of the API detect the violations sooner rather than having to debug mysterious crashes / failures later.
Comment 1 Mark Lam 2016-02-12 12:30:10 PST
Created attachment 271202 [details]
proposed patch.
Comment 2 Geoffrey Garen 2016-02-12 15:49:41 PST
Comment on attachment 271202 [details]
proposed patch.

r=me
Comment 3 WebKit Commit Bot 2016-02-12 16:22:55 PST
Comment on attachment 271202 [details]
proposed patch.

Clearing flags on attachment: 271202

Committed r196527: <http://trac.webkit.org/changeset/196527>
Comment 4 WebKit Commit Bot 2016-02-12 16:22:58 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Timothy Hatcher 2016-02-12 16:26:57 PST
Comment on attachment 271202 [details]
proposed patch.

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

> Source/WebKit/mac/WebView/WebView.mm:5846
> +    WebCoreThreadViolationCheckRoundTwo();

This should have added a WebCoreThreadViolationCheckRoundThree and corresponding ThreadViolationRoundThree along with tagging the WebKit version these were added with a new WebKitLinkedOnOrAfter check in -[WebFrameView initWithFrame:]. Not doing this is a binary compatibility risk, since old app who might be calling these APIs on other threads will start getting exceptions, when they might have worked fine before.
Comment 6 Mark Lam 2016-02-12 16:28:28 PST
(In reply to comment #5)
> Comment on attachment 271202 [details]
> proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=271202&action=review
> 
> > Source/WebKit/mac/WebView/WebView.mm:5846
> > +    WebCoreThreadViolationCheckRoundTwo();
> 
> This should have added a WebCoreThreadViolationCheckRoundThree and
> corresponding ThreadViolationRoundThree along with tagging the WebKit
> version these were added with a new WebKitLinkedOnOrAfter check in
> -[WebFrameView initWithFrame:]. Not doing this is a binary compatibility
> risk, since old app who might be calling these APIs on other threads will
> start getting exceptions, when they might have worked fine before.

I'll roll out and redo as Round 3.
Comment 7 Mark Lam 2016-02-12 16:58:05 PST
Created attachment 271249 [details]
proposed patch 2: revised to use WebCoreThreadViolationCheckRoundThree().
Comment 8 Timothy Hatcher 2016-02-12 17:02:01 PST
Comment on attachment 271249 [details]
proposed patch 2: revised to use WebCoreThreadViolationCheckRoundThree().

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

You are missing a call to setDefaultThreadViolationBehavior in -[WebFrameView initWithFrame:].

> Source/WebCore/platform/mac/ThreadCheck.mm:39
> +static ThreadViolationBehavior threadViolationBehavior[MaximumThreadViolationRound] =
> +    { RaiseExceptionOnThreadViolation, RaiseExceptionOnThreadViolation, RaiseExceptionOnThreadViolation };

I would not have put this on a newline.
Comment 9 Mark Lam 2016-02-12 17:27:52 PST
Created attachment 271253 [details]
proposed patch 3: address Tim's feedback.
Comment 10 WebKit Commit Bot 2016-02-13 09:41:12 PST
Comment on attachment 271253 [details]
proposed patch 3: address Tim's feedback.

Clearing flags on attachment: 271253

Committed r196551: <http://trac.webkit.org/changeset/196551>
Comment 11 WebKit Commit Bot 2016-02-13 09:41:15 PST
All reviewed patches have been landed.  Closing bug.