Bug 252474

Summary: REGRESSION (253839@main): Opening projects broken in Construct 3 web app with Safari TP 163
Product: WebKit Reporter: Ashley Gullen <ashley>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: brandonstewart, cdumez, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 13   
See Also: https://bugs.webkit.org/show_bug.cgi?id=253042
https://bugs.webkit.org/show_bug.cgi?id=254021
Bug Depends on:    
Bug Blocks: 244350    
Attachments:
Description Flags
A sample project file that our web app can open none

Description Ashley Gullen 2023-02-17 04:49:30 PST
Created attachment 465052 [details]
A sample project file that our web app can open

This is a major regression that more or less completely breaks our web app Construct 3. Currently only Safari TP 163 is affected - I hope this doesn't make its way to stable!

Steps to reproduce:

1. Download sample-project.zip from this bug report
2. Visit https://editor.construct.net
3. Close/cancel any dialogs that appear
4. Drag and drop sample-project.zip in to the browser window. This will cause the web app to open the dropped file.

Observed result:

A "Failed to open project" message is shown. A JSON parse error is logged to the console.

Expected result:

The project file to successfully open. It works correctly in the current main Safari release 16.3, and also in Chrome. It looks like a recent change to Safari broke this.
Comment 1 Radar WebKit Bug Importer 2023-02-20 10:20:14 PST
<rdar://problem/105684987>
Comment 2 Alexey Proskuryakov 2023-02-22 16:48:02 PST
*** Bug 252664 has been marked as a duplicate of this bug. ***
Comment 3 Ashley Gullen 2023-02-23 02:57:20 PST
This issue is not a duplicate of issue 252474! Please unmerge them or you will likely leave a breaking change in Safari!
Comment 4 Chris Dumez 2023-02-27 10:11:13 PST
253433@main: GOOD
254508@main: BAD

Will see if I can bisect this.
Comment 5 Chris Dumez 2023-02-27 10:52:34 PST
(In reply to Chris Dumez from comment #4)
> 253433@main: GOOD
> 254508@main: BAD
> 
> Will see if I can bisect this.

Regression range:
https://commits.webkit.org/compare/253849@main...253835@main

Couldn't bisect further.
Comment 6 Chris Dumez 2023-02-27 11:07:54 PST
(In reply to Chris Dumez from comment #5)
> (In reply to Chris Dumez from comment #4)
> > 253433@main: GOOD
> > 254508@main: BAD
> > 
> > Will see if I can bisect this.
> 
> Regression range:
> https://commits.webkit.org/compare/253849@main...253835@main
> 
> Couldn't bisect further.

I may have messed up my bisection. Double checking now...
Comment 7 Chris Dumez 2023-02-27 11:36:22 PST
(In reply to Chris Dumez from comment #6)
> (In reply to Chris Dumez from comment #5)
> > (In reply to Chris Dumez from comment #4)
> > > 253433@main: GOOD
> > > 254508@main: BAD
> > > 
> > > Will see if I can bisect this.
> > 
> > Regression range:
> > https://commits.webkit.org/compare/253849@main...253835@main
> > 
> > Couldn't bisect further.
> 
> I may have messed up my bisection. Double checking now...

I think my bisection is correct:

253835@main-1661538933_6bad2b65adc8: GOOD
253849@main-1661559262_cb2c1049f95b: BAD
Comment 8 Chris Dumez 2023-02-27 11:38:09 PST
This is a regression from https://github.com/WebKit/WebKit/commit/c5b77d735efefca6e22d8dfbea5aba69daaf3892
Comment 9 Chris Dumez 2023-02-27 11:39:46 PST
Site may be using the stream compression API somehow.
Comment 10 Brandon 2023-02-27 12:07:48 PST
Just took a quick look.

Disabling Compression Streams does seem to resolve the error.

I checked in Chrome, and they do not have an issue, and they have Compression Stream support.

I'll debug this in depth tonight, and see exactly where the error is happening in WebKit.
Comment 11 Brandon 2023-02-27 17:02:35 PST
Quick fix posted https://github.com/WebKit/WebKit/pull/10768.

I'll need to look into that a bit more, but just switched to using the zlib library implementation for now while I investigate.
Comment 12 Brandon 2023-02-27 22:12:19 PST
Landed the fix. The site is working properly now based on initial testing.
Comment 13 Ashley Gullen 2023-02-28 03:58:44 PST
Thanks for the quick fix. FYI I think the use of Compression Streams comes from the popular zip-reading library zip.js (https://gildas-lormeau.github.io/zip.js/) so I suspect there is a much wider compatibility issue at stake.
Comment 14 Ashley Gullen 2023-03-13 05:16:22 PDT
This issue is marked fixed but it still reproduces for me in Safari TP 165. Please can you tell me if the fix is really going to ship in Safari 16.4 so I know if we need to issue an update to work around this?
Comment 15 Chris Dumez 2023-03-13 07:24:17 PDT
(In reply to Ashley Gullen from comment #14)
> This issue is marked fixed but it still reproduces for me in Safari TP 165.
> Please can you tell me if the fix is really going to ship in Safari 16.4 so
> I know if we need to issue an update to work around this?

The fix landed in 260923@main. However, per [1], STP 165 only contains fixes up to 260848@main.

[1] https://webkit.org/blog/13932/release-notes-for-safari-technology-preview-165/