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

Side by Side Diff: lib/hooks.js

Issue 8938029: Added handling of override attempt using toSource to hook function (Closed)
Patch Set: Created Nov. 23, 2012, 12:26 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 the Adblock Plus build tools, 2 * This file is part of the Adblock Plus build tools,
3 * Copyright (C) 2006-2012 Eyeo GmbH 3 * Copyright (C) 2006-2012 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 if (typeof cleanup == "function") 45 if (typeof cleanup == "function")
46 cleanup(); 46 cleanup();
47 } 47 }
48 }; 48 };
49 newFunc.toString = function() 49 newFunc.toString = function()
50 { 50 {
51 dumbOverrideAttempt = true; 51 dumbOverrideAttempt = true;
52 return orig.toString(); 52 return orig.toString();
53 }; 53 };
54 newFunc.toSource = function()
55 {
56 dumbOverrideAttempt = true;
57 return orig.toSource();
58 }
54 59
55 obj.__defineGetter__(name, function() 60 obj.__defineGetter__(name, function()
56 { 61 {
57 dumbOverrideAttempt = false; 62 dumbOverrideAttempt = false;
58 return newFunc; 63 return newFunc;
59 }); 64 });
60 65
61 obj.__defineSetter__(name, function(value) 66 obj.__defineSetter__(name, function(value)
62 { 67 {
63 if (dumbOverrideAttempt) 68 if (dumbOverrideAttempt)
(...skipping 15 matching lines...) Expand all
79 { 84 {
80 obj.__defineGetter__(name, origGet); 85 obj.__defineGetter__(name, origGet);
81 } 86 }
82 if (origSet) 87 if (origSet)
83 { 88 {
84 obj.__defineSetter__(name, origSet); 89 obj.__defineSetter__(name, origSet);
85 } 90 }
86 }; 91 };
87 } 92 }
88 exports.hook = hook; 93 exports.hook = hook;
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