mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1259877 - Update DoCallFallback to use js::CallFromStack. r=jandem (16a263ebc8) - Bug 1259877 - Intl.cpp:GetInternals should directly return its result, not go via outparam. r=till (6e3f5a508f) - Bug 1165052 - Part 7: Implement native ArraySpeciesCreate wrapper. r=efaust (3b113b8862) - Bug 1233862 - Add a WeakCache builtin to automatically manage sweeping; r=sfink (e4a63eeae3) - Bug 1198701 - ArrayIterator gets length property after iteration has finished. r=till (e91e514ce7) - Bug 1254853 - Add a Helper to Report a ScriptError to the Main Thread. r=khuey (4fb04c563e) - Bug 1259294: Part 1 - Add MOZ_ALWAYS_SUCCEEDS. r=froydnj (646513400c) - Bug 1257758 - Adjust step numbering in scripted proxy code to be ES6-correct. r=evilpie (bbd060f0d0) - Bug 1265594 - Expose FromPropertyDescriptor() as a public JS API; r=jorendorff (b84183bdbd) - reapply Bug 1258163 - Implement Array.prototype[@@unscopables]. r=shu, r=bholley. (7790e0e824) - Bug 1253371 - make atomics range checking conformant. r=jolesen (8830769fd8) - Bug 1253351 - count argument of futexWake defaults to +Infinity. r=bbouvier (e6da823106) - Bug 1259544 - remove futexWakeOrRequeue. r=bbouvier (35e922f333) - Bug 1260696: Update wasm text format spewing; r=luke (62b1f8577a) - Bug 1260737: wasm: Implement Reinterpret opcodes; r=luke (d3a6117e59) - Bug 1225028 - remove Atomics.fence. r=bbouvier (51d9f55f83) - Bug 1253344: Defer br/br_if/br_table then-block definition to avoid indirections; r=sunfish (e28b024386) - Bug 1254142: Baldr: make control flow opcodes yield subexpressions; r=luke (b82d9c89fc) - Bug 1260910 - introduce 'wait' and 'wake'. r=bbouvier (cd3e94119f) - Bug 1260835 - Atomics.wait returns strings + remove symbolic constants. r=jolesen (33ef0d61d8) - Bug 1041586 - Autogenerate symbol names. r=jorendorff (12fa06b6a5) - Bug 1241088: SharedStubs - part 1: move NewArray and NewObject baseline stubs to shared stubs, r=efaust (846d537ca8) - Bug 1241088: SharedStubs - part 2: port NewArray and NewObject shared stubs to work in ion, r=efaust (c073756376) - Bug 1246061. r=jandem, r=bz, r=luke, r=froydnj (c065b403d4) - Bug 1263870: Check allocation in WasmAstModule::declare; r=luke (d3b2a2acd7) - Bug 1242040. Fix the GlobalObject usage in ExtendableEvent::GetPromise. r=bkelly (d9e284ad62) - Bug 1255832. Propagate out JS exceptions properly from some methods in dom/mobilemessage. r=bholley (8c8d9ce3db) - Bug 1255817 part 2. Get rid of AutoJSAPI::OwnsErrorReporting and AutoJSAPI::TakeOwnershipOfErrorReporting. r=bholley (4f1c052fe6) - Bug 1259936: Baldr: Simplify calls stack bytes management; r=luke (30c58b319f) - Bug 1259936: Extra test case; r=luke (116079c082) - Bug 1261577: Always set the result of a dead loop in wasm; r=luke (67014be844) - Bug 1261404: Ensure BrTable only set successors once; r=sunfish (6989814189) - Bug 875433 - Implement Array.prototype.values. r=jorendorff. (423fa799dc) - Bug 1250947. Fill area outside blur with solid color. r=mstange (bc54b70a1c) - Bug 1259578 - Use GC infrastructure to allocate proxy's malloced blob; r=jonco (fa28d8f8c4) - Bug 1259580 - Hide as many Proxy details as possible behind a detail namespace; r=efaust (86bed5cab5) - Bug 1215265 - Shut PImageBridge down properly. r=sotaro (f387f89418) - Bug 1215265 - Shut PCompositorBridge down properly. r=sotaro (a573020692) - Bug 1262367: Baldr: Rename "trap" to "unreachable"; r=luke (2f9d10ade7) - Bug 1263884 - Don't report OOM when speculative shape table shrink fails r=jandem (cabd97f681) - Bug 1259877 - Update miscellaneous code to use js::Call instead of js::Invoke. r=till (a2f417c8a1) - Bug 1262402: Add i64 testing infrastructure in Baldr; r=luke (d9d82c0acb)
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ScriptErrorHelper.h"
|
||||
|
||||
#include "MainThreadUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ScriptErrorRunnable final : public nsRunnable
|
||||
{
|
||||
nsString mMessage;
|
||||
nsCString mMessageName;
|
||||
nsString mFilename;
|
||||
uint32_t mLineNumber;
|
||||
uint32_t mColumnNumber;
|
||||
uint32_t mSeverityFlag;
|
||||
uint64_t mInnerWindowID;
|
||||
bool mIsChrome;
|
||||
|
||||
public:
|
||||
ScriptErrorRunnable(const nsAString& aMessage,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
: mMessage(aMessage)
|
||||
, mFilename(aFilename)
|
||||
, mLineNumber(aLineNumber)
|
||||
, mColumnNumber(aColumnNumber)
|
||||
, mSeverityFlag(aSeverityFlag)
|
||||
, mInnerWindowID(aInnerWindowID)
|
||||
, mIsChrome(aIsChrome)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
mMessageName.SetIsVoid(true);
|
||||
}
|
||||
|
||||
ScriptErrorRunnable(const nsACString& aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
: mMessageName(aMessageName)
|
||||
, mFilename(aFilename)
|
||||
, mLineNumber(aLineNumber)
|
||||
, mColumnNumber(aColumnNumber)
|
||||
, mSeverityFlag(aSeverityFlag)
|
||||
, mInnerWindowID(aInnerWindowID)
|
||||
, mIsChrome(aIsChrome)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
mMessage.SetIsVoid(true);
|
||||
}
|
||||
|
||||
static void
|
||||
DumpLocalizedMessage(const nsCString& aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!aMessageName.IsEmpty());
|
||||
|
||||
nsXPIDLString localizedMessage;
|
||||
if (NS_WARN_IF(NS_FAILED(
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
aMessageName.get(),
|
||||
localizedMessage)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Dump(localizedMessage,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
aIsChrome,
|
||||
aInnerWindowID);
|
||||
}
|
||||
|
||||
static void
|
||||
Dump(const nsAString& aMessage,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoCString category;
|
||||
if (aIsChrome) {
|
||||
category.AssignLiteral("chrome ");
|
||||
} else {
|
||||
category.AssignLiteral("content ");
|
||||
}
|
||||
category.AppendLiteral("javascript");
|
||||
|
||||
nsCOMPtr<nsIConsoleService> consoleService =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||
MOZ_ASSERT(consoleService);
|
||||
|
||||
nsCOMPtr<nsIScriptError> scriptError =
|
||||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
|
||||
MOZ_ASSERT(scriptError);
|
||||
|
||||
if (aInnerWindowID) {
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
scriptError->InitWithWindowID(aMessage,
|
||||
aFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
category,
|
||||
aInnerWindowID)));
|
||||
} else {
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||
scriptError->Init(aMessage,
|
||||
aFilename,
|
||||
/* aSourceLine */ EmptyString(),
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
category.get())));
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(consoleService->LogMessage(scriptError)));
|
||||
}
|
||||
|
||||
NS_IMETHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mMessage.IsVoid() != mMessageName.IsVoid());
|
||||
|
||||
if (!mMessage.IsVoid()) {
|
||||
Dump(mMessage,
|
||||
mFilename,
|
||||
mLineNumber,
|
||||
mColumnNumber,
|
||||
mSeverityFlag,
|
||||
mIsChrome,
|
||||
mInnerWindowID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DumpLocalizedMessage(mMessageName,
|
||||
mFilename,
|
||||
mLineNumber,
|
||||
mColumnNumber,
|
||||
mSeverityFlag,
|
||||
mIsChrome,
|
||||
mInnerWindowID);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~ScriptErrorRunnable() {}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
namespace indexedDB {
|
||||
|
||||
/*static*/ void
|
||||
ScriptErrorHelper::Dump(const nsAString& aMessage,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
ScriptErrorRunnable::Dump(aMessage,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
aIsChrome,
|
||||
aInnerWindowID);
|
||||
} else {
|
||||
RefPtr<ScriptErrorRunnable> runnable =
|
||||
new ScriptErrorRunnable(aMessage,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
aIsChrome,
|
||||
aInnerWindowID);
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
ScriptErrorHelper::DumpLocalizedMessage(const nsACString& aMessageName,
|
||||
const nsAString& aFilename,
|
||||
uint32_t aLineNumber,
|
||||
uint32_t aColumnNumber,
|
||||
uint32_t aSeverityFlag,
|
||||
bool aIsChrome,
|
||||
uint64_t aInnerWindowID)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
ScriptErrorRunnable::DumpLocalizedMessage(nsAutoCString(aMessageName),
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
aIsChrome,
|
||||
aInnerWindowID);
|
||||
} else {
|
||||
RefPtr<ScriptErrorRunnable> runnable =
|
||||
new ScriptErrorRunnable(aMessageName,
|
||||
aFilename,
|
||||
aLineNumber,
|
||||
aColumnNumber,
|
||||
aSeverityFlag,
|
||||
aIsChrome,
|
||||
aInnerWindowID);
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace indexedDB
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
Reference in New Issue
Block a user