Bug 146868

Summary: unless-domain and if-domain in Content Blocker don't appear to work
Product: WebKit Reporter: Michael <bugzilla>
Component: WebCore Misc.Assignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, benjamin, buildbot, commit-queue, deano.uk, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 525.x (Safari 3.2)   
Hardware: iPhone / iPad   
OS: Other   
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews104 for mac-mavericks-wk2
none
Patch
none
Patch
none
Patch none

Michael
Reported 2015-07-10 19:29:46 PDT
I am playing with the new Content Blocker extensions on iOS 9 beta 2/3 using Xcode 7.0 beta 2/3 and an iPhone 6. I was trying to block all webpages except those of white-listed domains. I thought this should do it: [ { "action": { "type": "block" }, "trigger": { "url-filter": ".*", "unless-domain": ["apple.com"] } } ] I would expect this to block all domains except Apple from loading, but instead all domains are blocked. If I change it to: [ { "action": { "type": "block" }, "trigger": { "url-filter": ".*", "if-domain": ["apple.com"] } } ] I would expect only Apple to be blocked while all other domains load correctly, but instead all domains including Apple load. My apologies if I'm missing something obvious; I'm brand new to programming.
Attachments
Patch (6.12 KB, patch)
2015-07-13 13:39 PDT, Alex Christensen
no flags
Patch (9.35 KB, patch)
2015-07-13 14:12 PDT, Alex Christensen
no flags
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (818.23 KB, application/zip)
2015-07-13 14:31 PDT, Build Bot
no flags
Patch (10.96 KB, patch)
2015-07-13 14:59 PDT, Alex Christensen
no flags
Patch (12.60 KB, patch)
2015-07-13 15:58 PDT, Alex Christensen
no flags
Patch (14.66 KB, patch)
2015-07-14 10:05 PDT, Alex Christensen
no flags
Michael
Comment 1 2015-07-10 19:35:33 PDT
I should add that the reason I was using unless-domain rather than doing something like [ { "action": { "type": "block" }, "trigger": { "url-filter": "apple.com" } } ] Was in order to create an array of either black-listed or white-listed domains using unless/if-domain.
Benjamin Poulain
Comment 2 2015-07-11 11:41:51 PDT
I can reproduce locally. Even with "unless-domain": ["*apple.com"], apple.com is blocked in minibrowser.
Radar WebKit Bug Importer
Comment 3 2015-07-11 11:42:09 PDT
Alex Christensen
Comment 4 2015-07-13 13:39:43 PDT
Alex Christensen
Comment 5 2015-07-13 14:12:30 PDT
Build Bot
Comment 6 2015-07-13 14:31:48 PDT
Comment on attachment 256722 [details] Patch Attachment 256722 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/6175807298863104 New failing tests: http/tests/contentextensions/sync-xhr-blocked.html http/tests/contentextensions/domain-rules.html http/tests/contentextensions/basic-filter.html http/tests/contentextensions/filters-with-quantifiers-combined.html http/tests/contentextensions/block-everything-unless-domain.html
Build Bot
Comment 7 2015-07-13 14:31:50 PDT
Created attachment 256728 [details] Archive of layout-test-results from ews104 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Alex Christensen
Comment 8 2015-07-13 14:59:38 PDT
Alex Christensen
Comment 9 2015-07-13 15:58:14 PDT
Benjamin Poulain
Comment 10 2015-07-13 18:26:47 PDT
Comment on attachment 256738 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=256738&action=review Thanks for fixing this! > Source/WebCore/contentextensions/ContentExtensionsBackend.cpp:176 > + mainDocumentURL = request.url(); What happen when the main request is a redirect? Will the next branch take over and give the right URL (the final one)? Can you add test coverage for that too?
Alex Christensen
Comment 11 2015-07-14 10:05:19 PDT
Alex Christensen
Comment 12 2015-07-14 10:06:45 PDT
Comment on attachment 256773 [details] Patch Added block-everything-unless-domain-redirect.php
WebKit Commit Bot
Comment 13 2015-07-14 10:38:06 PDT
Comment on attachment 256773 [details] Patch Clearing flags on attachment: 256773 Committed r186807: <http://trac.webkit.org/changeset/186807>
WebKit Commit Bot
Comment 14 2015-07-14 10:38:10 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.