mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
1956d3d66b
12 changed files with 301 additions and 52 deletions
|
|
@ -1000,11 +1000,13 @@ private:
|
|||
class ReportErrorToConsoleRunnable final : public WorkerRunnable
|
||||
{
|
||||
const char* mMessage;
|
||||
const nsTArray<nsString> mParams;
|
||||
|
||||
public:
|
||||
// aWorkerPrivate is the worker thread we're on (or the main thread, if null)
|
||||
static void
|
||||
Report(WorkerPrivate* aWorkerPrivate, const char* aMessage)
|
||||
Report(WorkerPrivate* aWorkerPrivate, const char* aMessage,
|
||||
const nsTArray<nsString>& aParams)
|
||||
{
|
||||
if (aWorkerPrivate) {
|
||||
aWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
|
@ -1015,23 +1017,30 @@ public:
|
|||
// Now fire a runnable to do the same on the parent's thread if we can.
|
||||
if (aWorkerPrivate) {
|
||||
RefPtr<ReportErrorToConsoleRunnable> runnable =
|
||||
new ReportErrorToConsoleRunnable(aWorkerPrivate, aMessage);
|
||||
new ReportErrorToConsoleRunnable(aWorkerPrivate, aMessage, aParams);
|
||||
runnable->Dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t paramCount = aParams.Length();
|
||||
const char16_t** params = new const char16_t*[paramCount];
|
||||
for (uint16_t i=0; i<paramCount; ++i) {
|
||||
params[i] = aParams[i].get();
|
||||
}
|
||||
|
||||
// Log a warning to the console.
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
NS_LITERAL_CSTRING("DOM"),
|
||||
nullptr,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
aMessage);
|
||||
NS_LITERAL_CSTRING("DOM"), nullptr,
|
||||
nsContentUtils::eDOM_PROPERTIES, aMessage,
|
||||
paramCount ? params : nullptr, paramCount);
|
||||
delete[] params;
|
||||
}
|
||||
|
||||
private:
|
||||
ReportErrorToConsoleRunnable(WorkerPrivate* aWorkerPrivate, const char* aMessage)
|
||||
ReportErrorToConsoleRunnable(WorkerPrivate* aWorkerPrivate, const char* aMessage,
|
||||
const nsTArray<nsString>& aParams)
|
||||
: WorkerRunnable(aWorkerPrivate, ParentThreadUnchangedBusyCount),
|
||||
mMessage(aMessage)
|
||||
mMessage(aMessage), mParams(aParams)
|
||||
{ }
|
||||
|
||||
virtual void
|
||||
|
|
@ -1048,7 +1057,7 @@ private:
|
|||
{
|
||||
WorkerPrivate* parent = aWorkerPrivate->GetParent();
|
||||
MOZ_ASSERT_IF(!parent, NS_IsMainThread());
|
||||
Report(parent, mMessage);
|
||||
Report(parent, mMessage, mParams);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
@ -6022,13 +6031,22 @@ WorkerPrivate::ReportError(JSContext* aCx, JS::ConstUTF8CharsZ aToStringResult,
|
|||
// static
|
||||
void
|
||||
WorkerPrivate::ReportErrorToConsole(const char* aMessage)
|
||||
{
|
||||
nsTArray<nsString> emptyParams;
|
||||
WorkerPrivate::ReportErrorToConsole(aMessage, emptyParams);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
WorkerPrivate::ReportErrorToConsole(const char* aMessage,
|
||||
const nsTArray<nsString>& aParams)
|
||||
{
|
||||
WorkerPrivate* wp = nullptr;
|
||||
if (!NS_IsMainThread()) {
|
||||
wp = GetCurrentThreadWorkerPrivate();
|
||||
}
|
||||
|
||||
ReportErrorToConsoleRunnable::Report(wp, aMessage);
|
||||
ReportErrorToConsoleRunnable::Report(wp, aMessage, aParams);
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue