Bug 146079

Summary: [Content Extensions] Fail to parse invalid arrays
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: WebCore Misc.Assignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch benjamin: review+

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.