Changeset 280562 in webkit


Ignore:
Timestamp:
Aug 2, 2021 3:04:46 PM (12 months ago)
Author:
achristensen@apple.com
Message:

Don't change invalid baseURLs from loadData or loadHTMLString to about:blank
https://bugs.webkit.org/show_bug.cgi?id=228717
<rdar://79909343>

Reviewed by Chris Dumez.

Source/WebKit:

r278737 fixed a compatibility bug from r272469 but introduced a crash when the base URL does not successfully parse.
r279450 fixed that crash but introduced a new behavior change that changes the URL to about:blank. This didn't seem
to change anything because window.location is about:blank with and without the change, but WKWebView.URL did change,
which broke at least one app. This undoes the functionality change from r279450 and keeps the crash fix, which are
both covered by API tests. I also manually verified this fixes the app in the radar.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::loadData):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:

(TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r280558 r280562  
     12021-08-02  Alex Christensen  <achristensen@webkit.org>
     2
     3        Don't change invalid baseURLs from loadData or loadHTMLString to about:blank
     4        https://bugs.webkit.org/show_bug.cgi?id=228717
     5        <rdar://79909343>
     6
     7        Reviewed by Chris Dumez.
     8
     9        r278737 fixed a compatibility bug from r272469 but introduced a crash when the base URL does not successfully parse.
     10        r279450 fixed that crash but introduced a new behavior change that changes the URL to about:blank.  This didn't seem
     11        to change anything because window.location is about:blank with and without the change, but WKWebView.URL did change,
     12        which broke at least one app.  This undoes the functionality change from r279450 and keeps the crash fix, which are
     13        both covered by API tests.  I also manually verified this fixes the app in the radar.
     14
     15        * WebProcess/WebPage/WebPage.cpp:
     16        (WebKit::WebPage::loadData):
     17
    1182021-08-02  Devin Rousso  <drousso@apple.com>
    219
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r280374 r280562  
    17601760    else {
    17611761        baseURL = URL(URL(), loadParameters.baseURLString);
    1762         if (baseURL.isValid()) {
    1763             if (!baseURL.protocolIsInHTTPFamily())
    1764                 LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler(baseURL.protocol().toString());
    1765         } else
    1766             baseURL = aboutBlankURL();
     1762        if (baseURL.isValid() && !baseURL.protocolIsInHTTPFamily())
     1763            LegacySchemeRegistry::registerURLSchemeAsHandledBySchemeHandler(baseURL.protocol().toString());
    17671764    }
    17681765
  • trunk/Tools/ChangeLog

    r280560 r280562  
     12021-08-02  Alex Christensen  <achristensen@webkit.org>
     2
     3        Don't change invalid baseURLs from loadData or loadHTMLString to about:blank
     4        https://bugs.webkit.org/show_bug.cgi?id=228717
     5        <rdar://79909343>
     6
     7        Reviewed by Chris Dumez.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm:
     10        (TEST):
     11
    1122021-08-02  Kevin Neal  <kevin_neal@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm

    r279450 r280562  
    196196    [webView loadHTMLString:@"test" baseURL:[NSURL URLWithString:@"invalid"]];
    197197    TestWebKitAPI::Util::run(&didFinishNavigation);
     198    EXPECT_WK_STREQ([webView URL].absoluteString, "invalid");
    198199
    199200    EXPECT_FALSE(didCrash);
Note: See TracChangeset for help on using the changeset viewer.