Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Use JSONValues instead of a JSC::VM to parse WKContentRuleLists
https://bugs.webkit.org/show_bug.cgi?id=231704 Patch by Alex Christensen <achristensen@webkit.org> on 2021-10-19 Reviewed by Brady Eidson. Source/WebCore: This makes the parser much simpler and easier to see what is going on. It probably also saves some memory because we don't need to make a VM just to parse JSON. Covered by existing tests. There are extensive tests for invalid input, and there is only one change in the error reported: we used to say the top level has to be an object, then we would say that it has to be an array. JavaScript arrays are objects, but JSON arrays aren't. Valid input continues to parse the same, and invalid input continues to fail to parse, but the error is more accurate now. * contentextensions/ContentExtensionError.cpp: (WebCore::ContentExtensions::contentExtensionErrorCategory): * contentextensions/ContentExtensionError.h: * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::getStringList): (WebCore::ContentExtensions::getDomainList): (WebCore::ContentExtensions::getTypeFlags): (WebCore::ContentExtensions::loadTrigger): (WebCore::ContentExtensions::loadAction): (WebCore::ContentExtensions::loadRule): (WebCore::ContentExtensions::loadEncodedRules): (WebCore::ContentExtensions::parseRuleList): Tools: * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/243225@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284465 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information