void WebGLContext::GenerateWarning(const char* fmt, va_list ap) { if (!ShouldGenerateWarnings()) return; mAlreadyGeneratedWarnings++; char buf[1024]; PR_vsnprintf(buf, 1024, fmt, ap); // no need to print to stderr, as JS_ReportWarning takes care of this for us. if (!mCanvasElement) { return; } dom::AutoJSAPI api; if (!api.Init(mCanvasElement->OwnerDoc()->GetScopeObject())) { return; } JSContext* cx = api.cx(); JS_ReportWarning(cx, "WebGL: %s", buf); if (!ShouldGenerateWarnings()) { JS_ReportWarning(cx, "WebGL: No further warnings will be reported for this" " WebGL context. (already reported %d warnings)", mAlreadyGeneratedWarnings); } }
void WebGLContext::GenerateWarning(const char* fmt, va_list ap) const { if (!ShouldGenerateWarnings()) return; mAlreadyGeneratedWarnings++; char buf[1024]; VsprintfLiteral(buf, fmt, ap); // no need to print to stderr, as JS_ReportWarning takes care of this for us. if (!mCanvasElement) { return; } dom::AutoJSAPI api; if (!api.Init(mCanvasElement->OwnerDoc()->GetScopeObject())) { return; } JSContext* cx = api.cx(); const auto funcName = FuncName(); JS_ReportWarningASCII(cx, "WebGL warning: %s: %s", funcName, buf); if (!ShouldGenerateWarnings()) { JS_ReportWarningASCII(cx, "WebGL: No further warnings will be reported for" " this WebGL context." " (already reported %d warnings)", mAlreadyGeneratedWarnings); } }