[webkit-changes] [WebKit/WebKit] 716495: Provide raw JSON and whether a scope is default in...

Commit Queue noreply at github.com
Wed Oct 4 14:58:50 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 716495eb9cb2520b3086b0ed0bcdb98856d1684e
      https://github.com/WebKit/WebKit/commit/716495eb9cb2520b3086b0ed0bcdb98856d1684e
  Author: Luming Yin <luming_yin at apple.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

  Changed paths:
    M Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h
    M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp
    M Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h
    M Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm
    M Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp

  Log Message:
  -----------
  Provide raw JSON and whether a scope is default in application manifest
https://bugs.webkit.org/show_bug.cgi?id=262592
rdar://101850992

Reviewed by Chris Dumez.

Expose the raw JSON and url of the web app manifest, as well as whether the scope is
default instead of developer-specified.

* Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h:
* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp:
(WebCore::ApplicationManifestParser::parseManifest):
Set the raw JSON, manifest URL on the parsed manifest, and set the isDefaultScope flag to
true if the scope is default instead of developer-specified.

(WebCore::ApplicationManifestParser::parseScope):
Return an optional scope URL for the callsite to fall back to the default scope
and set the isDefaultScope accordingly.

* Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h:
Same as above.

* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Serialize rawJSON, manifestURL, and isDefaultScope.

* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKApplicationManifest.mm:
(-[_WKApplicationManifest initWithCoder:]):
(-[_WKApplicationManifest encodeWithCoder:]):
Encode and decode rawJSON, manifestURL and isDefaultScope.

(-[_WKApplicationManifest rawJSON]):
Return the raw JSON from the wrapped manifest object.

(-[_WKApplicationManifest isDefaultScope]):
Return whether the scope is default instead of developer-specified from the wrapped
manifest object.

(-[_WKApplicationManifest manifestURL]):
Return the manifest URL from the wrapped manifest object.

* Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp:
(ApplicationManifestParserTest::testRawJSON):
Test to ensure the rawJSON property is correctly populated based on whether the JSON
is valid.

(ApplicationManifestParserTest::testManifestURL):
Test to ensure the manifest URL is returned as-is from what's passed into the API.

(ApplicationManifestParserTest::testScope):
In addition to testing the resolved scope value, also test the correctness of
isDefaultScope.

(TEST_F):
Run testRawJSON with both valid and invalid raw JSON inputs. Run testManifestURL.

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




More information about the webkit-changes mailing list