Bug 262777

Summary: REGRESSION(265870.8@safari-7616-branch): [GTK] Cannot load Unity WebGL apps due to access control checks
Product: WebKit Reporter: Jim Mason <jmason>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bugs-noreply, cdumez, chirag_m_shah, mcatanzaro, seanmi, webkit-bug-importer, xry111
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=258895

Description Jim Mason 2023-10-06 04:45:10 PDT
In 2.42.1, Unity apps are failing to load.  A message 'Cannot load blob... due to access control checks' appears in the JS console.

Note, this was working as expected in 2.42.0.

Here are two examples; all Unity apps fail for me in this way:

https://www.wasm.com.cn/demo/Tanks/

[Error] Cannot load blob:https://www.wasm.com.cn/e767d7ad-3d43-4b51-a971-1edcec1c11f0 due to access control checks.
    decompress (UnityLoader.js:4:8819)
    (anonymous function) (UnityLoader.js:1:3769)

https://www.cs.nccu.edu.tw/~mtchi/course/3d17/final/07/WebGL/index.html

[Error] Cannot load blob:https://www.cs.nccu.edu.tw/a5d0a060-e261-47b3-81de-659a7c927393 due to access control checks.
    decompress (UnityLoader.js:4:9108)
    (anonymous function) (UnityLoader.js:1:3769)
Comment 1 Michael Catanzaro 2023-10-06 11:26:45 PDT
Bisected this. Only the Safari and GTK/WPE branches are affected because this commit has not landed in main yet.

a209cbf453978e3ea809d36f684a36f36ff301c5 is the first bad commit
commit a209cbf453978e3ea809d36f684a36f36ff301c5
Author: Chirag M Shah <chirag_m_shah@apple.com>
Date:   Mon Jul 10 18:24:09 2023 -0700

    Cherry-pick 265870.8@safari-7616-branch (551b1fd24102). https://bugs.webkit.org/show_bug.cgi?id=258712
    
        Fix stack-overflow when dealing with blobURL(s)
        https://bugs.webkit.org/show_bug.cgi?id=258895
        rdar://111440239
    
        Reviewed by Chris Dumez.
    
        This change fixes the stack overflow when checking for whether a blobURL
        is secure.
    
        * Source/WebCore/fileapi/BlobURL.cpp:
        (WebCore::BlobURL::isSecureBlobURL):
        * Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp:
        (TestWebKitAPI::TEST_F):
    
        Canonical link: https://commits.webkit.org/265870.8@safari-7616-branch

 Source/WebCore/fileapi/BlobURL.cpp                   | 3 ++-
 Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)
Comment 2 Alexey Proskuryakov 2023-10-07 13:43:30 PDT
The culprit has shipped in Safari 17, and I cannot reproduce the issue there. So the regression must be Gtk specific?
Comment 3 Michael Catanzaro 2023-10-08 05:06:35 PDT
Strange, but I've seen stranger....
Comment 4 Michael Catanzaro 2023-10-08 05:16:43 PDT
It's more likely to be branch-specific rather than port-specific. Likely we're either (a) missing some other unknown but required change from safari-7616-branch, or (b) more likely the change is incompatible with some other unknown change on main.

We'll be able to find out after this change has landed in main.
Comment 5 Chris Dumez 2023-10-09 08:36:07 PDT
(In reply to Michael Catanzaro from comment #4)
> It's more likely to be branch-specific rather than port-specific. Likely
> we're either (a) missing some other unknown but required change from
> safari-7616-branch, or (b) more likely the change is incompatible with some
> other unknown change on main.
> 
> We'll be able to find out after this change has landed in main.

I think it is likely the branch change is incompatible with some changes that were done on trunk. I haven't had time to investigate yet though.
Comment 6 Chris Dumez 2023-10-09 13:13:24 PDT
(In reply to Chris Dumez from comment #5)
> (In reply to Michael Catanzaro from comment #4)
> > It's more likely to be branch-specific rather than port-specific. Likely
> > we're either (a) missing some other unknown but required change from
> > safari-7616-branch, or (b) more likely the change is incompatible with some
> > other unknown change on main.
> > 
> > We'll be able to find out after this change has landed in main.
> 
> I think it is likely the branch change is incompatible with some changes
> that were done on trunk. I haven't had time to investigate yet though.

See https://github.com/WebKit/WebKit/pull/18859
Comment 7 Michael Catanzaro 2023-10-10 13:27:49 PDT
Reverted this on webkitglib/2.42 branch. Closing.

I'm guessing 266247@main was the commit that fixed the stack overflow on main, though I'm not certain.
Comment 8 Radar WebKit Bug Importer 2023-10-10 13:28:32 PDT
<rdar://problem/116756393>
Comment 9 Michael Catanzaro 2023-11-06 09:15:43 PST
*** Bug 264263 has been marked as a duplicate of this bug. ***
Comment 10 Michael Catanzaro 2023-11-09 05:51:29 PST
*** Bug 264201 has been marked as a duplicate of this bug. ***