RESOLVED FIXED 145528
[Content Extensions] resource-type and load-type should be independent
https://bugs.webkit.org/show_bug.cgi?id=145528
Summary [Content Extensions] resource-type and load-type should be independent
Alex Christensen
Reported 2015-06-01 15:08:48 PDT
Right now we use the same uint16_t to store all the load-type and resource-type flags, then we just do a bitwise and to check both at the same time. This results in a trigger with load-type and resource-type firing if either condition is met, not both conditions. A trigger with both resource-type and load-type conditions should only fire if both conditions are met.
Attachments
Patch (5.50 KB, patch)
2015-06-01 15:12 PDT, Alex Christensen
benjamin: review+
Alex Christensen
Comment 1 2015-06-01 15:12:02 PDT
Benjamin Poulain
Comment 2 2015-06-01 15:32:58 PDT
Comment on attachment 254015 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254015&action=review > Source/WebCore/ChangeLog:8 > + Covered by existing tests and a new API test. IMHO, you should explain the bug here. Having the explanation in bugzilla is not enough. > Source/WebCore/contentextensions/DFABytecodeInterpreter.cpp:81 > + bool shouldAppendAction = false; > + if (shouldCheckLoadType && shouldCheckResourceType) > + shouldAppendAction = (flagsToCheck & LoadTypeMask & flags) && (flagsToCheck & ResourceTypeMask & flags); > + else if (shouldCheckLoadType) > + shouldAppendAction = flagsToCheck & LoadTypeMask & flags; > + else { > + ASSERT(shouldCheckResourceType); > + shouldAppendAction = flagsToCheck & ResourceTypeMask & flags; > + } What about: uint16_t loadTypeFlags = flagsToCheck & LoadTypeMask; uint16_t ressourceTypeFlags = flagsToCheck & ResourceTypeMask; bool loadTypeMatches = loadTypeFlags ? (loadTypeFlags & flags) : true; bool ressourceTypeMatches = ressourceTypeFlags ? (ressourceTypeFlags & flags) : true; if (loadTypeMatches && ressourceTypeMatches) ...
Alex Christensen
Comment 3 2015-06-01 15:34:31 PDT
Alex Christensen
Comment 4 2015-06-01 15:41:22 PDT
Note You need to log in before you can comment on or make changes to this bug.