Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterClasses.js

Issue 29800592: Noissue - Remove workaround for WebKit getter misoptimization (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 6, 2018, 2:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 */ 392 */
393 domainSourceIsUpperCase: false, 393 domainSourceIsUpperCase: false,
394 394
395 /** 395 /**
396 * Map containing domains that this filter should match on/not match 396 * Map containing domains that this filter should match on/not match
397 * on or null if the filter should match on all domains 397 * on or null if the filter should match on all domains
398 * @type {?Map.<string,boolean>} 398 * @type {?Map.<string,boolean>}
399 */ 399 */
400 get domains() 400 get domains()
401 { 401 {
402 // Despite this property being cached, the getter is called
403 // several times on Safari, due to WebKit bug 132872
404 let prop = Object.getOwnPropertyDescriptor(this, "domains");
405 if (prop)
406 return prop.value;
407
408 let domains = null; 402 let domains = null;
409 403
410 if (this.domainSource) 404 if (this.domainSource)
411 { 405 {
412 let source = this.domainSource; 406 let source = this.domainSource;
413 if (!this.domainSourceIsUpperCase) 407 if (!this.domainSourceIsUpperCase)
414 { 408 {
415 // RegExpFilter already have uppercase domains 409 // RegExpFilter already have uppercase domains
416 source = source.toUpperCase(); 410 source = source.toUpperCase();
417 } 411 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 * for delayed creation of the regexp property 632 * for delayed creation of the regexp property
639 * @type {string} 633 * @type {string}
640 */ 634 */
641 regexpSource: null, 635 regexpSource: null,
642 /** 636 /**
643 * Regular expression to be used when testing against this filter 637 * Regular expression to be used when testing against this filter
644 * @type {RegExp} 638 * @type {RegExp}
645 */ 639 */
646 get regexp() 640 get regexp()
647 { 641 {
648 // Despite this property being cached, the getter is called
649 // several times on Safari, due to WebKit bug 132872
650 let prop = Object.getOwnPropertyDescriptor(this, "regexp");
651 if (prop)
652 return prop.value;
653
654 let source = Filter.toRegExp(this.regexpSource); 642 let source = Filter.toRegExp(this.regexpSource);
655 let regexp = new RegExp(source, this.matchCase ? "" : "i"); 643 let regexp = new RegExp(source, this.matchCase ? "" : "i");
656 Object.defineProperty(this, "regexp", {value: regexp}); 644 Object.defineProperty(this, "regexp", {value: regexp});
657 this.regexpSource = null; 645 this.regexpSource = null;
658 return regexp; 646 return regexp;
659 }, 647 },
660 /** 648 /**
661 * Content types the filter applies to, combination of values from 649 * Content types the filter applies to, combination of values from
662 * RegExpFilter.typeMap 650 * RegExpFilter.typeMap
663 * @type {number} 651 * @type {number}
(...skipping 16 matching lines...) Expand all
680 * String that the sitekey property should be generated from 668 * String that the sitekey property should be generated from
681 * @type {?string} 669 * @type {?string}
682 */ 670 */
683 sitekeySource: null, 671 sitekeySource: null,
684 672
685 /** 673 /**
686 * @see ActiveFilter.sitekeys 674 * @see ActiveFilter.sitekeys
687 */ 675 */
688 get sitekeys() 676 get sitekeys()
689 { 677 {
690 // Despite this property being cached, the getter is called
691 // several times on Safari, due to WebKit bug 132872
692 let prop = Object.getOwnPropertyDescriptor(this, "sitekeys");
693 if (prop)
694 return prop.value;
695
696 let sitekeys = null; 678 let sitekeys = null;
697 679
698 if (this.sitekeySource) 680 if (this.sitekeySource)
699 { 681 {
700 sitekeys = this.sitekeySource.split("|"); 682 sitekeys = this.sitekeySource.split("|");
701 this.sitekeySource = null; 683 this.sitekeySource = null;
702 } 684 }
703 685
704 Object.defineProperty( 686 Object.defineProperty(
705 this, "sitekeys", {value: sitekeys, enumerable: true} 687 this, "sitekeys", {value: sitekeys, enumerable: true}
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 */ 1081 */
1100 function ElemHideEmulationFilter(text, domains, selector) 1082 function ElemHideEmulationFilter(text, domains, selector)
1101 { 1083 {
1102 ElemHideBase.call(this, text, domains, selector); 1084 ElemHideBase.call(this, text, domains, selector);
1103 } 1085 }
1104 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; 1086 exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
1105 1087
1106 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { 1088 ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
1107 type: "elemhideemulation" 1089 type: "elemhideemulation"
1108 }); 1090 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld