Skip to content

Commit

Permalink
Cherry-pick 273225@main (9c0f02f). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=267741

    sfusd.edu: Trying to load SFUSD School Finder sometimes fails
    https://bugs.webkit.org/show_bug.cgi?id=267741
    rdar://116292738

    Reviewed by Brent Fulgham.

    Trying to load the following link often fails in Safari (and Firefox), works fine in Chrome:
    https://www.sfusd.edu/schools/enroll/discover/school-finder

    We see the following error in the JS console:
    ```
    [Error] ReferenceError: Can't find variable: google
    	(anonymous function) (js_h2tB6IRXjTJGY_6Kj6g8zvcS1bzOjvsppQOjs7XaUWs.js:12:176)
    ```

    This is caused by the google maps script being marked as async while one of the sync script
    tries to access `window.google.maps`.

    Add a quirk to ignore 'async' on scripts on sfusd.edu as a workaround while we reach out
    to the site owners.

    * Source/WebCore/page/Quirks.cpp:
    (WebCore::Quirks::shouldBypassAsyncScriptDeferring const):

    Canonical link: https://commits.webkit.org/273225@main
  • Loading branch information
cdumez authored and aperezdc committed Jan 23, 2024
1 parent c782384 commit 33d9521
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/WebCore/page/Quirks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,8 @@ bool Quirks::shouldBypassBackForwardCache() const
return false;
}

// bungalow.com rdar://61658940
// bungalow.com: rdar://61658940
// sfusd.edu: rdar://116292738
bool Quirks::shouldBypassAsyncScriptDeferring() const
{
if (!needsQuirks())
Expand All @@ -913,7 +914,8 @@ bool Quirks::shouldBypassAsyncScriptDeferring() const
if (!m_shouldBypassAsyncScriptDeferring) {
auto domain = RegistrableDomain { m_document->topDocument().url() };
// Deferring 'mapbox-gl.js' script on bungalow.com causes the script to get in a bad state (rdar://problem/61658940).
m_shouldBypassAsyncScriptDeferring = (domain == "bungalow.com"_s);
// Deferring the google maps script on sfusd.edu may get the page in a bad state (rdar://116292738).
m_shouldBypassAsyncScriptDeferring = domain == "bungalow.com"_s || domain == "sfusd.edu"_s;
}
return *m_shouldBypassAsyncScriptDeferring;
}
Expand Down

0 comments on commit 33d9521

Please sign in to comment.