Skip to content

Commit

Permalink
New test: [iOS] TestWebKitAPI.ServiceWorker.ExtensionServiceWorkerDis…
Browse files Browse the repository at this point in the history
…ableCORS is frequently timing out

https://bugs.webkit.org/show_bug.cgi?id=247757
rdar://102206729

Reviewed by Geoffrey Garen.

All tests in this files were calling [ServiceWorkerSchemeHandler addMappingFromURLString:]
with a string literal. As a result, this function has an optimization to avoid copying
(& freeing) the passed-in string.

However, the new ServiceWorker.ExtensionServiceWorkerDisableCORS is passing a dynamically
generated String and this optimization is thus no longer safe.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
(-[ServiceWorkerSchemeHandler addMappingFromURLString:toData:]):

Canonical link: https://commits.webkit.org/256553@main
  • Loading branch information
cdumez committed Nov 11, 2022
1 parent 9c08d49 commit 8db7eb4
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -2578,7 +2578,7 @@ - (instancetype)initWithBytes:(const char*)bytes

- (void)addMappingFromURLString:(NSString *)urlString toData:(const char*)data
{
_dataMappings.set(urlString, [NSData dataWithBytesNoCopy:(void*)data length:strlen(data) freeWhenDone:NO]);
_dataMappings.set(urlString, [NSData dataWithBytes:(void*)data length:strlen(data)]);
}

- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)task
Expand Down

0 comments on commit 8db7eb4

Please sign in to comment.