Add a class for parsing application manifests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2017 00:57:33 +0000 (00:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2017 00:57:33 +0000 (00:57 +0000)
commit0bfecb0886f3315ef4dc6c4bec256c248dcc7499
tree6b8279c2e2dc0c45ef0d5de7ec65d9fb9ce1c194
parent120d9ac8e584e066071ec4c162241a8d13a0e66e
Add a class for parsing application manifests
https://bugs.webkit.org/show_bug.cgi?id=177973
rdar://problem/34747949

Patch by David Quesada <david_quesada@apple.com> on 2017-12-04
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.

Source/WebCore:

Add a new struct ApplicationManifest, along with ApplicationManifestParser to initialize
ApplicationManifests from JSON data, according to the App Manifest spec. Just a basic subset
of the manifests's properties are implemented to start with.

ApplicationManifestParser is tested by new unit tests in TestWebKitAPI.

* Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
* Modules/applicationmanifest/ApplicationManifest.h: Added.
* Modules/applicationmanifest/ApplicationManifestParser.cpp: Added.
(WebCore::ApplicationManifestParser::parse):
The main entry point for eventual clients (and currently the unit tests) to invoke
ApplicationManifestParser. There is a variant that accepts a ScriptExecutionContext that
uses the context exclusively for logging console warnings while parsing the manifest, and
not for actually executing any scripts.
(WebCore::ApplicationManifestParser::ApplicationManifestParser):
(WebCore::ApplicationManifestParser::parseManifest):
(WebCore::ApplicationManifestParser::logManifestPropertyNotAString):
(WebCore::ApplicationManifestParser::logManifestPropertyInvalidURL):
(WebCore::ApplicationManifestParser::logDeveloperWarning):
(WebCore::ApplicationManifestParser::parseStartURL):
(WebCore::ApplicationManifestParser::parseName):
(WebCore::ApplicationManifestParser::parseDescription):
(WebCore::ApplicationManifestParser::parseShortName):
(WebCore::isInScope):
(WebCore::ApplicationManifestParser::parseScope):
(WebCore::ApplicationManifestParser::parseGenericString):
* Modules/applicationmanifest/ApplicationManifestParser.h: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* features.json: Change the Web App Manifest feature status to "In Development"

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.

Source/WebKit:

* Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.

Tools:

Add basic unit tests for ApplicationManifestParser. For each of the implemented top-level properties,
attempt to parse manifests with varying types of valid and invalid data to ensure the resulting
ApplicationManifest is configured with the appropriate values per the spec.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Add ENABLE_APPLICATION_MANIFEST feature flag.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp: Added.
(ApplicationManifestParserTest::SetUp):
(ApplicationManifestParserTest::parseString):
(ApplicationManifestParserTest::parseTopLevelProperty):
(ApplicationManifestParserTest::testStartURL):
(ApplicationManifestParserTest::testName):
(ApplicationManifestParserTest::testDescription):
(ApplicationManifestParserTest::testShortName):
(ApplicationManifestParserTest::testScope):
(assertManifestHasDefaultValues):
(TEST_F):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225507 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/Modules/applicationmanifest/ApplicationManifest.h [new file with mode: 0644]
Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.cpp [new file with mode: 0644]
Source/WebCore/Modules/applicationmanifest/ApplicationManifestParser.h [new file with mode: 0644]
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/features.json
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Tools/ChangeLog
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp [new file with mode: 0644]