[webkit-changes] [WebKit/WebKit] 53dd79: Save iframe resources to disk

Sihui noreply at github.com
Wed Oct 4 11:25:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 53dd791f052cd7ee77e99c492a0b480166fb12b0
      https://github.com/WebKit/WebKit/commit/53dd791f052cd7ee77e99c492a0b480166fb12b0
  Author: Sihui Liu <sihui_liu at apple.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

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

  Log Message:
  -----------
  Save iframe resources to disk
https://bugs.webkit.org/show_bug.cgi?id=262567
rdar://116420990

Reviewed by Ryosuke Niwa.

This patch adds support for saving iframe resource to disk. To achive that:
1. each iframe main resource is saved as a single file, where file name is decided based on frame ID.
2. iframe main resources and subresources are stored in [main_resources_file_name]_files directory as other subresources
of main frame.
3. subresource urls in iframe main resources are changed to relative file paths.
4. iframe urls in main frame resource are changed to relative file paths.

Test: WebArchive.SaveResourcesSubframe

* Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendStartTag):
(WebCore::MarkupAccumulator::frameForAttributeReplacement):
(WebCore::MarkupAccumulator::replaceAttributeIfNecessary): replace srcdoc attribute with src attribute whose value is
relative file path.
(WebCore::MarkupAccumulator::appendURLAttributeIfNecessary): if src or srcdoc attribute does not exist, create a new
src attribute with url set to relative file path.
* Source/WebCore/editing/MarkupAccumulator.h:
* Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* Source/WebCore/loader/archive/cf/LegacyWebArchive.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CreateWebArchive.mm:

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




More information about the webkit-changes mailing list