Browse Source

移除代码中的eval,修改content-security-policy

zxlie 9 years ago
parent
commit
4d408100fc

+ 2 - 2
chrome/manifest.json

@@ -1,6 +1,6 @@
 {
     "name": "WEB前端助手(FeHelper)",
-    "version": "8.1",
+    "version": "8.2",
     "manifest_version": 2,
 
     "default_locale": "zh_CN",
@@ -134,7 +134,7 @@
             "all_frames": false
         }
     ],
-    "content_security_policy": "script-src 'self' https://ssl.google-analytics.com 'unsafe-eval'; object-src 'self'",
+    "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
     "homepage_url": "https://www.baidufe.com/fehelper"
 
 }

+ 1 - 1
chrome/online.manifest.json

@@ -1,6 +1,6 @@
 {
     "name": "WEB前端助手(FeHelper)",
-    "version": "8.1",
+    "version": "8.2",
     "manifest_version": 2,
 
     "default_locale": "zh_CN",

+ 5 - 6
chrome/static/js/core/core.js

@@ -24,6 +24,7 @@ baidu.namespace.register = function(fullNS){
     var nsArray = fullNS.split('.');
     var sEval = "";
     var sNS = "";
+    var _tmpObj = [window];
     for (var i = 0; i < nsArray.length; i++){
 		//命名空间合法性校验
 		if(!reg.test(nsArray[i])) {
@@ -31,13 +32,11 @@ baidu.namespace.register = function(fullNS){
 			return ;
 		}
 
-        if (i != 0) sNS += ".";
-        sNS += nsArray[i];
-        // 依次创建构造命名空间对象(假如不存在的话)的语句
-        sEval += "if (typeof(" + sNS + ") == 'undefined') " + sNS + " = new Object();";
+        _tmpObj[i+1] = _tmpObj[i][nsArray[i]];
+        if(typeof _tmpObj[i+1] == 'undefined') {
+            _tmpObj[i+1] = new Object();
+        }
     }
-	//生成命名空间
-    if (sEval != "") eval(sEval);
 };
 
 /**

+ 1 - 1
chrome/static/js/fe-helper.js

@@ -16,7 +16,7 @@ baidu.fehelper = (function(){
     var _loadCss = function(){
 
         if(!jQuery('#_fehelper_jq_ui_css_')[0]) {
-            var jqUiCss = chrome.extension.getURL('static/vendor/jquery-ui-1.8/css/jquery-ui-1.8.16.custom.hot_datauri.css');
+            var jqUiCss = chrome.extension.getURL('static/vendor/jquery-ui-1.8/jquery-ui.hot.css');
             jQuery('<link id="_fehelper_jq_ui_css_" href="' + jqUiCss + '" rel="stylesheet" type="text/css" />').appendTo('head');
 
             var fcpCss = chrome.extension.getURL('static/css/fe-helper.css');