Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port remaining WebCore/loader types to the new serialization format #9383

Conversation

gavin-apple
Copy link
Contributor

@gavin-apple gavin-apple commented Jan 31, 2023

148e18a

Port remaining WebCore/loader types to the new serialization format
https://bugs.webkit.org/show_bug.cgi?id=251434
rdar://104866054

Reviewed by Alex Christensen.

This change includes porting types:
    - CanvasActivityRecord
    - AttributionSecondsUntilSendData
    - CrossOriginOpenerPolicyValue
    - CrossOriginOpenerPolicy
    - CustomHeaderFields
    - HTTPHeaderField
    - NavigationRequester
    - PolicyContainer
    - SessionHistoryVisibility
    - SubstituteData

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/loader/AttributionSecondsUntilSendData.h:
(WebCore::PCM::AttributionSecondsUntilSendData::minSecondsUntilSend):
(WebCore::PCM::AttributionSecondsUntilSendData::encode const): Deleted.
(WebCore::PCM::AttributionSecondsUntilSendData::decode): Deleted.
* Source/WebCore/loader/CanvasActivityRecord.h:
(WebCore::CanvasActivityRecord::encode const): Deleted.
(WebCore::CanvasActivityRecord::decode): Deleted.
* Source/WebCore/loader/CrossOriginOpenerPolicy.h:
(WebCore::CrossOriginOpenerPolicy::encode const): Deleted.
(WebCore::CrossOriginOpenerPolicy::decode): Deleted.
* Source/WebCore/loader/CustomHeaderFields.h:
(WebCore::CustomHeaderFields::encode const): Deleted.
(WebCore::CustomHeaderFields::decode): Deleted.
* Source/WebCore/loader/HTTPHeaderField.cpp:
(WebCore::HTTPHeaderField::HTTPHeaderField):
(WebCore::HTTPHeaderField::isValid):
(WebCore::HTTPHeaderField::create):
* Source/WebCore/loader/HTTPHeaderField.h:
(WebCore::HTTPHeaderField::encode const): Deleted.
(WebCore::HTTPHeaderField::decode): Deleted.
* Source/WebCore/loader/NavigationRequester.h:
(WebCore::NavigationRequester::encode const): Deleted.
(WebCore::NavigationRequester::decode): Deleted.
* Source/WebCore/loader/PolicyContainer.h:
(WebCore::PolicyContainer::isolatedCopy):
(WebCore::PolicyContainer::encode const): Deleted.
(WebCore::PolicyContainer::decode): Deleted.
* Source/WebCore/loader/SubstituteData.h:
(WebCore::SubstituteData::SubstituteData):
(WebCore::SubstituteData::isValid const):
(WebCore::SubstituteData::shouldRevealToSessionHistory const):
(WebCore::SubstituteData::content const):
(WebCore::SubstituteData::mimeType const):
(WebCore::SubstituteData::textEncoding const):
(WebCore::SubstituteData::failingURL const):
(WebCore::SubstituteData::response const):
(WebCore::SubstituteData::encode const): Deleted.
(WebCore::SubstituteData::decode): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

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

2768bfc

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe ❌ πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@gavin-apple gavin-apple self-assigned this Jan 31, 2023
@gavin-apple gavin-apple added the WebKit Process Model Bugs related to WebKit's multi-process architecture label Jan 31, 2023
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 31, 2023
@gavin-apple gavin-apple removed the merging-blocked Applied to prevent a change from being merged label Jan 31, 2023
@gavin-apple gavin-apple force-pushed the eng/Port-remaining-WebCoreloader-types-to-the-new-serialization-format branch from 6663991 to 3198bc9 Compare January 31, 2023 16:28
bool isValid() const { return m_content != nullptr; }
bool shouldRevealToSessionHistory() const { return m_shouldRevealToSessionHistory == SessionHistoryVisibility::Visible; }

const FragmentedSharedBuffer* content() const { return m_content.get(); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you changed this return type to RefPtr and shouldRevealToSessionHistory to SessionHistoryVisibility you could avoid "friend struct IPC::ArgumentCoder"

StringView strippedName = StringView(name).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace<UChar>);
StringView strippedValue = StringView(value).stripLeadingAndTrailingMatchedCharacters(RFC7230::isWhitespace<UChar>);

ASSERT(RFC7230::isValidName(strippedName) && RFC7230::isValidValue(strippedValue));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this assertion is valid when decoding from an untrusted source, even after stripping whitespace.

String name = strippedName.length() == unparsedName.length() ? WTFMove(unparsedName) : strippedName.toString();
String value = strippedValue.length() == unparsedValue.length() ? WTFMove(unparsedValue) : strippedValue.toString();
return {{ WTFMove(name), WTFMove(value) }};
std::optional<HTTPHeaderField> HTTPHeaderField::create(String&& unparsedName, String&& unparsedValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use CreateUsing=create and make a new attribute to allow the create function to return a std::optional, then just leave HTTPHeaderField class alone.

@gavin-apple gavin-apple force-pushed the eng/Port-remaining-WebCoreloader-types-to-the-new-serialization-format branch from 3198bc9 to 1534fd2 Compare February 1, 2023 22:45
@gavin-apple gavin-apple force-pushed the eng/Port-remaining-WebCoreloader-types-to-the-new-serialization-format branch from 1534fd2 to 749b27d Compare February 1, 2023 23:41
@gavin-apple gavin-apple added the merge-queue Applied to send a pull request to merge-queue label Feb 2, 2023
@gavin-apple gavin-apple removed the merge-queue Applied to send a pull request to merge-queue label Feb 3, 2023
@gavin-apple gavin-apple force-pushed the eng/Port-remaining-WebCoreloader-types-to-the-new-serialization-format branch from 9656efd to 2768bfc Compare February 3, 2023 00:35
@gavin-apple gavin-apple added the merge-queue Applied to send a pull request to merge-queue label Feb 3, 2023
https://bugs.webkit.org/show_bug.cgi?id=251434
rdar://104866054

Reviewed by Alex Christensen.

This change includes porting types:
    - CanvasActivityRecord
    - AttributionSecondsUntilSendData
    - CrossOriginOpenerPolicyValue
    - CrossOriginOpenerPolicy
    - CustomHeaderFields
    - HTTPHeaderField
    - NavigationRequester
    - PolicyContainer
    - SessionHistoryVisibility
    - SubstituteData

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/loader/AttributionSecondsUntilSendData.h:
(WebCore::PCM::AttributionSecondsUntilSendData::minSecondsUntilSend):
(WebCore::PCM::AttributionSecondsUntilSendData::encode const): Deleted.
(WebCore::PCM::AttributionSecondsUntilSendData::decode): Deleted.
* Source/WebCore/loader/CanvasActivityRecord.h:
(WebCore::CanvasActivityRecord::encode const): Deleted.
(WebCore::CanvasActivityRecord::decode): Deleted.
* Source/WebCore/loader/CrossOriginOpenerPolicy.h:
(WebCore::CrossOriginOpenerPolicy::encode const): Deleted.
(WebCore::CrossOriginOpenerPolicy::decode): Deleted.
* Source/WebCore/loader/CustomHeaderFields.h:
(WebCore::CustomHeaderFields::encode const): Deleted.
(WebCore::CustomHeaderFields::decode): Deleted.
* Source/WebCore/loader/HTTPHeaderField.cpp:
(WebCore::HTTPHeaderField::HTTPHeaderField):
(WebCore::HTTPHeaderField::isValid):
(WebCore::HTTPHeaderField::create):
* Source/WebCore/loader/HTTPHeaderField.h:
(WebCore::HTTPHeaderField::encode const): Deleted.
(WebCore::HTTPHeaderField::decode): Deleted.
* Source/WebCore/loader/NavigationRequester.h:
(WebCore::NavigationRequester::encode const): Deleted.
(WebCore::NavigationRequester::decode): Deleted.
* Source/WebCore/loader/PolicyContainer.h:
(WebCore::PolicyContainer::isolatedCopy):
(WebCore::PolicyContainer::encode const): Deleted.
(WebCore::PolicyContainer::decode): Deleted.
* Source/WebCore/loader/SubstituteData.h:
(WebCore::SubstituteData::SubstituteData):
(WebCore::SubstituteData::isValid const):
(WebCore::SubstituteData::shouldRevealToSessionHistory const):
(WebCore::SubstituteData::content const):
(WebCore::SubstituteData::mimeType const):
(WebCore::SubstituteData::textEncoding const):
(WebCore::SubstituteData::failingURL const):
(WebCore::SubstituteData::response const):
(WebCore::SubstituteData::encode const): Deleted.
(WebCore::SubstituteData::decode): Deleted.
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

Canonical link: https://commits.webkit.org/259811@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Port-remaining-WebCoreloader-types-to-the-new-serialization-format branch from 2768bfc to 148e18a Compare February 3, 2023 12:40
@webkit-commit-queue
Copy link
Collaborator

Committed 259811@main (148e18a): https://commits.webkit.org/259811@main

Reviewed commits have been landed. Closing PR #9383 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 3, 2023
@webkit-early-warning-system webkit-early-warning-system merged commit 148e18a into WebKit:main Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Process Model Bugs related to WebKit's multi-process architecture
Projects
None yet
5 participants