mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
code review: reset internal parser data once done parsing
This commit is contained in:
parent
ec56165d0d
commit
15530df0e7
1 changed files with 9 additions and 1 deletions
|
@ -62,6 +62,13 @@
|
|||
suffix: ''
|
||||
};
|
||||
|
||||
// To be called to ensure no big parent string of a string slice is
|
||||
// left into memory after parsing filter lists is over.
|
||||
var resetParsed = function() {
|
||||
parsed.hostnames = [];
|
||||
parsed.suffix = '';
|
||||
};
|
||||
|
||||
var isValidCSSSelector = (function() {
|
||||
var div = document.createElement('div'),
|
||||
matchesFn;
|
||||
|
@ -458,6 +465,7 @@
|
|||
µb.cosmeticFilteringEngine.reset();
|
||||
µb.scriptletFilteringEngine.reset();
|
||||
µb.htmlFilteringEngine.reset();
|
||||
resetParsed(parsed);
|
||||
};
|
||||
|
||||
api.freeze = function() {
|
||||
|
@ -465,6 +473,7 @@
|
|||
µb.cosmeticFilteringEngine.freeze();
|
||||
µb.scriptletFilteringEngine.freeze();
|
||||
µb.htmlFilteringEngine.freeze();
|
||||
resetParsed(parsed);
|
||||
};
|
||||
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1004
|
||||
|
@ -691,7 +700,6 @@
|
|||
cosmetic: µb.cosmeticFilteringEngine.toSelfie(),
|
||||
scriptlets: µb.scriptletFilteringEngine.toSelfie(),
|
||||
html: µb.htmlFilteringEngine.toSelfie()
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue