Changeset 185683 in webkit
- Timestamp:
- Jun 17, 2015, 5:51:37 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/contentextensions/ContentExtensionParser.cpp (modified) (3 diffs)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185682 r185683 1 2015-06-17 Alex Christensen <achristensen@webkit.org> 2 3 [Content Extensions] Fail to parse invalid arrays 4 https://bugs.webkit.org/show_bug.cgi?id=146079 5 rdar://problem/21422649 6 7 Reviewed by Benjamin Poulain. 8 9 Covered by new and corrected API tests. 10 11 * contentextensions/ContentExtensionParser.cpp: 12 (WebCore::ContentExtensions::loadTrigger): 13 Fail to parse invalid arrays for if-domain, unless-domain, resource-type, and load-type arrays. 14 1 15 2015-06-16 Jon Honeycutt <jhoneycutt@apple.com> 2 16 -
trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp
r185555 r185683 132 132 133 133 JSValue resourceTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "resource-type")); 134 if ( resourceTypeValue && !exec.hadException()) {134 if (!exec.hadException() && resourceTypeValue.isObject()) { 135 135 auto typeFlagsError = getTypeFlags(exec, resourceTypeValue, trigger.flags, readResourceType); 136 136 if (typeFlagsError) 137 137 return typeFlagsError; 138 } 138 } else if (!resourceTypeValue.isUndefined()) 139 return ContentExtensionError::JSONInvalidTriggerFlagsArray; 139 140 140 141 JSValue loadTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "load-type")); 141 if ( loadTypeValue && !exec.hadException()) {142 if (!exec.hadException() && loadTypeValue.isObject()) { 142 143 auto typeFlagsError = getTypeFlags(exec, loadTypeValue, trigger.flags, readLoadType); 143 144 if (typeFlagsError) 144 145 return typeFlagsError; 145 } 146 } else if (!loadTypeValue.isUndefined()) 147 return ContentExtensionError::JSONInvalidTriggerFlagsArray; 146 148 147 149 JSValue ifDomain = triggerObject.get(&exec, Identifier::fromString(&exec, "if-domain")); … … 154 156 ASSERT(trigger.domainCondition == Trigger::DomainCondition::None); 155 157 trigger.domainCondition = Trigger::DomainCondition::IfDomain; 156 } 158 } else if (!ifDomain.isUndefined()) 159 return ContentExtensionError::JSONInvalidDomainList; 157 160 158 161 JSValue unlessDomain = triggerObject.get(&exec, Identifier::fromString(&exec, "unless-domain")); … … 166 169 return ContentExtensionError::JSONInvalidDomainList; 167 170 trigger.domainCondition = Trigger::DomainCondition::UnlessDomain; 168 } 171 } else if (!unlessDomain.isUndefined()) 172 return ContentExtensionError::JSONInvalidDomainList; 169 173 170 174 return { }; -
trunk/Tools/ChangeLog
r185674 r185683 1 2015-06-17 Alex Christensen <achristensen@webkit.org> 2 3 [Content Extensions] Fail to parse invalid arrays 4 https://bugs.webkit.org/show_bug.cgi?id=146079 5 rdar://problem/21422649 6 7 Reviewed by Benjamin Poulain. 8 9 * TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp: 10 (TestWebKitAPI::TEST_F): 11 Correct and add parsing tests with invalid arrays. 12 1 13 2015-06-17 Matt Rajca <mrajca@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp
r185555 r185683 806 806 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"load-type\":[5]}}]", 807 807 ContentExtensions::ContentExtensionError::JSONInvalidStringInTriggerFlagsArray); 808 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"load-type\":5}}]", 809 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 810 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"load-type\":\"first-party\"}}]", 811 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 812 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"load-type\":null}}]", 813 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 814 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"load-type\":false}}]", 815 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 808 816 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":{}}}]", 809 817 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); … … 812 820 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":[5]}}]", 813 821 ContentExtensions::ContentExtensionError::JSONInvalidStringInTriggerFlagsArray); 822 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":5}}]", 823 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 824 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":\"document\"}}]", 825 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 826 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":null}}]", 827 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 828 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"resource-type\":false}}]", 829 ContentExtensions::ContentExtensionError::JSONInvalidTriggerFlagsArray); 814 830 815 831 StringBuilder rules; … … 827 843 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":[5]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 828 844 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":[\"a\"]}}]", { }); 845 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":\"a\"}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 846 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":false}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 847 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":null}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 829 848 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":{}}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 830 849 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":[5]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 831 850 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":[\"\"]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 851 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":\"a\"}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 852 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":null}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 853 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":false}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 832 854 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":[\"A\"]}}]", ContentExtensions::ContentExtensionError::JSONDomainNotLowerCaseASCII); 833 855 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":[\"\\u00DC\"]}}]", ContentExtensions::ContentExtensionError::JSONDomainNotLowerCaseASCII); … … 837 859 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":[],\"unless-domain\":[\"a\"]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 838 860 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":[]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 839 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5}}]", { });840 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":5}}]", { });841 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5,\"unless-domain\":5}}]", { });861 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 862 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"unless-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 863 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":5,\"unless-domain\":5}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 842 864 checkCompilerError("[{\"action\":{\"type\":\"block\"},\"trigger\":{\"url-filter\":\"webkit.org\",\"if-domain\":[]}}]", ContentExtensions::ContentExtensionError::JSONInvalidDomainList); 843 865
Note:
See TracChangeset
for help on using the changeset viewer.