From 04ac84ff56b9780335560319a8ecd3e8b510874e Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 21 Jul 2019 22:31:02 -0400 Subject: Issue #1195 - Fix errant use of JSContext in ErrorNotes We want to ensure that ErrorNotes stays on the main thread to prevent a race condition that was introduced in 1283712 - Part 1. This fixes #1195. --- js/src/jsapi.cpp | 8 ++++---- js/src/jscntxt.cpp | 2 +- js/src/jscntxt.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'js/src') diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 7cc7bd035..84a315587 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -6326,7 +6326,7 @@ JSErrorNotes::~JSErrorNotes() } static UniquePtr -CreateErrorNoteVA(JSContext* cx, +CreateErrorNoteVA(ExclusiveContext* cx, const char* filename, unsigned lineno, unsigned column, JSErrorCallback errorCallback, void* userRef, const unsigned errorNumber, @@ -6357,7 +6357,7 @@ JSErrorNotes::addNoteASCII(ExclusiveContext* cx, { va_list ap; va_start(ap, errorNumber); - auto note = CreateErrorNoteVA(cx->asJSContext(), filename, lineno, column, errorCallback, userRef, + auto note = CreateErrorNoteVA(cx, filename, lineno, column, errorCallback, userRef, errorNumber, ArgumentsAreASCII, ap); va_end(ap); @@ -6376,7 +6376,7 @@ JSErrorNotes::addNoteLatin1(ExclusiveContext* cx, { va_list ap; va_start(ap, errorNumber); - auto note = CreateErrorNoteVA(cx->asJSContext(), filename, lineno, column, errorCallback, userRef, + auto note = CreateErrorNoteVA(cx, filename, lineno, column, errorCallback, userRef, errorNumber, ArgumentsAreLatin1, ap); va_end(ap); @@ -6395,7 +6395,7 @@ JSErrorNotes::addNoteUTF8(ExclusiveContext* cx, { va_list ap; va_start(ap, errorNumber); - auto note = CreateErrorNoteVA(cx->asJSContext(), filename, lineno, column, errorCallback, userRef, + auto note = CreateErrorNoteVA(cx, filename, lineno, column, errorCallback, userRef, errorNumber, ArgumentsAreUTF8, ap); va_end(ap); diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 441b006d6..e505a4b34 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -748,7 +748,7 @@ js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback, } bool -js::ExpandErrorArgumentsVA(JSContext* cx, JSErrorCallback callback, +js::ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback, void* userRef, const unsigned errorNumber, const char16_t** messageArgs, ErrorArgumentsType argumentsType, diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index c949d18fd..8be3376cf 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -622,7 +622,7 @@ ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback, JSErrorReport* reportp, va_list ap); extern bool -ExpandErrorArgumentsVA(JSContext* cx, JSErrorCallback callback, +ExpandErrorArgumentsVA(ExclusiveContext* cx, JSErrorCallback callback, void* userRef, const unsigned errorNumber, const char16_t** messageArgs, ErrorArgumentsType argumentsType, -- cgit v1.2.3