зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland a=merge on a CLOSED TREE
This commit is contained in:
Коммит
98e1446184
|
@ -9,6 +9,7 @@
|
||||||
#include "mozilla/dom/ContentChild.h"
|
#include "mozilla/dom/ContentChild.h"
|
||||||
#include "mozilla/dom/TabChild.h"
|
#include "mozilla/dom/TabChild.h"
|
||||||
#include "mozilla/dom/DocGroup.h"
|
#include "mozilla/dom/DocGroup.h"
|
||||||
|
#include "mozilla/dom/TimeoutManager.h"
|
||||||
#include "mozilla/AbstractThread.h"
|
#include "mozilla/AbstractThread.h"
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
#include "mozilla/ClearOnShutdown.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
|
@ -23,6 +24,8 @@ namespace dom {
|
||||||
|
|
||||||
static StaticRefPtr<TabGroup> sChromeTabGroup;
|
static StaticRefPtr<TabGroup> sChromeTabGroup;
|
||||||
|
|
||||||
|
LinkedList<TabGroup>* TabGroup::sTabGroups = nullptr;
|
||||||
|
|
||||||
TabGroup::TabGroup(bool aIsChrome)
|
TabGroup::TabGroup(bool aIsChrome)
|
||||||
: mLastWindowLeft(false)
|
: mLastWindowLeft(false)
|
||||||
, mThrottledQueuesInitialized(false)
|
, mThrottledQueuesInitialized(false)
|
||||||
|
@ -31,6 +34,11 @@ TabGroup::TabGroup(bool aIsChrome)
|
||||||
, mIsChrome(aIsChrome)
|
, mIsChrome(aIsChrome)
|
||||||
, mForegroundCount(0)
|
, mForegroundCount(0)
|
||||||
{
|
{
|
||||||
|
if (!sTabGroups) {
|
||||||
|
sTabGroups = new LinkedList<TabGroup>();
|
||||||
|
}
|
||||||
|
sTabGroups->insertBack(this);
|
||||||
|
|
||||||
CreateEventTargets(/* aNeedValidation = */ !aIsChrome);
|
CreateEventTargets(/* aNeedValidation = */ !aIsChrome);
|
||||||
|
|
||||||
// Do not throttle runnables from chrome windows. In theory we should
|
// Do not throttle runnables from chrome windows. In theory we should
|
||||||
|
@ -54,6 +62,15 @@ TabGroup::~TabGroup()
|
||||||
MOZ_ASSERT(mDocGroups.IsEmpty());
|
MOZ_ASSERT(mDocGroups.IsEmpty());
|
||||||
MOZ_ASSERT(mWindows.IsEmpty());
|
MOZ_ASSERT(mWindows.IsEmpty());
|
||||||
MOZ_RELEASE_ASSERT(mLastWindowLeft || mIsChrome);
|
MOZ_RELEASE_ASSERT(mLastWindowLeft || mIsChrome);
|
||||||
|
|
||||||
|
LinkedListElement<TabGroup>* listElement =
|
||||||
|
static_cast<LinkedListElement<TabGroup>*>(this);
|
||||||
|
listElement->remove();
|
||||||
|
|
||||||
|
if (sTabGroups->isEmpty()) {
|
||||||
|
delete sTabGroups;
|
||||||
|
sTabGroups = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -323,5 +340,37 @@ TabGroup::Count(bool aActiveOnly) const
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ bool
|
||||||
|
TabGroup::HasOnlyThrottableTabs()
|
||||||
|
{
|
||||||
|
if (!sTabGroups) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TabGroup* tabGroup = sTabGroups->getFirst(); tabGroup;
|
||||||
|
tabGroup =
|
||||||
|
static_cast<LinkedListElement<TabGroup>*>(tabGroup)->getNext()) {
|
||||||
|
for (auto iter = tabGroup->Iter(); !iter.Done(); iter.Next()) {
|
||||||
|
DocGroup* docGroup = iter.Get()->mDocGroup;
|
||||||
|
for (auto* documentInDocGroup : *docGroup) {
|
||||||
|
if (documentInDocGroup->IsCurrentActiveDocument()) {
|
||||||
|
nsPIDOMWindowInner* win =
|
||||||
|
documentInDocGroup->GetInnerWindow();
|
||||||
|
if (win && win->IsCurrentInnerWindow()) {
|
||||||
|
nsPIDOMWindowOuter* outer = win->GetOuterWindow();
|
||||||
|
if (outer) {
|
||||||
|
TimeoutManager& tm = win->TimeoutManager();
|
||||||
|
if (!tm.BudgetThrottlingEnabled(outer->IsBackground())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -46,7 +46,8 @@ class TabChild;
|
||||||
class DocGroup;
|
class DocGroup;
|
||||||
class TabChild;
|
class TabChild;
|
||||||
|
|
||||||
class TabGroup final : public SchedulerGroup
|
class TabGroup final : public SchedulerGroup,
|
||||||
|
public LinkedListElement<TabGroup>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
class HashEntry : public nsCStringHashKey
|
class HashEntry : public nsCStringHashKey
|
||||||
|
@ -146,6 +147,16 @@ public:
|
||||||
return mNumOfIndexedDBDatabases;
|
return mNumOfIndexedDBDatabases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LinkedList<TabGroup>* GetTabGroupList()
|
||||||
|
{
|
||||||
|
return sTabGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This returns true if all the window objects in all the TabGroups are
|
||||||
|
// either inactive (for example in bfcache) or are in background tabs which
|
||||||
|
// can be throttled.
|
||||||
|
static bool HasOnlyThrottableTabs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual AbstractThread*
|
virtual AbstractThread*
|
||||||
AbstractMainThreadForImpl(TaskCategory aCategory) override;
|
AbstractMainThreadForImpl(TaskCategory aCategory) override;
|
||||||
|
@ -167,6 +178,8 @@ private:
|
||||||
DocGroupMap mDocGroups;
|
DocGroupMap mDocGroups;
|
||||||
nsTArray<nsPIDOMWindowOuter*> mWindows;
|
nsTArray<nsPIDOMWindowOuter*> mWindows;
|
||||||
uint32_t mForegroundCount;
|
uint32_t mForegroundCount;
|
||||||
|
|
||||||
|
static LinkedList<TabGroup>* sTabGroups;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
|
|
@ -111,6 +111,8 @@ public:
|
||||||
nsIEventTarget*
|
nsIEventTarget*
|
||||||
EventTarget();
|
EventTarget();
|
||||||
|
|
||||||
|
bool BudgetThrottlingEnabled(bool aIsBackground) const;
|
||||||
|
|
||||||
static const uint32_t InvalidFiringId;
|
static const uint32_t InvalidFiringId;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -149,8 +151,6 @@ private:
|
||||||
void UpdateBudget(const TimeStamp& aNow,
|
void UpdateBudget(const TimeStamp& aNow,
|
||||||
const TimeDuration& aDuration = TimeDuration());
|
const TimeDuration& aDuration = TimeDuration());
|
||||||
|
|
||||||
bool BudgetThrottlingEnabled(bool aIsBackground) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Timeouts {
|
struct Timeouts {
|
||||||
explicit Timeouts(const TimeoutManager& aManager)
|
explicit Timeouts(const TimeoutManager& aManager)
|
||||||
|
|
|
@ -16,7 +16,14 @@
|
||||||
class nsSMILKeySpline
|
class nsSMILKeySpline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsSMILKeySpline() { /* caller must call Init later */ }
|
nsSMILKeySpline()
|
||||||
|
: mX1(0)
|
||||||
|
, mY1(0)
|
||||||
|
, mX2(0)
|
||||||
|
, mY2(0)
|
||||||
|
{
|
||||||
|
/* caller must call Init later */\
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new key spline control point description.
|
* Creates a new key spline control point description.
|
||||||
|
@ -26,6 +33,10 @@ public:
|
||||||
*/
|
*/
|
||||||
nsSMILKeySpline(double aX1, double aY1,
|
nsSMILKeySpline(double aX1, double aY1,
|
||||||
double aX2, double aY2)
|
double aX2, double aY2)
|
||||||
|
: mX1(0)
|
||||||
|
, mY1(0)
|
||||||
|
, mX2(0)
|
||||||
|
, mY2(0)
|
||||||
{
|
{
|
||||||
Init(aX1, aY1, aX2, aY2);
|
Init(aX1, aY1, aX2, aY2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
nsSMILValue::nsSMILValue(const nsISMILType* aType)
|
nsSMILValue::nsSMILValue(const nsISMILType* aType)
|
||||||
: mType(nsSMILNullType::Singleton())
|
: mType(nsSMILNullType::Singleton())
|
||||||
{
|
{
|
||||||
|
mU.mBool = false;
|
||||||
if (!aType) {
|
if (!aType) {
|
||||||
NS_ERROR("Trying to construct nsSMILValue with null mType pointer");
|
NS_ERROR("Trying to construct nsSMILValue with null mType pointer");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -230,7 +230,10 @@ private:
|
||||||
* want to create the DOMSVGPathSeg items lazily on demand.
|
* want to create the DOMSVGPathSeg items lazily on demand.
|
||||||
*/
|
*/
|
||||||
struct ItemProxy {
|
struct ItemProxy {
|
||||||
ItemProxy(){}
|
ItemProxy()
|
||||||
|
: mItem(nullptr)
|
||||||
|
, mInternalDataIndex(0)
|
||||||
|
{}
|
||||||
ItemProxy(DOMSVGPathSeg *aItem, uint32_t aInternalDataIndex)
|
ItemProxy(DOMSVGPathSeg *aItem, uint32_t aInternalDataIndex)
|
||||||
: mItem(aItem)
|
: mItem(aItem)
|
||||||
, mInternalDataIndex(aInternalDataIndex)
|
, mInternalDataIndex(aInternalDataIndex)
|
||||||
|
|
|
@ -43,7 +43,9 @@ class SVGAnimatedNumberList
|
||||||
friend class DOMSVGNumberList;
|
friend class DOMSVGNumberList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SVGAnimatedNumberList() {}
|
SVGAnimatedNumberList()
|
||||||
|
: mIsBaseSet(false)
|
||||||
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Because it's so important that mBaseVal and its DOMSVGNumberList wrapper
|
* Because it's so important that mBaseVal and its DOMSVGNumberList wrapper
|
||||||
|
|
|
@ -112,7 +112,11 @@ public:
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimplePath()
|
SimplePath()
|
||||||
: mType(NONE)
|
: mX(0.0)
|
||||||
|
, mY(0.0)
|
||||||
|
, mWidthOrX2(0.0)
|
||||||
|
, mHeightOrY2(0.0)
|
||||||
|
, mType(NONE)
|
||||||
{}
|
{}
|
||||||
bool IsPath() const {
|
bool IsPath() const {
|
||||||
return mType != NONE;
|
return mType != NONE;
|
||||||
|
|
|
@ -33,10 +33,8 @@ class SVGLength
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SVGLength()
|
SVGLength()
|
||||||
#ifdef DEBUG
|
|
||||||
: mValue(0.0f)
|
: mValue(0.0f)
|
||||||
, mUnit(dom::SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN) // caught by IsValid()
|
, mUnit(dom::SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN) // caught by IsValid()
|
||||||
#endif
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SVGLength(float aValue, uint8_t aUnit)
|
SVGLength(float aValue, uint8_t aUnit)
|
||||||
|
|
|
@ -311,6 +311,8 @@ public:
|
||||||
|
|
||||||
SVGUserUnitList()
|
SVGUserUnitList()
|
||||||
: mList(nullptr)
|
: mList(nullptr)
|
||||||
|
, mElement(nullptr)
|
||||||
|
, mAxis(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Init(const SVGLengthList *aList, nsSVGElement *aElement, uint8_t aAxis) {
|
void Init(const SVGLengthList *aList, nsSVGElement *aElement, uint8_t aAxis) {
|
||||||
|
|
|
@ -64,7 +64,10 @@ struct MotionSegment
|
||||||
// Default constructor just locks us into being a Translation, and leaves
|
// Default constructor just locks us into being a Translation, and leaves
|
||||||
// other fields uninitialized (since client is presumably about to set them)
|
// other fields uninitialized (since client is presumably about to set them)
|
||||||
MotionSegment()
|
MotionSegment()
|
||||||
: mSegmentType(eSegmentType_Translation)
|
: mRotateType(eRotateType_Auto),
|
||||||
|
mRotateAngle(0.0),
|
||||||
|
mSegmentType(eSegmentType_Translation),
|
||||||
|
mU{}
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Constructor for a translation
|
// Constructor for a translation
|
||||||
|
|
|
@ -32,7 +32,13 @@ struct nsSVGViewBoxRect
|
||||||
float width, height;
|
float width, height;
|
||||||
bool none;
|
bool none;
|
||||||
|
|
||||||
nsSVGViewBoxRect() : none(true) {}
|
nsSVGViewBoxRect()
|
||||||
|
: x(0.0)
|
||||||
|
, y(0.0)
|
||||||
|
, width(0.0)
|
||||||
|
, height(0.0)
|
||||||
|
, none(true)
|
||||||
|
{}
|
||||||
nsSVGViewBoxRect(float aX, float aY, float aWidth, float aHeight) :
|
nsSVGViewBoxRect(float aX, float aY, float aWidth, float aHeight) :
|
||||||
x(aX), y(aY), width(aWidth), height(aHeight), none(false) {}
|
x(aX), y(aY), width(aWidth), height(aHeight), none(false) {}
|
||||||
nsSVGViewBoxRect(const nsSVGViewBoxRect& rhs) :
|
nsSVGViewBoxRect(const nsSVGViewBoxRect& rhs) :
|
||||||
|
|
|
@ -282,8 +282,7 @@ class NodeBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!funv.isObject() || !funv.toObject().is<JSFunction>()) {
|
if (!funv.isObject() || !funv.toObject().is<JSFunction>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NOT_FUNCTION,
|
ReportValueError(cx, JSMSG_NOT_FUNCTION, JSDVG_SEARCH_STACK, funv, nullptr);
|
||||||
JSDVG_SEARCH_STACK, funv, nullptr, nullptr, nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3362,9 +3361,8 @@ reflect_parse(JSContext* cx, uint32_t argc, Value* vp)
|
||||||
|
|
||||||
if (!arg.isNullOrUndefined()) {
|
if (!arg.isNullOrUndefined()) {
|
||||||
if (!arg.isObject()) {
|
if (!arg.isObject()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, arg, nullptr,
|
||||||
JSDVG_SEARCH_STACK, arg, nullptr,
|
"not an object");
|
||||||
"not an object", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3414,9 +3412,8 @@ reflect_parse(JSContext* cx, uint32_t argc, Value* vp)
|
||||||
|
|
||||||
if (!prop.isNullOrUndefined()) {
|
if (!prop.isNullOrUndefined()) {
|
||||||
if (!prop.isObject()) {
|
if (!prop.isObject()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, prop, nullptr,
|
||||||
JSDVG_SEARCH_STACK, prop, nullptr,
|
"not an object");
|
||||||
"not an object", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
builder = &prop.toObject();
|
builder = &prop.toObject();
|
||||||
|
@ -3429,8 +3426,8 @@ reflect_parse(JSContext* cx, uint32_t argc, Value* vp)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!prop.isString()) {
|
if (!prop.isString()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, prop, nullptr,
|
||||||
prop, nullptr, "not 'script' or 'module'", nullptr);
|
"not 'script' or 'module'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,17 +270,15 @@ PromiseRejectedWithPendingError(JSContext* cx) {
|
||||||
return PromiseObject::unforgeableReject(cx, exn);
|
return PromiseObject::unforgeableReject(cx, exn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
ReportArgTypeError(JSContext* cx, const char* funName, const char* expectedType,
|
ReportArgTypeError(JSContext* cx, const char* funName, const char* expectedType, HandleValue arg)
|
||||||
HandleValue arg)
|
|
||||||
{
|
{
|
||||||
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
|
UniqueChars bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, arg, nullptr);
|
||||||
if (!bytes)
|
if (!bytes)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
return JS_ReportErrorFlagsAndNumberLatin1(cx, JSREPORT_ERROR, GetErrorMessage,
|
JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_NOT_EXPECTED_TYPE, funName,
|
||||||
nullptr, JSMSG_NOT_EXPECTED_TYPE,
|
expectedType, bytes.get());
|
||||||
funName, expectedType, bytes.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static MOZ_MUST_USE bool
|
static MOZ_MUST_USE bool
|
||||||
|
@ -307,8 +305,8 @@ static MOZ_MUST_USE bool
|
||||||
RejectNonGenericMethod(JSContext* cx, const CallArgs& args,
|
RejectNonGenericMethod(JSContext* cx, const CallArgs& args,
|
||||||
const char* className, const char* methodName)
|
const char* className, const char* methodName)
|
||||||
{
|
{
|
||||||
ReportValueError3(cx, JSMSG_INCOMPATIBLE_PROTO, JSDVG_SEARCH_STACK, args.thisv(),
|
ReportValueError(cx, JSMSG_INCOMPATIBLE_PROTO, JSDVG_SEARCH_STACK, args.thisv(),
|
||||||
nullptr, className, methodName);
|
nullptr, className, methodName);
|
||||||
|
|
||||||
return ReturnPromiseRejectedWithPendingError(cx, args);
|
return ReturnPromiseRejectedWithPendingError(cx, args);
|
||||||
}
|
}
|
||||||
|
@ -803,8 +801,8 @@ ReadableStream_cancel(JSContext* cx, unsigned argc, Value* vp)
|
||||||
// Step 1: If ! IsReadableStream(this) is false, return a promise rejected
|
// Step 1: If ! IsReadableStream(this) is false, return a promise rejected
|
||||||
// with a TypeError exception.
|
// with a TypeError exception.
|
||||||
if (!Is<ReadableStream>(args.thisv())) {
|
if (!Is<ReadableStream>(args.thisv())) {
|
||||||
ReportValueError3(cx, JSMSG_INCOMPATIBLE_PROTO, JSDVG_SEARCH_STACK, args.thisv(),
|
ReportValueError(cx, JSMSG_INCOMPATIBLE_PROTO, JSDVG_SEARCH_STACK, args.thisv(),
|
||||||
nullptr, "cancel", "");
|
nullptr, "cancel", "");
|
||||||
return ReturnPromiseRejectedWithPendingError(cx, args);
|
return ReturnPromiseRejectedWithPendingError(cx, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,8 +150,8 @@ SymbolObject::keyFor(JSContext* cx, unsigned argc, Value* vp)
|
||||||
// step 1
|
// step 1
|
||||||
HandleValue arg = args.get(0);
|
HandleValue arg = args.get(0);
|
||||||
if (!arg.isSymbol()) {
|
if (!arg.isSymbol()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, arg, nullptr,
|
||||||
arg, nullptr, "not a symbol", nullptr);
|
"not a symbol");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1304,9 +1304,8 @@ SaveStack(JSContext* cx, unsigned argc, Value* vp)
|
||||||
if (!ToNumber(cx, args[0], &maxDouble))
|
if (!ToNumber(cx, args[0], &maxDouble))
|
||||||
return false;
|
return false;
|
||||||
if (mozilla::IsNaN(maxDouble) || maxDouble < 0 || maxDouble > UINT32_MAX) {
|
if (mozilla::IsNaN(maxDouble) || maxDouble < 0 || maxDouble > UINT32_MAX) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[0], nullptr,
|
"not a valid maximum frame count");
|
||||||
"not a valid maximum frame count", NULL);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uint32_t max = uint32_t(maxDouble);
|
uint32_t max = uint32_t(maxDouble);
|
||||||
|
@ -1317,9 +1316,8 @@ SaveStack(JSContext* cx, unsigned argc, Value* vp)
|
||||||
RootedObject compartmentObject(cx);
|
RootedObject compartmentObject(cx);
|
||||||
if (args.length() >= 2) {
|
if (args.length() >= 2) {
|
||||||
if (!args[1].isObject()) {
|
if (!args[1].isObject()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[0], nullptr,
|
"not an object");
|
||||||
"not an object", NULL);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
compartmentObject = UncheckedUnwrap(&args[1].toObject());
|
compartmentObject = UncheckedUnwrap(&args[1].toObject());
|
||||||
|
@ -3593,16 +3591,14 @@ FindPath(JSContext* cx, unsigned argc, Value* vp)
|
||||||
// test is all about object identity, and ToString doesn't preserve that.
|
// test is all about object identity, and ToString doesn't preserve that.
|
||||||
// Non-GCThing endpoints don't make much sense.
|
// Non-GCThing endpoints don't make much sense.
|
||||||
if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
|
if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[0], nullptr,
|
"not an object, string, or symbol");
|
||||||
"not an object, string, or symbol", NULL);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args[1].isObject() && !args[1].isString() && !args[1].isSymbol()) {
|
if (!args[1].isObject() && !args[1].isString() && !args[1].isSymbol()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[0], nullptr,
|
"not an object, string, or symbol");
|
||||||
"not an object, string, or symbol", NULL);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3698,25 +3694,22 @@ ShortestPaths(JSContext* cx, unsigned argc, Value* vp)
|
||||||
// test is all about object identity, and ToString doesn't preserve that.
|
// test is all about object identity, and ToString doesn't preserve that.
|
||||||
// Non-GCThing endpoints don't make much sense.
|
// Non-GCThing endpoints don't make much sense.
|
||||||
if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
|
if (!args[0].isObject() && !args[0].isString() && !args[0].isSymbol()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[0], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[0], nullptr,
|
"not an object, string, or symbol");
|
||||||
"not an object, string, or symbol", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args[1].isObject() || !args[1].toObject().is<ArrayObject>()) {
|
if (!args[1].isObject() || !args[1].toObject().is<ArrayObject>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[1], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[1], nullptr,
|
"not an array object");
|
||||||
"not an array object", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RootedArrayObject objs(cx, &args[1].toObject().as<ArrayObject>());
|
RootedArrayObject objs(cx, &args[1].toObject().as<ArrayObject>());
|
||||||
size_t length = objs->getDenseInitializedLength();
|
size_t length = objs->getDenseInitializedLength();
|
||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[1], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[1], nullptr,
|
"not a dense array object with one or more elements");
|
||||||
"not a dense array object with one or more elements", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3732,9 +3725,8 @@ ShortestPaths(JSContext* cx, unsigned argc, Value* vp)
|
||||||
if (!JS::ToInt32(cx, args[2], &maxNumPaths))
|
if (!JS::ToInt32(cx, args[2], &maxNumPaths))
|
||||||
return false;
|
return false;
|
||||||
if (maxNumPaths <= 0) {
|
if (maxNumPaths <= 0) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, args[2], nullptr,
|
||||||
JSDVG_SEARCH_STACK, args[2], nullptr,
|
"not greater than 0");
|
||||||
"not greater than 0", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,10 +97,8 @@ GetDeflatedUTF8StringLength(JSContext* maybecx, const CharT* chars,
|
||||||
js::gc::AutoSuppressGC suppress(maybecx);
|
js::gc::AutoSuppressGC suppress(maybecx);
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
SprintfLiteral(buffer, "0x%x", c);
|
SprintfLiteral(buffer, "0x%x", c);
|
||||||
JS_ReportErrorFlagsAndNumberASCII(maybecx, JSREPORT_ERROR,
|
JS_ReportErrorNumberASCII(maybecx, GetErrorMessage, nullptr, JSMSG_BAD_SURROGATE_CHAR,
|
||||||
GetErrorMessage,
|
buffer);
|
||||||
nullptr, JSMSG_BAD_SURROGATE_CHAR,
|
|
||||||
buffer);
|
|
||||||
}
|
}
|
||||||
return (size_t) -1;
|
return (size_t) -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7093,7 +7093,7 @@ JSErrorNotes::copy(JSContext* cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto&& note : *this) {
|
for (auto&& note : *this) {
|
||||||
js::UniquePtr<JSErrorNotes::Note> copied(CopyErrorNote(cx, note.get()));
|
UniquePtr<JSErrorNotes::Note> copied = CopyErrorNote(cx, note.get());
|
||||||
if (!copied)
|
if (!copied)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -495,13 +495,6 @@ static const unsigned JSFUN_CONSTRUCTOR = 0x400;
|
||||||
/* | of all the JSFUN_* flags */
|
/* | of all the JSFUN_* flags */
|
||||||
static const unsigned JSFUN_FLAGS_MASK = 0x400;
|
static const unsigned JSFUN_FLAGS_MASK = 0x400;
|
||||||
|
|
||||||
/*
|
|
||||||
* If set, will allow redefining a non-configurable property, but only on a
|
|
||||||
* non-DOM global. This is a temporary hack that will need to go away in bug
|
|
||||||
* 1105518.
|
|
||||||
*/
|
|
||||||
static const unsigned JSPROP_REDEFINE_NONCONFIGURABLE = 0x1000;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resolve hooks and enumerate hooks must pass this flag when calling
|
* Resolve hooks and enumerate hooks must pass this flag when calling
|
||||||
* JS_Define* APIs to reify lazily-defined properties.
|
* JS_Define* APIs to reify lazily-defined properties.
|
||||||
|
@ -2112,7 +2105,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
JSPROP_IGNORE_VALUE |
|
JSPROP_IGNORE_VALUE |
|
||||||
JSPROP_GETTER |
|
JSPROP_GETTER |
|
||||||
JSPROP_SETTER |
|
JSPROP_SETTER |
|
||||||
JSPROP_REDEFINE_NONCONFIGURABLE |
|
|
||||||
JSPROP_RESOLVING |
|
JSPROP_RESOLVING |
|
||||||
SHADOWABLE)) == 0);
|
SHADOWABLE)) == 0);
|
||||||
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_ENUMERATE | JSPROP_ENUMERATE));
|
MOZ_ASSERT(!hasAll(JSPROP_IGNORE_ENUMERATE | JSPROP_ENUMERATE));
|
||||||
|
@ -2134,7 +2126,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_PERMANENT));
|
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_PERMANENT));
|
||||||
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_READONLY));
|
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_READONLY));
|
||||||
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_VALUE));
|
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_IGNORE_VALUE));
|
||||||
MOZ_ASSERT_IF(has(JSPROP_RESOLVING), !has(JSPROP_REDEFINE_NONCONFIGURABLE));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2146,7 +2137,6 @@ class WrappedPtrOperations<JS::PropertyDescriptor, Wrapper>
|
||||||
JSPROP_READONLY |
|
JSPROP_READONLY |
|
||||||
JSPROP_GETTER |
|
JSPROP_GETTER |
|
||||||
JSPROP_SETTER |
|
JSPROP_SETTER |
|
||||||
JSPROP_REDEFINE_NONCONFIGURABLE |
|
|
||||||
JSPROP_RESOLVING |
|
JSPROP_RESOLVING |
|
||||||
SHADOWABLE)) == 0);
|
SHADOWABLE)) == 0);
|
||||||
MOZ_ASSERT_IF(isAccessorDescriptor(), has(JSPROP_GETTER) && has(JSPROP_SETTER));
|
MOZ_ASSERT_IF(isAccessorDescriptor(), has(JSPROP_GETTER) && has(JSPROP_SETTER));
|
||||||
|
|
|
@ -2654,8 +2654,7 @@ date_toJSON(JSContext* cx, unsigned argc, Value* vp)
|
||||||
|
|
||||||
/* Step 5. */
|
/* Step 5. */
|
||||||
if (!IsCallable(toISO)) {
|
if (!IsCallable(toISO)) {
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, js::GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, js::GetErrorMessage, nullptr, JSMSG_BAD_TOISOSTRING_PROP);
|
||||||
JSMSG_BAD_TOISOSTRING_PROP);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "mozilla/Sprintf.h"
|
#include "mozilla/Sprintf.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "jsnum.h"
|
#include "jsnum.h"
|
||||||
|
@ -23,6 +24,7 @@
|
||||||
#include "gc/FreeOp.h"
|
#include "gc/FreeOp.h"
|
||||||
#include "gc/Marking.h"
|
#include "gc/Marking.h"
|
||||||
#include "js/CharacterEncoding.h"
|
#include "js/CharacterEncoding.h"
|
||||||
|
#include "js/UniquePtr.h"
|
||||||
#include "js/Wrapper.h"
|
#include "js/Wrapper.h"
|
||||||
#include "util/StringBuffer.h"
|
#include "util/StringBuffer.h"
|
||||||
#include "vm/ErrorObject.h"
|
#include "vm/ErrorObject.h"
|
||||||
|
@ -267,7 +269,7 @@ CopyExtraData(JSContext* cx, uint8_t** cursor, JSErrorNotes::Note* copy, JSError
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static T*
|
static UniquePtr<T>
|
||||||
CopyErrorHelper(JSContext* cx, T* report)
|
CopyErrorHelper(JSContext* cx, T* report)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -298,7 +300,7 @@ CopyErrorHelper(JSContext* cx, T* report)
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
T* copy = new (cursor) T();
|
UniquePtr<T> copy(new (cursor) T());
|
||||||
cursor += sizeof(T);
|
cursor += sizeof(T);
|
||||||
|
|
||||||
if (report->message()) {
|
if (report->message()) {
|
||||||
|
@ -313,13 +315,10 @@ CopyErrorHelper(JSContext* cx, T* report)
|
||||||
cursor += filenameSize;
|
cursor += filenameSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CopyExtraData(cx, &cursor, copy, report)) {
|
if (!CopyExtraData(cx, &cursor, copy.get(), report))
|
||||||
/* js_delete calls destructor for T and js_free for pod_calloc. */
|
|
||||||
js_delete(copy);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
MOZ_ASSERT(cursor == (uint8_t*)copy + mallocSize);
|
MOZ_ASSERT(cursor == (uint8_t*)copy.get() + mallocSize);
|
||||||
|
|
||||||
/* Copy non-pointer members. */
|
/* Copy non-pointer members. */
|
||||||
copy->lineno = report->lineno;
|
copy->lineno = report->lineno;
|
||||||
|
@ -329,13 +328,13 @@ CopyErrorHelper(JSContext* cx, T* report)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSErrorNotes::Note*
|
UniquePtr<JSErrorNotes::Note>
|
||||||
js::CopyErrorNote(JSContext* cx, JSErrorNotes::Note* note)
|
js::CopyErrorNote(JSContext* cx, JSErrorNotes::Note* note)
|
||||||
{
|
{
|
||||||
return CopyErrorHelper(cx, note);
|
return CopyErrorHelper(cx, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSErrorReport*
|
UniquePtr<JSErrorReport>
|
||||||
js::CopyErrorReport(JSContext* cx, JSErrorReport* report)
|
js::CopyErrorReport(JSContext* cx, JSErrorReport* report)
|
||||||
{
|
{
|
||||||
return CopyErrorHelper(cx, report);
|
return CopyErrorHelper(cx, report);
|
||||||
|
@ -686,12 +685,12 @@ js::ErrorToException(JSContext* cx, JSErrorReport* reportp,
|
||||||
if (!CaptureStack(cx, &stack))
|
if (!CaptureStack(cx, &stack))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
js::ScopedJSFreePtr<JSErrorReport> report(CopyErrorReport(cx, reportp));
|
UniquePtr<JSErrorReport> report = CopyErrorReport(cx, reportp);
|
||||||
if (!report)
|
if (!report)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RootedObject errObject(cx, ErrorObject::create(cx, exnType, stack, fileName,
|
RootedObject errObject(cx, ErrorObject::create(cx, exnType, stack, fileName, lineNumber,
|
||||||
lineNumber, columnNumber, &report, messageStr));
|
columnNumber, std::move(report), messageStr));
|
||||||
if (!errObject)
|
if (!errObject)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -990,7 +989,7 @@ ErrorReport::populateUncaughtExceptionReportUTF8VA(JSContext* cx, va_list ap)
|
||||||
JSObject*
|
JSObject*
|
||||||
js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err)
|
js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err)
|
||||||
{
|
{
|
||||||
js::ScopedJSFreePtr<JSErrorReport> copyReport;
|
UniquePtr<JSErrorReport> copyReport;
|
||||||
if (JSErrorReport* errorReport = err->getErrorReport()) {
|
if (JSErrorReport* errorReport = err->getErrorReport()) {
|
||||||
copyReport = CopyErrorReport(cx, errorReport);
|
copyReport = CopyErrorReport(cx, errorReport);
|
||||||
if (!copyReport)
|
if (!copyReport)
|
||||||
|
@ -1012,7 +1011,7 @@ js::CopyErrorObject(JSContext* cx, Handle<ErrorObject*> err)
|
||||||
|
|
||||||
// Create the Error object.
|
// Create the Error object.
|
||||||
return ErrorObject::create(cx, errorType, stack, fileName,
|
return ErrorObject::create(cx, errorType, stack, fileName,
|
||||||
lineNumber, columnNumber, ©Report, message);
|
lineNumber, columnNumber, std::move(copyReport), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
|
@ -1023,13 +1022,15 @@ JS::CreateError(JSContext* cx, JSExnType type, HandleObject stack, HandleString
|
||||||
assertSameCompartment(cx, stack, fileName, message);
|
assertSameCompartment(cx, stack, fileName, message);
|
||||||
AssertObjectIsSavedFrameOrWrapper(cx, stack);
|
AssertObjectIsSavedFrameOrWrapper(cx, stack);
|
||||||
|
|
||||||
js::ScopedJSFreePtr<JSErrorReport> rep;
|
js::UniquePtr<JSErrorReport> rep;
|
||||||
if (report)
|
if (report) {
|
||||||
rep = CopyErrorReport(cx, report);
|
rep = CopyErrorReport(cx, report);
|
||||||
|
if (!rep)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
RootedObject obj(cx,
|
JSObject* obj = js::ErrorObject::create(cx, type, stack, fileName, lineNumber, columnNumber,
|
||||||
js::ErrorObject::create(cx, type, stack, fileName,
|
std::move(rep), message);
|
||||||
lineNumber, columnNumber, &rep, message));
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,16 @@
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "NamespaceImports.h"
|
#include "NamespaceImports.h"
|
||||||
|
|
||||||
|
#include "js/UniquePtr.h"
|
||||||
#include "vm/JSContext.h"
|
#include "vm/JSContext.h"
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
class ErrorObject;
|
class ErrorObject;
|
||||||
|
|
||||||
JSErrorNotes::Note*
|
UniquePtr<JSErrorNotes::Note>
|
||||||
CopyErrorNote(JSContext* cx, JSErrorNotes::Note* note);
|
CopyErrorNote(JSContext* cx, JSErrorNotes::Note* note);
|
||||||
|
|
||||||
JSErrorReport*
|
UniquePtr<JSErrorReport>
|
||||||
CopyErrorReport(JSContext* cx, JSErrorReport* report);
|
CopyErrorReport(JSContext* cx, JSErrorReport* report);
|
||||||
|
|
||||||
JSString*
|
JSString*
|
||||||
|
|
|
@ -230,8 +230,7 @@ ReportInvalidCharacter(JSContext* cx, uint32_t offset)
|
||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
SprintfLiteral(buffer, "%u", offset);
|
SprintfLiteral(buffer, "%u", offset);
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MALFORMED_UTF8_CHAR, buffer);
|
||||||
JSMSG_MALFORMED_UTF8_CHAR, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -245,8 +244,7 @@ ReportTooBigCharacter(JSContext* cx, uint32_t v)
|
||||||
{
|
{
|
||||||
char buffer[10];
|
char buffer[10];
|
||||||
SprintfLiteral(buffer, "0x%x", v + 0x10000);
|
SprintfLiteral(buffer, "0x%x", v + 0x10000);
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_UTF8_CHAR_TOO_LARGE, buffer);
|
||||||
JSMSG_UTF8_CHAR_TOO_LARGE, buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum InflateUTF8Action {
|
enum InflateUTF8Action {
|
||||||
|
|
|
@ -274,9 +274,8 @@ ValueToIdentifier(JSContext* cx, HandleValue v, MutableHandleId id)
|
||||||
return false;
|
return false;
|
||||||
if (!JSID_IS_ATOM(id) || !IsIdentifier(JSID_TO_ATOM(id))) {
|
if (!JSID_IS_ATOM(id) || !IsIdentifier(JSID_TO_ATOM(id))) {
|
||||||
RootedValue val(cx, v);
|
RootedValue val(cx, v);
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_UNEXPECTED_TYPE,
|
ReportValueError(cx, JSMSG_UNEXPECTED_TYPE, JSDVG_SEARCH_STACK, val, nullptr,
|
||||||
JSDVG_SEARCH_STACK, val, nullptr, "not an identifier",
|
"not an identifier");
|
||||||
nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -522,13 +521,11 @@ RequireGlobalObject(JSContext* cx, HandleValue dbgobj, HandleObject referent)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->is<GlobalObject>()) {
|
if (obj->is<GlobalObject>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_WRAPPER_IN_WAY,
|
ReportValueError(cx, JSMSG_DEBUG_WRAPPER_IN_WAY, JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
||||||
JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
isWrapper, isWindowProxy);
|
||||||
isWrapper, isWindowProxy);
|
|
||||||
} else {
|
} else {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
||||||
JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
"a global object");
|
||||||
"a global object", nullptr);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5361,9 +5358,8 @@ DebuggerScript_checkThis(JSContext* cx, const CallArgs& args, const char* fnname
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!GetScriptReferent(thisobj).is<ReferentT>()) {
|
if (!GetScriptReferent(thisobj).is<ReferentT>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
||||||
JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
refname);
|
||||||
refname, nullptr);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7007,9 +7003,8 @@ DebuggerSource_checkThis(JSContext* cx, const CallArgs& args, const char* fnname
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!GetSourceReferent(thisobj).is<ReferentT>()) {
|
if (!GetSourceReferent(thisobj).is<ReferentT>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
||||||
JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
refname);
|
||||||
refname, nullptr);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7092,9 +7087,8 @@ DebuggerSource_getBinary(JSContext* cx, unsigned argc, Value* vp)
|
||||||
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get binary)", args, obj, referent);
|
THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get binary)", args, obj, referent);
|
||||||
|
|
||||||
if (!referent.is<WasmInstanceObject*>()) {
|
if (!referent.is<WasmInstanceObject*>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
||||||
JSDVG_SEARCH_STACK, args.thisv(), nullptr,
|
"a wasm source");
|
||||||
"a wasm source", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8097,9 +8091,8 @@ DebuggerFrame::requireScriptReferent(JSContext* cx, HandleDebuggerFrame frame)
|
||||||
AbstractFramePtr referent = DebuggerFrame::getReferent(frame);
|
AbstractFramePtr referent = DebuggerFrame::getReferent(frame);
|
||||||
if (!referent.hasScript()) {
|
if (!referent.hasScript()) {
|
||||||
RootedValue frameobj(cx, ObjectValue(*frame));
|
RootedValue frameobj(cx, ObjectValue(*frame));
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, frameobj, nullptr,
|
||||||
JSDVG_SEARCH_STACK, frameobj, nullptr,
|
"a script frame");
|
||||||
"a script frame", nullptr);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -10707,13 +10700,11 @@ DebuggerObject::requireGlobal(JSContext* cx, HandleDebuggerObject object)
|
||||||
|
|
||||||
RootedValue dbgobj(cx, ObjectValue(*object));
|
RootedValue dbgobj(cx, ObjectValue(*object));
|
||||||
if (referent->is<GlobalObject>()) {
|
if (referent->is<GlobalObject>()) {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_WRAPPER_IN_WAY,
|
ReportValueError(cx, JSMSG_DEBUG_WRAPPER_IN_WAY, JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
||||||
JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
isWrapper, isWindowProxy);
|
||||||
isWrapper, isWindowProxy);
|
|
||||||
} else {
|
} else {
|
||||||
ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_DEBUG_BAD_REFERENT,
|
ReportValueError(cx, JSMSG_DEBUG_BAD_REFERENT, JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
||||||
JSDVG_SEARCH_STACK, dbgobj, nullptr,
|
"a global object");
|
||||||
"a global object", nullptr);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "mozilla/Range.h"
|
#include "mozilla/Range.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "jsexn.h"
|
#include "jsexn.h"
|
||||||
|
|
||||||
#include "js/CallArgs.h"
|
#include "js/CallArgs.h"
|
||||||
|
@ -38,7 +40,7 @@ js::ErrorObject::assignInitialShape(JSContext* cx, Handle<ErrorObject*> obj)
|
||||||
|
|
||||||
/* static */ bool
|
/* static */ bool
|
||||||
js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
||||||
ScopedJSFreePtr<JSErrorReport>* errorReport, HandleString fileName,
|
UniquePtr<JSErrorReport> errorReport, HandleString fileName,
|
||||||
HandleObject stack, uint32_t lineNumber, uint32_t columnNumber,
|
HandleObject stack, uint32_t lineNumber, uint32_t columnNumber,
|
||||||
HandleString message)
|
HandleString message)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +74,7 @@ js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
||||||
|
|
||||||
MOZ_ASSERT(JSEXN_ERR <= type && type < JSEXN_LIMIT);
|
MOZ_ASSERT(JSEXN_ERR <= type && type < JSEXN_LIMIT);
|
||||||
|
|
||||||
JSErrorReport* report = errorReport ? errorReport->forget() : nullptr;
|
JSErrorReport* report = errorReport.release();
|
||||||
obj->initReservedSlot(EXNTYPE_SLOT, Int32Value(type));
|
obj->initReservedSlot(EXNTYPE_SLOT, Int32Value(type));
|
||||||
obj->initReservedSlot(STACK_SLOT, ObjectOrNullValue(stack));
|
obj->initReservedSlot(STACK_SLOT, ObjectOrNullValue(stack));
|
||||||
obj->setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(report));
|
obj->setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(report));
|
||||||
|
@ -88,7 +90,7 @@ js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
||||||
/* static */ ErrorObject*
|
/* static */ ErrorObject*
|
||||||
js::ErrorObject::create(JSContext* cx, JSExnType errorType, HandleObject stack,
|
js::ErrorObject::create(JSContext* cx, JSExnType errorType, HandleObject stack,
|
||||||
HandleString fileName, uint32_t lineNumber, uint32_t columnNumber,
|
HandleString fileName, uint32_t lineNumber, uint32_t columnNumber,
|
||||||
ScopedJSFreePtr<JSErrorReport>* report, HandleString message,
|
UniquePtr<JSErrorReport> report, HandleString message,
|
||||||
HandleObject protoArg /* = nullptr */)
|
HandleObject protoArg /* = nullptr */)
|
||||||
{
|
{
|
||||||
AssertObjectIsSavedFrameOrWrapper(cx, stack);
|
AssertObjectIsSavedFrameOrWrapper(cx, stack);
|
||||||
|
@ -109,7 +111,7 @@ js::ErrorObject::create(JSContext* cx, JSExnType errorType, HandleObject stack,
|
||||||
errObject = &obj->as<ErrorObject>();
|
errObject = &obj->as<ErrorObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ErrorObject::init(cx, errObject, errorType, report, fileName, stack,
|
if (!ErrorObject::init(cx, errObject, errorType, std::move(report), fileName, stack,
|
||||||
lineNumber, columnNumber, message))
|
lineNumber, columnNumber, message))
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -156,11 +158,11 @@ js::ErrorObject::getOrCreateErrorReport(JSContext* cx)
|
||||||
report.initOwnedMessage(utf8.release());
|
report.initOwnedMessage(utf8.release());
|
||||||
|
|
||||||
// Cache and return.
|
// Cache and return.
|
||||||
JSErrorReport* copy = CopyErrorReport(cx, &report);
|
UniquePtr<JSErrorReport> copy = CopyErrorReport(cx, &report);
|
||||||
if (!copy)
|
if (!copy)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(copy));
|
setReservedSlot(ERROR_REPORT_SLOT, PrivateValue(copy.get()));
|
||||||
return copy;
|
return copy.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "mozilla/ArrayUtils.h"
|
#include "mozilla/ArrayUtils.h"
|
||||||
|
|
||||||
|
#include "js/UniquePtr.h"
|
||||||
#include "vm/NativeObject.h"
|
#include "vm/NativeObject.h"
|
||||||
#include "vm/SavedStacks.h"
|
#include "vm/SavedStacks.h"
|
||||||
#include "vm/Shape.h"
|
#include "vm/Shape.h"
|
||||||
|
@ -35,7 +36,7 @@ class ErrorObject : public NativeObject
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
||||||
ScopedJSFreePtr<JSErrorReport>* errorReport, HandleString fileName, HandleObject stack,
|
UniquePtr<JSErrorReport> errorReport, HandleString fileName, HandleObject stack,
|
||||||
uint32_t lineNumber, uint32_t columnNumber, HandleString message);
|
uint32_t lineNumber, uint32_t columnNumber, HandleString message);
|
||||||
|
|
||||||
static const ClassSpec classSpecs[JSEXN_ERROR_LIMIT];
|
static const ClassSpec classSpecs[JSEXN_ERROR_LIMIT];
|
||||||
|
@ -70,7 +71,7 @@ class ErrorObject : public NativeObject
|
||||||
// property.
|
// property.
|
||||||
static ErrorObject*
|
static ErrorObject*
|
||||||
create(JSContext* cx, JSExnType type, HandleObject stack, HandleString fileName,
|
create(JSContext* cx, JSExnType type, HandleObject stack, HandleString fileName,
|
||||||
uint32_t lineNumber, uint32_t columnNumber, ScopedJSFreePtr<JSErrorReport>* report,
|
uint32_t lineNumber, uint32_t columnNumber, UniquePtr<JSErrorReport> report,
|
||||||
HandleString message, HandleObject proto = nullptr);
|
HandleString message, HandleObject proto = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -994,7 +994,7 @@ js::CheckClassHeritageOperation(JSContext* cx, HandleValue heritage)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReportValueError2(cx, JSMSG_BAD_HERITAGE, -1, heritage, nullptr, "not an object or null");
|
ReportValueError(cx, JSMSG_BAD_HERITAGE, -1, heritage, nullptr, "not an object or null");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -895,36 +895,26 @@ js::ReportIsNotDefined(JSContext* cx, HandlePropertyName name)
|
||||||
ReportIsNotDefined(cx, id);
|
ReportIsNotDefined(cx, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
void
|
||||||
js::ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v,
|
js::ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v)
|
||||||
HandleString fallback)
|
|
||||||
{
|
{
|
||||||
bool ok;
|
MOZ_ASSERT(v.isNullOrUndefined());
|
||||||
|
|
||||||
UniqueChars bytes = DecompileValueGenerator(cx, spindex, v, fallback);
|
UniqueChars bytes = DecompileValueGenerator(cx, spindex, v, nullptr);
|
||||||
if (!bytes)
|
if (!bytes)
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if (strcmp(bytes.get(), js_undefined_str) == 0 ||
|
if (strcmp(bytes.get(), js_undefined_str) == 0 || strcmp(bytes.get(), js_null_str) == 0) {
|
||||||
strcmp(bytes.get(), js_null_str) == 0) {
|
JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_NO_PROPERTIES,
|
||||||
ok = JS_ReportErrorFlagsAndNumberLatin1(cx, JSREPORT_ERROR,
|
bytes.get());
|
||||||
GetErrorMessage, nullptr,
|
|
||||||
JSMSG_NO_PROPERTIES,
|
|
||||||
bytes.get());
|
|
||||||
} else if (v.isUndefined()) {
|
} else if (v.isUndefined()) {
|
||||||
ok = JS_ReportErrorFlagsAndNumberLatin1(cx, JSREPORT_ERROR,
|
JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||||
GetErrorMessage, nullptr,
|
bytes.get(), js_undefined_str);
|
||||||
JSMSG_UNEXPECTED_TYPE,
|
|
||||||
bytes.get(), js_undefined_str);
|
|
||||||
} else {
|
} else {
|
||||||
MOZ_ASSERT(v.isNull());
|
MOZ_ASSERT(v.isNull());
|
||||||
ok = JS_ReportErrorFlagsAndNumberLatin1(cx, JSREPORT_ERROR,
|
JS_ReportErrorNumberLatin1(cx, GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
|
||||||
GetErrorMessage, nullptr,
|
bytes.get(), js_null_str);
|
||||||
JSMSG_UNEXPECTED_TYPE,
|
|
||||||
bytes.get(), js_null_str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -950,18 +940,14 @@ js::ReportValueErrorFlags(JSContext* cx, unsigned flags, const unsigned errorNum
|
||||||
int spindex, HandleValue v, HandleString fallback,
|
int spindex, HandleValue v, HandleString fallback,
|
||||||
const char* arg1, const char* arg2)
|
const char* arg1, const char* arg2)
|
||||||
{
|
{
|
||||||
UniqueChars bytes;
|
|
||||||
bool ok;
|
|
||||||
|
|
||||||
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1);
|
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1);
|
||||||
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3);
|
MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3);
|
||||||
bytes = DecompileValueGenerator(cx, spindex, v, fallback);
|
UniqueChars bytes = DecompileValueGenerator(cx, spindex, v, fallback);
|
||||||
if (!bytes)
|
if (!bytes)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ok = JS_ReportErrorFlagsAndNumberLatin1(cx, flags, GetErrorMessage, nullptr, errorNumber,
|
return JS_ReportErrorFlagsAndNumberLatin1(cx, flags, GetErrorMessage, nullptr, errorNumber,
|
||||||
bytes.get(), arg1, arg2);
|
bytes.get(), arg1, arg2);
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
|
|
|
@ -1015,8 +1015,8 @@ ReportIsNotDefined(JSContext* cx, HandleId id);
|
||||||
/*
|
/*
|
||||||
* Report an attempt to access the property of a null or undefined value (v).
|
* Report an attempt to access the property of a null or undefined value (v).
|
||||||
*/
|
*/
|
||||||
extern bool
|
extern void
|
||||||
ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v, HandleString fallback);
|
ReportIsNullOrUndefined(JSContext* cx, int spindex, HandleValue v);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
ReportMissingArg(JSContext* cx, js::HandleValue v, unsigned arg);
|
ReportMissingArg(JSContext* cx, js::HandleValue v, unsigned arg);
|
||||||
|
@ -1031,17 +1031,12 @@ ReportValueErrorFlags(JSContext* cx, unsigned flags, const unsigned errorNumber,
|
||||||
int spindex, HandleValue v, HandleString fallback,
|
int spindex, HandleValue v, HandleString fallback,
|
||||||
const char* arg1, const char* arg2);
|
const char* arg1, const char* arg2);
|
||||||
|
|
||||||
#define ReportValueError(cx,errorNumber,spindex,v,fallback) \
|
inline void
|
||||||
((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
ReportValueError(JSContext* cx, const unsigned errorNumber, int spindex, HandleValue v,
|
||||||
spindex, v, fallback, nullptr, nullptr))
|
HandleString fallback, const char* arg1 = nullptr, const char* arg2 = nullptr)
|
||||||
|
{
|
||||||
#define ReportValueError2(cx,errorNumber,spindex,v,fallback,arg1) \
|
ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, spindex, v, fallback, arg1, arg2);
|
||||||
((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
}
|
||||||
spindex, v, fallback, arg1, nullptr))
|
|
||||||
|
|
||||||
#define ReportValueError3(cx,errorNumber,spindex,v,fallback,arg1,arg2) \
|
|
||||||
((void)ReportValueErrorFlags(cx, JSREPORT_ERROR, errorNumber, \
|
|
||||||
spindex, v, fallback, arg1, arg2))
|
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
CreateErrorNotesArray(JSContext* cx, JSErrorReport* report);
|
CreateErrorNotesArray(JSContext* cx, JSErrorReport* report);
|
||||||
|
|
|
@ -116,8 +116,7 @@ AdvanceToActiveCallLinear(JSContext* cx, NonBuiltinScriptFrameIter& iter, Handle
|
||||||
void
|
void
|
||||||
js::ThrowTypeErrorBehavior(JSContext* cx)
|
js::ThrowTypeErrorBehavior(JSContext* cx)
|
||||||
{
|
{
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_THROW_TYPE_ERROR);
|
||||||
JSMSG_THROW_TYPE_ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -311,8 +310,7 @@ CallerGetterImpl(JSContext* cx, const CallArgs& args)
|
||||||
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
|
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
|
||||||
|
|
||||||
if (callerFun->strict()) {
|
if (callerFun->strict()) {
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CALLER_IS_STRICT);
|
||||||
JSMSG_CALLER_IS_STRICT);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,8 +378,7 @@ CallerSetterImpl(JSContext* cx, const CallArgs& args)
|
||||||
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
|
MOZ_ASSERT(!callerFun->isBuiltin(), "non-builtin iterator returned a builtin?");
|
||||||
|
|
||||||
if (callerFun->strict()) {
|
if (callerFun->strict()) {
|
||||||
JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CALLER_IS_STRICT);
|
||||||
JSMSG_CALLER_IS_STRICT);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2624,33 +2624,6 @@ js::HasOwnDataPropertyPure(JSContext* cx, JSObject* obj, jsid id, bool* result)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool
|
|
||||||
JSObject::reportReadOnly(JSContext* cx, jsid id, unsigned report)
|
|
||||||
{
|
|
||||||
RootedValue val(cx, IdToValue(id));
|
|
||||||
return ReportValueErrorFlags(cx, report, JSMSG_READ_ONLY,
|
|
||||||
JSDVG_IGNORE_STACK, val, nullptr,
|
|
||||||
nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ bool
|
|
||||||
JSObject::reportNotConfigurable(JSContext* cx, jsid id, unsigned report)
|
|
||||||
{
|
|
||||||
RootedValue val(cx, IdToValue(id));
|
|
||||||
return ReportValueErrorFlags(cx, report, JSMSG_CANT_DELETE,
|
|
||||||
JSDVG_IGNORE_STACK, val, nullptr,
|
|
||||||
nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ bool
|
|
||||||
JSObject::reportNotExtensible(JSContext* cx, HandleObject obj, unsigned report)
|
|
||||||
{
|
|
||||||
RootedValue val(cx, ObjectValue(*obj));
|
|
||||||
return ReportValueErrorFlags(cx, report, JSMSG_OBJECT_NOT_EXTENSIBLE,
|
|
||||||
JSDVG_IGNORE_STACK, val, nullptr,
|
|
||||||
nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
js::GetPrototypeIfOrdinary(JSContext* cx, HandleObject obj, bool* isOrdinary,
|
js::GetPrototypeIfOrdinary(JSContext* cx, HandleObject obj, bool* isOrdinary,
|
||||||
MutableHandleObject protop)
|
MutableHandleObject protop)
|
||||||
|
@ -3086,10 +3059,10 @@ ReportCantConvert(JSContext* cx, unsigned errorNumber, HandleObject obj, JSType
|
||||||
}
|
}
|
||||||
|
|
||||||
RootedValue val(cx, ObjectValue(*obj));
|
RootedValue val(cx, ObjectValue(*obj));
|
||||||
ReportValueError2(cx, errorNumber, JSDVG_SEARCH_STACK, val, str,
|
ReportValueError(cx, errorNumber, JSDVG_SEARCH_STACK, val, str,
|
||||||
hint == JSTYPE_UNDEFINED
|
hint == JSTYPE_UNDEFINED
|
||||||
? "primitive type"
|
? "primitive type"
|
||||||
: hint == JSTYPE_STRING ? "string" : "number");
|
: hint == JSTYPE_STRING ? "string" : "number");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3273,7 +3246,7 @@ js::PrimitiveToObject(JSContext* cx, const Value& v)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invokes the ES5 ToObject algorithm on vp, returning the result. If vp might
|
* Invokes the ES5 ToObject algorithm on vp, returning the result. If vp might
|
||||||
* already be an object, use ToObject. reportCantConvert controls how null and
|
* already be an object, use ToObject. reportScanStack controls how null and
|
||||||
* undefined errors are reported.
|
* undefined errors are reported.
|
||||||
*
|
*
|
||||||
* Callers must handle the already-object case.
|
* Callers must handle the already-object case.
|
||||||
|
@ -3286,7 +3259,7 @@ js::ToObjectSlow(JSContext* cx, JS::HandleValue val, bool reportScanStack)
|
||||||
|
|
||||||
if (val.isNullOrUndefined()) {
|
if (val.isNullOrUndefined()) {
|
||||||
if (reportScanStack) {
|
if (reportScanStack) {
|
||||||
ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val, nullptr);
|
ReportIsNullOrUndefined(cx, JSDVG_SEARCH_STACK, val);
|
||||||
} else {
|
} else {
|
||||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
|
||||||
val.isNull() ? "null" : "undefined", "object");
|
val.isNull() ? "null" : "undefined", "object");
|
||||||
|
|
|
@ -480,11 +480,6 @@ class JSObject : public js::gc::Cell
|
||||||
MOZ_ALWAYS_INLINE void finalize(js::FreeOp* fop);
|
MOZ_ALWAYS_INLINE void finalize(js::FreeOp* fop);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool reportReadOnly(JSContext* cx, jsid id, unsigned report = JSREPORT_ERROR);
|
|
||||||
static bool reportNotConfigurable(JSContext* cx, jsid id, unsigned report = JSREPORT_ERROR);
|
|
||||||
static bool reportNotExtensible(JSContext* cx, js::HandleObject obj,
|
|
||||||
unsigned report = JSREPORT_ERROR);
|
|
||||||
|
|
||||||
static bool nonNativeSetProperty(JSContext* cx, js::HandleObject obj, js::HandleId id,
|
static bool nonNativeSetProperty(JSContext* cx, js::HandleObject obj, js::HandleId id,
|
||||||
js::HandleValue v, js::HandleValue receiver,
|
js::HandleValue v, js::HandleValue receiver,
|
||||||
JS::ObjectOpResult& result);
|
JS::ObjectOpResult& result);
|
||||||
|
|
|
@ -967,8 +967,9 @@ ThrowIfNotConstructing(JSContext *cx, const CallArgs &args, const char *builtinN
|
||||||
{
|
{
|
||||||
if (args.isConstructing())
|
if (args.isConstructing())
|
||||||
return true;
|
return true;
|
||||||
return JS_ReportErrorFlagsAndNumberASCII(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BUILTIN_CTOR_NO_NEW,
|
||||||
JSMSG_BUILTIN_CTOR_NO_NEW, builtinName);
|
builtinName);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
|
|
@ -1707,18 +1707,8 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
return result.succeed();
|
return result.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Non-standard hack: Allow redefining non-configurable properties if
|
|
||||||
// JSPROP_REDEFINE_NONCONFIGURABLE is set _and_ the object is a non-DOM
|
|
||||||
// global. The idea is that a DOM object can never have such a thing on
|
|
||||||
// its proto chain directly on the web, so we should be OK optimizing
|
|
||||||
// access to accessors found on such an object. Bug 1105518 contemplates
|
|
||||||
// removing this hack.
|
|
||||||
bool skipRedefineChecks = (desc.attributes() & JSPROP_REDEFINE_NONCONFIGURABLE) &&
|
|
||||||
obj->is<GlobalObject>() &&
|
|
||||||
!obj->getClass()->isDOMClass();
|
|
||||||
|
|
||||||
// Step 4.
|
// Step 4.
|
||||||
if (!IsConfigurable(shapeAttrs) && !skipRedefineChecks) {
|
if (!IsConfigurable(shapeAttrs)) {
|
||||||
if (desc.hasConfigurable() && desc.configurable())
|
if (desc.hasConfigurable() && desc.configurable())
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
if (desc.hasEnumerable() && desc.enumerable() != IsEnumerable(shapeAttrs))
|
if (desc.hasEnumerable() && desc.enumerable() != IsEnumerable(shapeAttrs))
|
||||||
|
@ -1753,7 +1743,7 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
}
|
}
|
||||||
} else if (desc.isDataDescriptor() != IsDataDescriptor(shapeAttrs)) {
|
} else if (desc.isDataDescriptor() != IsDataDescriptor(shapeAttrs)) {
|
||||||
// Step 6.
|
// Step 6.
|
||||||
if (!IsConfigurable(shapeAttrs) && !skipRedefineChecks)
|
if (!IsConfigurable(shapeAttrs))
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
|
|
||||||
// Fill in desc fields with default values (steps 6.b.i and 6.c.i).
|
// Fill in desc fields with default values (steps 6.b.i and 6.c.i).
|
||||||
|
@ -1763,7 +1753,7 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
bool frozen = !IsConfigurable(shapeAttrs) && !IsWritable(shapeAttrs);
|
bool frozen = !IsConfigurable(shapeAttrs) && !IsWritable(shapeAttrs);
|
||||||
|
|
||||||
// Step 7.a.i.1.
|
// Step 7.a.i.1.
|
||||||
if (frozen && desc.hasWritable() && desc.writable() && !skipRedefineChecks)
|
if (frozen && desc.hasWritable() && desc.writable())
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
|
|
||||||
if (frozen || !desc.hasValue()) {
|
if (frozen || !desc.hasValue()) {
|
||||||
|
@ -1780,13 +1770,13 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
MOZ_ASSERT(!cx->helperThread());
|
MOZ_ASSERT(!cx->helperThread());
|
||||||
if (!SameValue(cx, desc.value(), currentValue, &same))
|
if (!SameValue(cx, desc.value(), currentValue, &same))
|
||||||
return false;
|
return false;
|
||||||
if (!same && !skipRedefineChecks)
|
if (!same)
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7.a.i.3.
|
// Step 7.a.i.3.
|
||||||
if (frozen && !skipRedefineChecks)
|
if (frozen)
|
||||||
return result.succeed();
|
return result.succeed();
|
||||||
|
|
||||||
// Fill in desc.[[Writable]].
|
// Fill in desc.[[Writable]].
|
||||||
|
@ -1802,8 +1792,7 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
if (desc.hasSetterObject()) {
|
if (desc.hasSetterObject()) {
|
||||||
// Step 8.a.i.
|
// Step 8.a.i.
|
||||||
if (!IsConfigurable(shapeAttrs) &&
|
if (!IsConfigurable(shapeAttrs) &&
|
||||||
desc.setterObject() != prop.shape()->setterObject() &&
|
desc.setterObject() != prop.shape()->setterObject())
|
||||||
!skipRedefineChecks)
|
|
||||||
{
|
{
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
}
|
}
|
||||||
|
@ -1814,8 +1803,7 @@ js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
||||||
if (desc.hasGetterObject()) {
|
if (desc.hasGetterObject()) {
|
||||||
// Step 8.a.ii.
|
// Step 8.a.ii.
|
||||||
if (!IsConfigurable(shapeAttrs) &&
|
if (!IsConfigurable(shapeAttrs) &&
|
||||||
desc.getterObject() != prop.shape()->getterObject() &&
|
desc.getterObject() != prop.shape()->getterObject())
|
||||||
!skipRedefineChecks)
|
|
||||||
{
|
{
|
||||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1423,8 +1423,7 @@ js::ParseRegExpFlags(JSContext* cx, JSString* flagStr, RegExpFlag* flagsOut)
|
||||||
UniqueChars utf8(JS::CharsToNewUTF8CharsZ(nullptr, range).c_str());
|
UniqueChars utf8(JS::CharsToNewUTF8CharsZ(nullptr, range).c_str());
|
||||||
if (!utf8)
|
if (!utf8)
|
||||||
return false;
|
return false;
|
||||||
JS_ReportErrorFlagsAndNumberUTF8(cx, JSREPORT_ERROR, GetErrorMessage, nullptr,
|
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_BAD_REGEXP_FLAG, utf8.get());
|
||||||
JSMSG_BAD_REGEXP_FLAG, utf8.get());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2906,8 +2906,8 @@ VerifyGlobalNames(JSContext* cx, Handle<GlobalObject*> shg)
|
||||||
|
|
||||||
if (nameMissing) {
|
if (nameMissing) {
|
||||||
RootedValue value(cx, IdToValue(id));
|
RootedValue value(cx, IdToValue(id));
|
||||||
return ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NO_SUCH_SELF_HOSTED_PROP,
|
ReportValueError(cx, JSMSG_NO_SUCH_SELF_HOSTED_PROP, JSDVG_IGNORE_STACK, value, nullptr);
|
||||||
JSDVG_IGNORE_STACK, value, nullptr, nullptr, nullptr);
|
return false;
|
||||||
}
|
}
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,9 @@ struct DisplayItemClipChain {
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DisplayItemClipChain()
|
DisplayItemClipChain()
|
||||||
|
: mASR(nullptr)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
: mOnStack(true)
|
, mOnStack(true)
|
||||||
#endif
|
#endif
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ DottedCornerFinder::DottedCornerFinder(const Bezier& aOuterBezier,
|
||||||
mNormalSign((aCorner == C_TL || aCorner == C_BR) ? -1.0f : 1.0f),
|
mNormalSign((aCorner == C_TL || aCorner == C_BR) ? -1.0f : 1.0f),
|
||||||
mC0(aC0), mCn(aCn),
|
mC0(aC0), mCn(aCn),
|
||||||
mR0(aR0), mRn(aRn), mMaxR(std::max(aR0, aRn)),
|
mR0(aR0), mRn(aRn), mMaxR(std::max(aR0, aRn)),
|
||||||
mCenterCurveOrigin(mC0.x, mCn.y),
|
mCenterCurveOrigin(mC0.x, mCn.y), mCenterCurveR(0.0),
|
||||||
mInnerCurveOrigin(mInnerBezier.mPoints[0].x, mInnerBezier.mPoints[3].y),
|
mInnerCurveOrigin(mInnerBezier.mPoints[0].x, mInnerBezier.mPoints[3].y),
|
||||||
mBestOverlap(0.0f),
|
mBestOverlap(0.0f),
|
||||||
mHasZeroBorderWidth(false), mHasMore(true),
|
mHasZeroBorderWidth(false), mHasMore(true),
|
||||||
|
|
|
@ -533,6 +533,7 @@ public:
|
||||||
PaintedLayerData() :
|
PaintedLayerData() :
|
||||||
mAnimatedGeometryRoot(nullptr),
|
mAnimatedGeometryRoot(nullptr),
|
||||||
mASR(nullptr),
|
mASR(nullptr),
|
||||||
|
mClipChain(nullptr),
|
||||||
mReferenceFrame(nullptr),
|
mReferenceFrame(nullptr),
|
||||||
mLayer(nullptr),
|
mLayer(nullptr),
|
||||||
mSolidColor(NS_RGBA(0, 0, 0, 0)),
|
mSolidColor(NS_RGBA(0, 0, 0, 0)),
|
||||||
|
@ -1637,7 +1638,8 @@ public:
|
||||||
mAnimatedGeometryRootPosition(0, 0),
|
mAnimatedGeometryRootPosition(0, 0),
|
||||||
mLastItemCount(0),
|
mLastItemCount(0),
|
||||||
mContainerLayerFrame(nullptr),
|
mContainerLayerFrame(nullptr),
|
||||||
mHasExplicitLastPaintOffset(false) {}
|
mHasExplicitLastPaintOffset(false),
|
||||||
|
mDisabledAlpha(false) {}
|
||||||
|
|
||||||
NS_INLINE_DECL_REFCOUNTING(PaintedDisplayItemLayerUserData);
|
NS_INLINE_DECL_REFCOUNTING(PaintedDisplayItemLayerUserData);
|
||||||
|
|
||||||
|
@ -1725,6 +1727,7 @@ protected:
|
||||||
|
|
||||||
FrameLayerBuilder::FrameLayerBuilder()
|
FrameLayerBuilder::FrameLayerBuilder()
|
||||||
: mRetainingManager(nullptr)
|
: mRetainingManager(nullptr)
|
||||||
|
, mDisplayListBuilder(nullptr)
|
||||||
, mContainingPaintedLayer(nullptr)
|
, mContainingPaintedLayer(nullptr)
|
||||||
, mInactiveLayerClip(nullptr)
|
, mInactiveLayerClip(nullptr)
|
||||||
, mInvalidateAllLayers(false)
|
, mInvalidateAllLayers(false)
|
||||||
|
|
|
@ -77,7 +77,10 @@ static int gFrameTreeLockCount = 0;
|
||||||
struct InlineBackgroundData
|
struct InlineBackgroundData
|
||||||
{
|
{
|
||||||
InlineBackgroundData()
|
InlineBackgroundData()
|
||||||
: mFrame(nullptr), mLineContainer(nullptr)
|
: mFrame(nullptr), mLineContainer(nullptr),
|
||||||
|
mContinuationPoint(0), mUnbrokenMeasure(0),
|
||||||
|
mLineContinuationPoint(0), mPIStartBorderData{},
|
||||||
|
mBidiEnabled(false), mVertical(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,12 @@ public:
|
||||||
float aOpacity = 1.0);
|
float aOpacity = 1.0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCSSGradientRenderer() {}
|
nsCSSGradientRenderer()
|
||||||
|
: mPresContext(nullptr)
|
||||||
|
, mGradient(nullptr)
|
||||||
|
, mRadiusX(0.0)
|
||||||
|
, mRadiusY(0.0)
|
||||||
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to paint the tiles for a gradient by painting it once to an
|
* Attempts to paint the tiles for a gradient by painting it once to an
|
||||||
|
|
|
@ -323,6 +323,9 @@ struct ActiveScrolledRoot {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ActiveScrolledRoot()
|
ActiveScrolledRoot()
|
||||||
|
: mScrollableFrame(nullptr)
|
||||||
|
, mDepth(0)
|
||||||
|
, mRetained(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,11 @@ struct CSSSizeOrRatio
|
||||||
{
|
{
|
||||||
CSSSizeOrRatio()
|
CSSSizeOrRatio()
|
||||||
: mRatio(0, 0)
|
: mRatio(0, 0)
|
||||||
|
, mWidth(0)
|
||||||
|
, mHeight(0)
|
||||||
, mHasWidth(false)
|
, mHasWidth(false)
|
||||||
, mHasHeight(false) {}
|
, mHasHeight(false)
|
||||||
|
{}
|
||||||
|
|
||||||
bool CanComputeConcreteSize() const
|
bool CanComputeConcreteSize() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,7 +190,10 @@ public:
|
||||||
float GetStrokeOpacity() const override { return mStrokeOpacity; }
|
float GetStrokeOpacity() const override { return mStrokeOpacity; }
|
||||||
|
|
||||||
struct Paint {
|
struct Paint {
|
||||||
Paint() : mPaintType(eStyleSVGPaintType_None) {}
|
Paint()
|
||||||
|
: mPaintDefinition{}
|
||||||
|
, mPaintType(eStyleSVGPaintType_None)
|
||||||
|
{}
|
||||||
|
|
||||||
void SetPaintServer(nsIFrame* aFrame,
|
void SetPaintServer(nsIFrame* aFrame,
|
||||||
const gfxMatrix& aContextMatrix,
|
const gfxMatrix& aContextMatrix,
|
||||||
|
|
|
@ -2439,10 +2439,12 @@ CharIterator::CharIterator(SVGTextFrame* aSVGTextFrame,
|
||||||
mFrameForTrimCheck(nullptr),
|
mFrameForTrimCheck(nullptr),
|
||||||
mTrimmedOffset(0),
|
mTrimmedOffset(0),
|
||||||
mTrimmedLength(0),
|
mTrimmedLength(0),
|
||||||
|
mTextRun(nullptr),
|
||||||
mTextElementCharIndex(0),
|
mTextElementCharIndex(0),
|
||||||
mGlyphStartTextElementCharIndex(0),
|
mGlyphStartTextElementCharIndex(0),
|
||||||
mLengthAdjustScaleFactor(aSVGTextFrame->mLengthAdjustScaleFactor)
|
mGlyphUndisplayedCharacters(0),
|
||||||
, mPostReflow(aPostReflow)
|
mLengthAdjustScaleFactor(aSVGTextFrame->mLengthAdjustScaleFactor),
|
||||||
|
mPostReflow(aPostReflow)
|
||||||
{
|
{
|
||||||
if (!AtEnd()) {
|
if (!AtEnd()) {
|
||||||
mSkipCharsIterator = TextFrame()->EnsureTextRun(nsTextFrame::eInflated);
|
mSkipCharsIterator = TextFrame()->EnsureTextRun(nsTextFrame::eInflated);
|
||||||
|
@ -2772,7 +2774,8 @@ public:
|
||||||
mContext(aContext),
|
mContext(aContext),
|
||||||
mFrame(aFrame),
|
mFrame(aFrame),
|
||||||
mCanvasTM(aCanvasTM),
|
mCanvasTM(aCanvasTM),
|
||||||
mImgParams(aImgParams)
|
mImgParams(aImgParams),
|
||||||
|
mColor(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче