瀏覽代碼

Hook sanbox.

Beginnings of sandboxing. Still need to completely mask window.
Nathaniel van Diepen 11 年之前
父節點
當前提交
3935ca3fa0
共有 1 個文件被更改,包括 11 次插入2 次删除
  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;