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.
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.
I can reproduce locally. Even with "unless-domain": ["*apple.com"], apple.com is blocked in minibrowser.
<rdar://problem/21782350>
Created attachment 256718 [details] Patch
Created attachment 256722 [details] Patch
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
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
Created attachment 256731 [details] Patch
Created attachment 256738 [details] Patch
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?
Created attachment 256773 [details] Patch
Comment on attachment 256773 [details] Patch Added block-everything-unless-domain-redirect.php
Comment on attachment 256773 [details] Patch Clearing flags on attachment: 256773 Committed r186807: <http://trac.webkit.org/changeset/186807>
All reviewed patches have been landed. Closing bug.