[webkit-changes] [WebKit/WebKit] 5b6b22: URL in saved iframe resource is wrong when iframe ...

Sihui noreply at github.com
Tue Oct 17 14:49:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b6b22b02a763782fcc6eda23cdaed106f32c55f
      https://github.com/WebKit/WebKit/commit/5b6b22b02a763782fcc6eda23cdaed106f32c55f
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-10-17 (Tue, 17 Oct 2023)

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

  Log Message:
  -----------
  URL in saved iframe resource is wrong when iframe embeds another iframe
https://bugs.webkit.org/show_bug.cgi?id=263209
rdar://116882918

Reviewed by Ryosuke Niwa.

Main resources of iframes are stored under the same directory (subresources directory), so the rewritten url of an
iframe should not contain the name of directory when the iframe is embeded in another iframe. For example, if an iframe
with src set to 'iframe1.html' contains another iframe with src set to 'iframe2.html', and their corresponding file
paths are '[subresources_directory]/frame1.html' and '[subresources_directory]/frame2.html', then the src of iframe2 in
frame1.html should be 'frame2.html', not 'subresources/frame2.html'.

This patch also renames fileName to (relative)filePath in ArchiveResource and LegacyWebArchive, because the variable is
indeed a file path that can contain directory name.

Test: WebArchive.SaveResourcesIframeInIframe

* Source/WebCore/loader/archive/ArchiveResource.cpp:
(WebCore::ArchiveResource::ArchiveResource):
(WebCore::ArchiveResource::create):
(WebCore::ArchiveResource::saveToDisk):
* Source/WebCore/loader/archive/ArchiveResource.h:
(WebCore::ArchiveResource::relativeFilePath const):
(WebCore::ArchiveResource::setRelativeFilePath):
(WebCore::ArchiveResource::fileName const): Deleted.
(WebCore::ArchiveResource::setFileName): Deleted.
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createPropertyListRepresentation):
(WebCore::LegacyWebArchive::createResource):
(WebCore::LegacyWebArchive::create):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:

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




More information about the webkit-changes mailing list