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

Side by Side Diff: lib/content/snippets.js

Issue 30033574: Issue 7419 - Allow wrapping function for abort-on-property-* (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Deal with function base property delayed creation Created March 29, 2019, 3:35 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 | test/browser/snippets.js » ('j') | 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 return; 709 return;
710 710
711 descriptor.configurable = true; 711 descriptor.configurable = true;
712 Object.defineProperty(object, property, descriptor); 712 Object.defineProperty(object, property, descriptor);
713 return; 713 return;
714 } 714 }
715 715
716 let name = property.slice(0, dotIndex); 716 let name = property.slice(0, dotIndex);
717 property = property.slice(dotIndex + 1); 717 property = property.slice(dotIndex + 1);
718 let value = object[name]; 718 let value = object[name];
719 if (value && typeof value == "object") 719 if (value && (typeof value == "object" || typeof value == "function"))
720 wrapPropertyAccess(value, property, descriptor); 720 wrapPropertyAccess(value, property, descriptor);
721 721
722 let currentDescriptor = Object.getOwnPropertyDescriptor(object, name); 722 let currentDescriptor = Object.getOwnPropertyDescriptor(object, name);
723 if (currentDescriptor && !currentDescriptor.configurable) 723 if (currentDescriptor && !currentDescriptor.configurable)
724 return; 724 return;
725 725
726 let setter = newValue => 726 let setter = newValue =>
727 { 727 {
728 value = newValue; 728 value = newValue;
729 if (newValue && typeof newValue == "object") 729 if (newValue && (typeof newValue == "object" || typeof value == "function"))
730 wrapPropertyAccess(newValue, property, descriptor); 730 wrapPropertyAccess(newValue, property, descriptor);
731 }; 731 };
732 732
733 Object.defineProperty(object, name, { 733 Object.defineProperty(object, name, {
734 get: () => value, 734 get: () => value,
735 set: setter, 735 set: setter,
736 configurable: true 736 configurable: true
737 }); 737 });
738 } 738 }
739 739
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 928
929 args[0] = url.href; 929 args[0] = url.href;
930 } 930 }
931 931
932 return fetch_.apply(this, args); 932 return fetch_.apply(this, args);
933 }; 933 };
934 } 934 }
935 935
936 exports["strip-fetch-query-parameter"] = makeInjector(stripFetchQueryParameter, 936 exports["strip-fetch-query-parameter"] = makeInjector(stripFetchQueryParameter,
937 toRegExp, regexEscape); 937 toRegExp, regexEscape);
OLDNEW
« no previous file with comments | « no previous file | test/browser/snippets.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld