RESOLVED FIXED146079
[Content Extensions] Fail to parse invalid arrays
https://bugs.webkit.org/show_bug.cgi?id=146079
Summary [Content Extensions] Fail to parse invalid arrays
Alex Christensen
Reported 2015-06-17 14:58:21 PDT
Right now there are some cases where we parse but ignore invalid arrays. We should not succeed to parse these rules to prevent confusing developers.
Attachments
Patch (10.06 KB, patch)
2015-06-17 15:03 PDT, Alex Christensen
benjamin: review+
Alex Christensen
Comment 1 2015-06-17 15:03:00 PDT
Benjamin Poulain
Comment 2 2015-06-17 15:20:48 PDT
Comment on attachment 255039 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=255039&action=review > Source/WebCore/contentextensions/ContentExtensionParser.cpp:138 > + } else if (!resourceTypeValue.isUndefined()) else if (resourceTypeValue)? > Source/WebCore/contentextensions/ContentExtensionParser.cpp:146 > + } else if (!loadTypeValue.isUndefined()) ditto > Source/WebCore/contentextensions/ContentExtensionParser.cpp:158 > + } else if (!ifDomain.isUndefined()) ditto > Source/WebCore/contentextensions/ContentExtensionParser.cpp:171 > + } else if (!unlessDomain.isUndefined()) ditto > Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:820 > + checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":\"document\"}}]", Test passing null and undefined arguments? Maybe an array like object too? > Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:851 > + checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); > + checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); > + checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5,\"unless-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); ditto
Alex Christensen
Comment 3 2015-06-17 17:47:10 PDT
(In reply to comment #2) > > Source/WebCore/contentextensions/ContentExtensionParser.cpp:138 > > + } else if (!resourceTypeValue.isUndefined()) > > else if (resourceTypeValue)? Nope. That means something else. > > Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:820 > > + checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":\"document\"}}]", > > Test passing null and undefined arguments? Maybe an array like object too? Done.
Alex Christensen
Comment 4 2015-06-17 17:52:50 PDT
Note You need to log in before you can comment on or make changes to this bug.