Bug 233841 - [iOS] Web content process sometimes crashes under WebPage::positionInformation()
Summary: [iOS] Web content process sometimes crashes under WebPage::positionInformation()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-03 16:05 PST by Wenson Hsieh
Modified: 2021-12-03 17:36 PST (History)
6 users (show)

See Also:


Attachments
Patch (6.15 KB, patch)
2021-12-03 16:14 PST, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2021-12-03 16:05:10 PST
rdar://85917212
Comment 1 Wenson Hsieh 2021-12-03 16:14:45 PST
Created attachment 445911 [details]
Patch
Comment 2 Geoffrey Garen 2021-12-03 16:21:05 PST
Comment on attachment 445911 [details]
Patch

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

r=me

> Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm:87
> +static CGPoint gSwizzledLocationInView = CGPoint { 100, 100 };
>  static CGPoint swizzledLocationInView(id, SEL, UIView *)
>  {
> -    return CGPointMake(100, 100);
> +    return gSwizzledLocationInView;
>  }

Nit:

The most efficient thing to do here is "return CGPoint { 100, 100 }". On all modern hardware, that will just fill two registers with constants and return. Maybe that's the best thing to do.

If we do have a specific motivation to use a constant, I'd suggest putting the static inside the function and marking it const, to reduce its scope / potential for incorrect usage.
Comment 3 Wenson Hsieh 2021-12-03 16:22:53 PST
(In reply to Geoffrey Garen from comment #2)
> Comment on attachment 445911 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=445911&action=review
> 
> r=me
> 
> > Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm:87
> > +static CGPoint gSwizzledLocationInView = CGPoint { 100, 100 };
> >  static CGPoint swizzledLocationInView(id, SEL, UIView *)
> >  {
> > -    return CGPointMake(100, 100);
> > +    return gSwizzledLocationInView;
> >  }
> 
> Nit:
> 
> The most efficient thing to do here is "return CGPoint { 100, 100 }". On all
> modern hardware, that will just fill two registers with constants and
> return. Maybe that's the best thing to do.
> 
> If we do have a specific motivation to use a constant, I'd suggest putting
> the static inside the function and marking it const, to reduce its scope /
> potential for incorrect usage.

Ah, so I pulled this out into a variable because I needed to be able to change this to another value (500, 500) for the new test below.
Comment 4 Geoffrey Garen 2021-12-03 16:26:00 PST
Comment on attachment 445911 [details]
Patch

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

>>> Tools/TestWebKitAPI/Tests/WebKitCocoa/ImageAnalysisTests.mm:87
>>>  }
>> 
>> Nit:
>> 
>> The most efficient thing to do here is "return CGPoint { 100, 100 }". On all modern hardware, that will just fill two registers with constants and return. Maybe that's the best thing to do.
>> 
>> If we do have a specific motivation to use a constant, I'd suggest putting the static inside the function and marking it const, to reduce its scope / potential for incorrect usage.
> 
> Ah, so I pulled this out into a variable because I needed to be able to change this to another value (500, 500) for the new test below.

Oh, lol, I totally missed that!

Seems fine as-is.
Comment 5 Wenson Hsieh 2021-12-03 17:00:16 PST
Comment on attachment 445911 [details]
Patch

Thanks for the review!
Comment 6 EWS 2021-12-03 17:36:01 PST
Committed r286522 (244856@main): <https://commits.webkit.org/244856@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445911 [details].