Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4ad38bf6ac68c303cf131eb31793098cfaeb38a1
      
https://github.com/WebKit/WebKit/commit/4ad38bf6ac68c303cf131eb31793098cfaeb38a1
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2022-12-20 (Tue, 20 Dec 2022)

  Changed paths:
    M Source/WebCore/contentextensions/ContentExtensionsBackend.cpp
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
    M Source/WebKit/NetworkProcess/NetworkProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkProcess.h
    M Source/WebKit/NetworkProcess/NetworkProcess.messages.in
    M Source/WebKit/NetworkProcess/cocoa/NetworkConnectionIntegrityHelpers.h
    M Source/WebKit/Shared/WebPageCreationParameters.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in

  Log Message:
  -----------
  Make URL lookalike character sanitization work with navigation
https://bugs.webkit.org/show_bug.cgi?id=249578

Reviewed by Tim Horton.

Make URL lookalike character sanitization apply to URLs upon top-level 
navigation. See below for
more details.

* Source/WebCore/contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::sanitizeLookalikeCharactersIfNecessary):
(WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad):

Hook into content extension code to redirect to the new URL, in the case where 
we applied lookalike
sanitization. This is similar to how HTTPS upgrade logic works (under the call 
to
`makeSecureIfNecessary`, above).

* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::requestLookalikeCharacterStrings): 
Deleted.
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:

Move this existing code out of `NetworkConnectionToWebProcess`, and into 
`NetworkProcess` instead.
See comments below for more details.

* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::requestLookalikeCharacterStrings):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:

Add a method to `NetworkProcess(Proxy)` that can be used to request lookalike 
character strings.
This logic was previously on `NetworkConnectionToWebProcess`, since the web 
process directly
requested this information from the network process; however, since we now 
cache these strings UI-
process-side before delivering them to the web process, it makes more sense for 
this functionality
to move to the IPC boundaries between the UI and network processes (i.e. 
`NetworkProcessProxy` and
`NetworkProcess`).

* Source/WebKit/NetworkProcess/cocoa/NetworkConnectionIntegrityHelpers.h:
* Source/WebKit/Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Source/WebKit/Shared/WebPageCreationParameters.h:

Add a list of lookalike character strings to creation parameters, so that if 
we've previously
requested and cached them in the UI process, they can become available in the 
web process
immediately upon process initialization.

* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::requestLookalikeCharacterStrings):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage):
(WebKit::WebPageProxy::didCommitLoadForFrame):

See below for more details.

(WebKit::WebPageProxy::createNewPage):
(WebKit::WebPageProxy::creationParameters):

Pass in `cachedLookalikeStrings()` when putting together creation parameters 
for the new page.

(WebKit::WebPageProxy::cachedLookalikeStrings):

Maintain a cached list of lookalike strings in the UI process.

(WebKit::WebPageProxy::updateLookalikeCharacterStringsIfNeeded):
* Source/WebKit/UIProcess/WebPageProxy.h:

Add a flag to indicate whether the list of lookalike strings needs to be 
updated after we begin
loading the web page. This is set when creating a new web page, only if the 
list of strings was not
already cached in the UI process upon page creation. In this case, we pass an 
empty `Vector<String>`
to the web process via creation parameters; after committing the load, we 
update the cached list in
the UI process, and send the updated results to the web page.

* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::updatePreferences):
(WebKit::WebPage::didCommitLoad):
(WebKit::WebPage::setLookalikeCharacterStrings):

Add an IPC message to the web page, to update the list of lookalike strings.

(WebKit::WebPage::updateLookalikeCharacterStringsIfNeeded): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

Canonical link: https://commits.webkit.org/258169@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to