Browse Source

Hook sanbox.

Beginnings of sandboxing. Still need to completely mask window.
Nathaniel van Diepen 11 years ago
parent
commit
3935ca3fa0
1 changed files with 11 additions and 2 deletions
  1. 11 2
      app/www/js/omnomirc.js

+ 11 - 2
app/www/js/omnomirc.js

@@ -311,8 +311,16 @@
 		currentPlugin = 0,
 		runHook = function(name,args){
 			var i,r=true,hook,fn,sandbox = {
-				testing: 'test'
+				document: {},
+				alert: noop,
+				confirm: noop,
+				prompt: noop,
+				jQuery: window.jQuery,
+				$: window.jQuery,
+				$o: window.OmnomIRC,
+				OmnomIRC: window.OmnomIRC
 			};
+			sandbox.window = sandbox;
 			args=exists(args)?args:[];
 			for(i in hooks){
 				hook = hooks[i];
@@ -1038,7 +1046,8 @@
 									$: window.jQuery,
 									$o: window.OmnomIRC,
 									OmnomIRC: window.OmnomIRC,
-									document: {}
+									document: {},
+									location: {}
 								},
 								fn = data.replace(/\/\/.+?(?=\n|\r|$)|\/\*[\s\S]+?\*\//g,'').replace(/\"/g,'\\"').replace(/\n/g,'').replace(/\r/g,'');
 							sandbox.window = sandbox;