[webkit-changes] [WebKit/WebKit] a4c924: Ensure external style sheet resources are saved in...

Sihui noreply at github.com
Tue Jan 16 11:48:54 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4c924ac92e1c5e87a83cfd58ce1871d0e49a137
      https://github.com/WebKit/WebKit/commit/a4c924ac92e1c5e87a83cfd58ce1871d0e49a137
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm

  Log Message:
  -----------
  Ensure external style sheet resources are saved in subresource directory
https://bugs.webkit.org/show_bug.cgi?id=267464
rdar://120911453

Reviewed by Ryosuke Niwa.

relativeFilePath of ArchiveResource is target file path (relative to result directory) of the source. In current
implementation of addSubresourcesForCSSStyleSheetsIfNecessary, relativeFilePath of style sheet resource is decided by
values in uniqueCSSStyleSheets. However, uniqueCSSStyleSheets only records file path if frame is main frame. If frame is
subframe, uniqueCSSStyleSheets records file name instead. That means the external style sheet subresource in subframe
will be stored in the result root directory (not the subresource directory).

To fix this problem, this patch makes uniqueCSSStyleSheets always record file path, so the values can be directly used
for creating ArchiveResource. Note with this change, addSubresourcesForCSSStyleSheetsIfNecessary can no longer directly
return uniqueCSSStyleSheets (because the return value should record path relative to frame resource file) -- it should
return relativeUniqueCSSStyleSheets (which records file name) when frame is not main frame.

* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::addSubresourcesForCSSStyleSheetsIfNecessary):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:

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




More information about the webkit-changes mailing list