Bug 602212 - Use error message from js.msg when CSP blocks a call to eval r=jorendorff

This commit is contained in:
Tom Schuster 2011-11-24 19:39:02 +01:00
parent f8c682c633
commit c70627a126
2 changed files with 2 additions and 1 deletions

View File

@ -371,3 +371,4 @@ MSG_DEF(JSMSG_DEBUG_NOT_DEBUGGING, 284, 0, JSEXN_ERR, "can't set breakpoint:
MSG_DEF(JSMSG_DEBUG_COMPARTMENT_MISMATCH, 285, 2, JSEXN_TYPEERR, "{0}: descriptor .{1} property is an object in a different compartment than the target object")
MSG_DEF(JSMSG_DEBUG_NOT_SCRIPT_FRAME, 286, 0, JSEXN_ERR, "stack frame is not running JavaScript code")
MSG_DEF(JSMSG_CANT_WATCH_PROP, 287, 0, JSEXN_TYPEERR, "properties whose names are objects can't be watched")
MSG_DEF(JSMSG_CSP_BLOCKED_EVAL, 288, 0, JSEXN_ERR, "call to eval() blocked by CSP")

View File

@ -1154,7 +1154,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, StackFrame *c
AssertInnerizedScopeChain(cx, scopeobj);
if (!scopeobj.getGlobal()->isRuntimeCodeGenEnabled(cx)) {
JS_ReportError(cx, "call to eval() blocked by CSP");
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CSP_BLOCKED_EVAL);
return false;
}