jjzjj

module_eval

全部标签

javascript - javascript eval 真的有那么大的安全威胁吗?

这个问题在这里已经有了答案:WhyisusingtheJavaScriptevalfunctionabadidea?(25个答案)关闭9年前。假设没有可用于修改某人计算机的浏览器端安全漏洞,我不明白使用eval会如何导致任何真正的威胁。谁能解释一下这是怎么可能的。有人可以在用户的​​计算机上显示某些内容,但如果不进行重定向或接受下载,就不会造成真正的伤害。不会造成服务器端损坏,对吧?

javascript - Angular : Mixing provider and custom service in module's config/run

我想做这样的事情:angular.module('app',[]).config(['$httpProvider','customAuthService',($httpProvider,customAuthService)->$httpProvider.defaults.transformRequest.push(data)->ifcustomAuthService.isLoggedIndata['api_key']={token:@token}])根据Angularjsdoc,我不能在我的module的configblock中执行此操作,因为那里不允许自定义服务,我也不能在run中执

javascript - es6-module 默认导出导入为未定义

我不确定我在这里遗漏了什么。我正在使用jspm和es6-module-loader开发一个项目。我有一个定义如下的模块:importhooksfrom'./hooks';importapifrom'./api';importtoolsfrom'./tools';constStencilUtils={hooks:hooks,api:api,tools:tools,};export{hooks,api,tools};exportdefaultStencilUtils;/*globaldefine*/(function(root){if(typeofdefine==='function'&&

javascript - 错误 : "Cannot find module" while running firebase cloud function

constfunctions=require('firebase-functions');varnodemailer=require('nodemailer');//constexpress=require('express');vartransporter=nodemailer.createTransport('smtps://username@gmail.com:password5@smtp.gmail.com');exports.sendMail=functions.https.onRequest((req,res)=>{varmailOptions={to:'receiver@

javascript - 使用 "eval"创建匿名方法 - 浏览器特定行为

我使用jQuery,我需要使用eval()函数生成一个匿名方法。以下行适用于Opera但不适用于IE、FF、Chrome:varcallbackStr="function(){alert('asdf');}";varcallback=eval(callbackStr);callback();此代码适用于所有浏览器:varcallbackStr="varcallback=function(){alert('asdf');}";eval(callbackStr);callback();你看,我已经解决了我的问题。但我想知道,到底发生了什么。任何人都可以向我解释这种行为,或者告诉我在哪里可以

javascript - 运行 Gulp 会抛出错误 "Cannot find module ' ./lib/_stream_writable.js'”

我正在构建一个关于Root'sSageWordPressTheme的主题.设置并运行必要的命令后。每当我运行Gulp时,它都会抛出以下错误module.js:338throwerr;^Error:Cannotfindmodule'./lib/_stream_writable.js'atFunction.Module._resolveFilename(module.js:336:15)atFunction.Module._load(module.js:278:25)atModule.require(module.js:365:17)atrequire(module.js:384:17)a

javascript - Node module.exports 返回未定义

我遇到了Node.js和module.exports的问题。我知道module.exports是一个返回对象的调用,该对象具有分配给它的任何属性。如果我有这样的文件结构://formatting.jsfunctionFormat(text){this.text=text;}module.exports=Format;用这个://index.jsvarformatting=require('./formatting');有没有办法初始化一个Format对象并像这样使用它?formatting('foo');console.log(formatting.text);每当我尝试这样做时,我都

javascript - typescript + moment.js : error TS2307: Cannot find module 'moment'

我正在开发一个网络应用程序,使用angular1.5、typescript2.4.0、moment:2.18.1和gulp进行项目组装。这是我的tsconfig.json:{"files":["src/app/main.ts","types/**/*.ts"],"compilerOptions":{"noImplicitAny":false,"target":"es2015","allowSyntheticDefaultImports":true}}在我的date-range-picker.component.ts中。我正在导入时刻库,正如maindocumentation中所建议的那

javascript - 缓存 eval() 结果

在Javascript中,是否可以缓存eval的结果??例如,如果我可以的话就太好了:varstr="somecode...";varcode=eval(str);//lateron...code.reExecute(); 最佳答案 您可以使str成为函数的主体并使用NewFunction而不是eval。varfn=newFunction([param1,param2,...],str);并通过调用fn(p1,p2,...)重用它或者使用eval,让str变成类似varfn=eval("(function(a){alert(a);}

javascript - 错误 : Cannot find module 'wrench' , 当我运行 gulp 命令时出现此错误

我已经在本地和全局安装了npm、bower和gulp。当我在该文件夹中运行gulp时,仍然出现此错误。Error:Cannotfindmodule'wrench'atFunction.Module._resolveFilename(module.js:325:15)atFunction.Module._load(module.js:276:25)atModule.require(module.js:353:17)atrequire(internal/module.js:12:17)atObject.(/home/myPC/documents/workspace/frontend/gul