Changeset 605
- Timestamp:
- 01/18/08 22:09:00 (11 months ago)
- Files:
-
- trunk/src/chrome/chromeFiles/content/menucommander.js (modified) (1 diff)
- trunk/src/chrome/chromeFiles/content/miscapis.js (modified) (4 diffs)
- trunk/src/chrome/chromeFiles/content/utils.js (modified) (1 diff)
- trunk/src/chrome/chromeFiles/content/xmlhttprequester.js (modified) (1 diff)
- trunk/src/components/greasemonkey.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/chrome/chromeFiles/content/menucommander.js
r548 r605 20 20 GM_MenuCommander.prototype.registerMenuCommand = 21 21 function(commandName, commandFunc, accelKey, accelModifiers, accessKey) { 22 GM_apiLeakCheck(); 23 22 24 GM_log("> GM_MenuCommander.registerMenuCommand"); 23 25 trunk/src/chrome/chromeFiles/content/miscapis.js
r548 r605 8 8 9 9 GM_ScriptStorage.prototype.setValue = function(name, val) { 10 GM_apiLeakCheck(); 11 12 if (GM_apiLeakCheck()) { 13 alert('ALERT ALERT detected leaked GM_ API, aborting!\n'); 14 return; 15 } 16 10 17 this.prefMan.setValue(name, val); 11 18 }; 12 19 13 20 GM_ScriptStorage.prototype.getValue = function(name, defVal) { 21 GM_apiLeakCheck(); 22 14 23 return this.prefMan.getValue(name, defVal); 15 24 }; … … 20 29 21 30 GM_Resources.prototype.getResourceURL = function(name) { 31 GM_apiLeakCheck(); 32 22 33 var dep = this.getDep_(name); 23 34 … … 40 51 41 52 GM_Resources.prototype.getResourceText = function(name) { 53 GM_apiLeakCheck(); 54 42 55 var dep = this.getDep_(name); 43 56 return getContents(getDependencyFileURI(this.script, dep)); … … 65 78 66 79 GM_ScriptLogger.prototype.log = function(message) { 80 GM_apiLeakCheck(); 81 67 82 GM_log(this.prefix + message, true); 68 83 }; trunk/src/chrome/chromeFiles/content/utils.js
r548 r605 6 6 var GM_consoleService = Components.classes["@mozilla.org/consoleservice;1"] 7 7 .getService(Components.interfaces.nsIConsoleService); 8 9 function GM_apiLeakCheck() { 10 var stack = Components.stack; 11 12 do { 13 if (2 == stack.language) { 14 if ('file' != stack.filename.substr(0, 4) && 15 'chrome' != stack.filename.substr(0, 6)) { 16 throw new Error("Greasemonkey access violation"); 17 } 18 } 19 20 stack = stack.caller; 21 } while (stack); 22 }; 8 23 9 24 function GM_isDef(thing) { trunk/src/chrome/chromeFiles/content/xmlhttprequester.js
r590 r605 13 13 // text/xml and we can't support that 14 14 GM_xmlhttpRequester.prototype.contentStartRequest = function(details) { 15 GM_apiLeakCheck(); 16 15 17 // don't actually need the timer functionality, but this pops it 16 18 // out into chromeWindow's thread so that we get that security trunk/src/components/greasemonkey.js
r548 r605 313 313 314 314 openInTab: function(unsafeContentWin, url) { 315 GM_apiLeakCheck(); 316 315 317 var unsafeTop = new XPCNativeWrapper(unsafeContentWin, "top").top; 316 318
