| 241 | } |
| 242 | |
| 243 | void gjs_warning_reporter(JSContext*, JSErrorReport* report) { |
| 244 | GLogLevelFlags level; |
| 245 | |
| 246 | g_assert(report); |
| 247 | |
| 248 | if (gjs_environment_variable_is_set("GJS_ABORT_ON_OOM") && |
| 249 | !report->isWarning() && report->errorNumber == 137) { |
| 250 | // 137, JSMSG_OUT_OF_MEMORY |
| 251 | g_error("GJS ran out of memory at %s:%u:%u.", report->filename.c_str(), |
| 252 | report->lineno, report->column.oneOriginValue()); |
| 253 | } |
| 254 | |
| 255 | const char* warning; |
| 256 | if (report->isWarning()) { |
| 257 | warning = "WARNING"; |
| 258 | level = G_LOG_LEVEL_MESSAGE; |
| 259 | |
| 260 | // suppress bogus warnings. See mozilla/js/src/js.msg |
| 261 | if (report->errorNumber == 162) { |
| 262 | /* 162, JSMSG_UNDEFINED_PROP: warns every time a lazy property is |
| 263 | * resolved, since the property starts out undefined. When this is a |
| 264 | * real bug it should usually fail somewhere else anyhow. |
| 265 | */ |
| 266 | return; |
| 267 | } |
| 268 | } else { |
| 269 | warning = "REPORTED"; |
| 270 | level = G_LOG_LEVEL_WARNING; |
| 271 | } |
| 272 | |
| 273 | g_log(G_LOG_DOMAIN, level, "JS %s: %s:%u:%u: %s", warning, |
| 274 | report->filename.c_str(), report->lineno, |
| 275 | report->column.oneOriginValue(), report->message().c_str()); |
| 276 | } |
nothing calls this directly
no test coverage detected