Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
1. Special handling is given to filters which had to match against do…
Browse files Browse the repository at this point in the history
…cument origin only. The filter will only be considered if it satisfies the given criteria.

    - Should be in the form of `/czf*.` (without token) or `|https://` or `|http://` or `*`
    - Should have `domain=` option
    - Should not have a negated domain in its `domain=` option
    - Should not have `csp=` option
 examples:
 |http://$image,script,subdocument,third-party,xmlhttprequest,domain=dwindly.io
 |https://$image,other,script,stylesheet,third-party,domain=movies123.xyz
 $websocket,domain=povw1deo.com|povwideo.net|powvideo.net
 /czf*.$image,domain=100percentfedup.com

These filters had to be matched against each network request which was causing extra time. Now, these filters will only be considered when document origin matches the domain mentioned in the filter `domain=` option.

2. Added google keyword to badTokens list
3. Replaced substr with startWith method for string pattern matching
4. Validated regular expression based filter
5. Code optimizations
  • Loading branch information
uBlockAdmin committed May 24, 2019
1 parent 6aa7039 commit 847bab7
Show file tree
Hide file tree
Showing 7 changed files with 360 additions and 368 deletions.
2 changes: 1 addition & 1 deletion platform/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "uBlock",
"version": "0.9.5.15",
"version": "0.9.5.16",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down
4 changes: 2 additions & 2 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ return {

// read-only
systemSettings: {
compiledMagic: 'eopszukpsddd',
selfieMagic: 'menhiasrsddd'
compiledMagic: 'krpszukpsddd',
selfieMagic: 'ednhiasrsddd'
},
restoreBackupSettings: {
lastRestoreFile: '',
Expand Down
1 change: 1 addition & 0 deletions src/js/messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ var filterRequests = function(pageStore, details) {
request = requests[i];
context.requestURL = vAPI.punycodeURL(request.url);
context.requestHostname = µburi.hostnameFromURI(request.url);
context.requestDomain = µburi.domainFromHostname(context.requestHostname);
context.requestType = tagNameToRequestTypeMap[request.tagName];
if ( isBlockResult(pageStore.filterRequest(context)) ) {
request.collapse = true;
Expand Down
5 changes: 5 additions & 0 deletions src/js/pagestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ FrameStore.prototype.init = function(rootHostname, frameURL) {
this.pageURL = frameURL;
this.pageHostname = µburi.hostnameFromURI(frameURL);
this.pageDomain = µburi.domainFromHostname(this.pageHostname) || this.pageHostname;
this.pageHostnameHashes = µb.getHostnameHashesFromLabelsBackward(this.pageHostname, this.pageDomain, false);
return this;
};

Expand Down Expand Up @@ -440,6 +441,7 @@ PageStore.prototype.createContextFromPage = function() {
var context = new µb.tabContextManager.createContext(this.tabId);
context.pageHostname = context.rootHostname;
context.pageDomain = context.rootDomain;
context.pageHostnameHashes = context.rootHostnameHashes;
return context;
};

Expand All @@ -449,9 +451,11 @@ PageStore.prototype.createContextFromFrameId = function(frameId) {
var frameStore = this.frames[frameId];
context.pageHostname = frameStore.pageHostname;
context.pageDomain = frameStore.pageDomain;
context.pageHostnameHashes = frameStore.pageHostnameHashes;
} else {
context.pageHostname = context.rootHostname;
context.pageDomain = context.rootDomain;
context.pageHostnameHashes = context.rootHostnameHashes;
}
return context;
};
Expand All @@ -460,6 +464,7 @@ PageStore.prototype.createContextFromFrameHostname = function(frameHostname) {
var context = new µb.tabContextManager.createContext(this.tabId);
context.pageHostname = frameHostname;
context.pageDomain = µb.URI.domainFromHostname(frameHostname) || frameHostname;
context.pageHostnameHashes = µb.getHostnameHashesFromLabelsBackward(context.pageHostname, context.pageDomain, false);
return context;
};

Expand Down
Loading

0 comments on commit 847bab7

Please sign in to comment.