mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Merge inbound to mozilla-central a=merge
This commit is contained in:
commit
71988c7b7e
@ -12,16 +12,11 @@ XPCOMUtils.defineLazyServiceGetter(Services, "cookiemgr",
|
||||
"nsICookieManager");
|
||||
|
||||
function restore_prefs() {
|
||||
Services.prefs.clearUserPref("browser.contentblocking.enabled");
|
||||
Services.prefs.clearUserPref("browser.contentblocking.ui.enabled");
|
||||
Services.prefs.clearUserPref("network.cookie.cookieBehavior");
|
||||
Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
|
||||
}
|
||||
registerCleanupFunction(restore_prefs);
|
||||
|
||||
Services.prefs.setBoolPref("browser.contentblocking.enabled", true);
|
||||
Services.prefs.setBoolPref("browser.contentblocking.ui.enabled", true);
|
||||
|
||||
async function fake_profile_change() {
|
||||
await new Promise(resolve => {
|
||||
Services.obs.addObserver(function waitForDBClose() {
|
||||
|
16
build/build-clang/aarch64-vastart-checking.patch
Normal file
16
build/build-clang/aarch64-vastart-checking.patch
Normal file
@ -0,0 +1,16 @@
|
||||
AArch64 Windows uses a five-argument __va_start, just like ARM.
|
||||
|
||||
https://bugs.llvm.org/show_bug.cgi?id=39090
|
||||
|
||||
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
|
||||
index 22483f8..53d9cb2 100644
|
||||
--- a/clang/lib/Sema/SemaChecking.cpp
|
||||
+++ b/clang/lib/Sema/SemaChecking.cpp
|
||||
@@ -917,6 +917,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
|
||||
switch (Context.getTargetInfo().getTriple().getArch()) {
|
||||
case llvm::Triple::arm:
|
||||
case llvm::Triple::thumb:
|
||||
+ case llvm::Triple::aarch64:
|
||||
if (SemaBuiltinVAStartARMMicrosoft(TheCall))
|
||||
return ExprError();
|
||||
break;
|
@ -16,6 +16,7 @@
|
||||
"r318309.patch",
|
||||
"r320462.patch",
|
||||
"msvc-host-x64.patch",
|
||||
"aarch64-vastart-checking.patch",
|
||||
"loosen-msvc-detection.patch"
|
||||
]
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
"r320462.patch",
|
||||
"r327876.patch",
|
||||
"loosen-msvc-detection.patch",
|
||||
"aarch64-vastart-checking.patch",
|
||||
"fflush-before-unlocking.patch"
|
||||
]
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
"r342649-hotpatch-8-byte-nops.patch",
|
||||
"r342652-unpoison-thread-stacks.patch",
|
||||
"r343123-pin-asan-dll.patch",
|
||||
"aarch64-vastart-checking.patch",
|
||||
"loosen-msvc-detection.patch"
|
||||
]
|
||||
}
|
||||
|
@ -7267,7 +7267,20 @@ class CGCallGenerator(CGThing):
|
||||
if not static:
|
||||
call = CGWrapper(call, pre="%s->" % object)
|
||||
call = CGList([call, CGWrapper(args, pre="(", post=")")])
|
||||
if resultConversion is not None:
|
||||
if ((returnType is None or returnType.isVoid() or
|
||||
resultOutParam is not None) and
|
||||
# This check for TreeBoxObject is here due to bug 1434641. Once
|
||||
# nsITreeBoxObject is gone, it can go away.
|
||||
descriptor.name != "TreeBoxObject"):
|
||||
assert resultConversion is None
|
||||
call = CGList([
|
||||
CGWrapper(
|
||||
call,
|
||||
pre=("// NOTE: This assert does NOT call the function.\n"
|
||||
"static_assert(mozilla::IsVoid<decltype("),
|
||||
post=')>::value, "Should be returning void here");'),
|
||||
call], "\n")
|
||||
elif resultConversion is not None:
|
||||
call = CGList([resultConversion, CGWrapper(call, pre="(", post=")")])
|
||||
if resultVar is None and result is not None:
|
||||
needResultDecl = True
|
||||
@ -14046,6 +14059,7 @@ class CGBindingRoot(CGThing):
|
||||
callbacks)
|
||||
bindingHeaders["mozilla/dom/BindingUtils.h"] = hasCode
|
||||
bindingHeaders["mozilla/OwningNonNull.h"] = hasCode
|
||||
bindingHeaders["mozilla/TypeTraits.h"] = hasCode
|
||||
bindingHeaders["mozilla/dom/BindingDeclarations.h"] = (
|
||||
not hasCode and enums)
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "SVGObserverUtils.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
@ -356,22 +357,14 @@ SVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect*
|
||||
if (aType == imgINotificationObserver::LOAD_COMPLETE ||
|
||||
aType == imgINotificationObserver::FRAME_UPDATE ||
|
||||
aType == imgINotificationObserver::SIZE_AVAILABLE) {
|
||||
Invalidate();
|
||||
if (GetParent() && GetParent()->IsSVGElement(nsGkAtoms::filter)) {
|
||||
SVGObserverUtils::InvalidateDirectRenderingObservers(
|
||||
static_cast<SVGFilterElement*>(GetParent()));
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// helper methods
|
||||
|
||||
void
|
||||
SVGFEImageElement::Invalidate()
|
||||
{
|
||||
if (GetParent() && GetParent()->IsSVGElement(nsGkAtoms::filter)) {
|
||||
static_cast<SVGFilterElement*>(GetParent())->Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -76,9 +76,6 @@ public:
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
|
||||
private:
|
||||
// Invalidate users of the filter containing this element.
|
||||
void Invalidate();
|
||||
|
||||
nsresult LoadSVGImage(bool aForce, bool aNotify);
|
||||
|
||||
protected:
|
||||
|
@ -137,23 +137,6 @@ SVGFilterElement::IsAttributeMapped(const nsAtom* name) const
|
||||
SVGFilterElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
void
|
||||
SVGFilterElement::Invalidate()
|
||||
{
|
||||
nsAutoTObserverArray<nsIMutationObserver*, 1> *observers = GetMutationObservers();
|
||||
|
||||
if (observers && !observers->IsEmpty()) {
|
||||
nsAutoTObserverArray<nsIMutationObserver*, 1>::ForwardIterator iter(*observers);
|
||||
while (iter.HasMore()) {
|
||||
nsCOMPtr<nsIMutationObserver> obs(iter.GetNext());
|
||||
RefPtr<SVGFilterObserver> filter = do_QueryObject(obs);
|
||||
if (filter) {
|
||||
filter->Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -41,9 +41,6 @@ public:
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
||||
|
||||
// Invalidate users of this filter
|
||||
void Invalidate();
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const override;
|
||||
|
||||
|
@ -907,7 +907,7 @@ Grouper::PaintContainerItem(DIGroup* aGroup, nsDisplayItem* aItem, const IntRect
|
||||
}
|
||||
case DisplayItemType::TYPE_MASK: {
|
||||
GP("Paint Mask\n");
|
||||
auto maskItem = static_cast<nsDisplayMask*>(aItem);
|
||||
auto maskItem = static_cast<nsDisplayMasksAndClipPaths*>(aItem);
|
||||
maskItem->SetPaintRect(maskItem->GetClippedBounds(mDisplayListBuilder));
|
||||
if (maskItem->IsValidMask()) {
|
||||
maskItem->PaintWithContentsPaintCallback(mDisplayListBuilder, aContext, [&] {
|
||||
@ -922,13 +922,13 @@ Grouper::PaintContainerItem(DIGroup* aGroup, nsDisplayItem* aItem, const IntRect
|
||||
}
|
||||
case DisplayItemType::TYPE_FILTER: {
|
||||
GP("Paint Filter\n");
|
||||
// We don't currently support doing invalidation inside nsDisplayFilter
|
||||
// We don't currently support doing invalidation inside nsDisplayFilters
|
||||
// for now just paint it as a single item
|
||||
BlobItemData* data = GetBlobItemDataForGroup(aItem, aGroup);
|
||||
if (data->mLayerManager->GetRoot()) {
|
||||
data->mLayerManager->BeginTransaction();
|
||||
static_cast<nsDisplayFilter*>(aItem)->PaintAsLayer(mDisplayListBuilder,
|
||||
aContext, data->mLayerManager);
|
||||
static_cast<nsDisplayFilters*>(aItem)->PaintAsLayer(mDisplayListBuilder,
|
||||
aContext, data->mLayerManager);
|
||||
if (data->mLayerManager->InTransaction()) {
|
||||
data->mLayerManager->AbortTransaction();
|
||||
}
|
||||
@ -1726,7 +1726,8 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
|
||||
switch (aItem->GetType()) {
|
||||
case DisplayItemType::TYPE_MASK:
|
||||
context->SetMatrix(context->CurrentMatrix().PreScale(aScale.width, aScale.height).PreTranslate(-aOffset.x, -aOffset.y));
|
||||
static_cast<nsDisplayMask*>(aItem)->PaintMask(aDisplayListBuilder, context, &isInvalidated);
|
||||
static_cast<nsDisplayMasksAndClipPaths*>(aItem)->
|
||||
PaintMask(aDisplayListBuilder, context, &isInvalidated);
|
||||
break;
|
||||
case DisplayItemType::TYPE_SVG_WRAPPER:
|
||||
{
|
||||
@ -1741,8 +1742,8 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
|
||||
{
|
||||
context->SetMatrix(context->CurrentMatrix().PreTranslate(-aOffset.x, -aOffset.y));
|
||||
isInvalidated = PaintByLayer(aItem, aDisplayListBuilder, aManager, context, aScale, [&]() {
|
||||
static_cast<nsDisplayFilter*>(aItem)->PaintAsLayer(aDisplayListBuilder,
|
||||
context, aManager);
|
||||
static_cast<nsDisplayFilters*>(aItem)->PaintAsLayer(aDisplayListBuilder,
|
||||
context, aManager);
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -1855,7 +1856,7 @@ WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
|
||||
LayerRect paintRect = LayerRect(LayerPoint(0, 0), LayerSize(paintSize));
|
||||
nsDisplayItemGeometry* geometry = fallbackData->GetGeometry();
|
||||
|
||||
// nsDisplayFilter is rendered via BasicLayerManager which means the invalidate
|
||||
// nsDisplayFilters is rendered via BasicLayerManager which means the invalidate
|
||||
// region is unknown until we traverse the displaylist contained by it.
|
||||
if (geometry && !fallbackData->IsInvalid() &&
|
||||
aItem->GetType() != DisplayItemType::TYPE_FILTER &&
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@ -9630,12 +9631,12 @@ BytecodeEmitter::copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes)
|
||||
}
|
||||
|
||||
void
|
||||
CGNumberList::finish(ConstArray* array)
|
||||
CGNumberList::finish(mozilla::Span<GCPtrValue> array)
|
||||
{
|
||||
MOZ_ASSERT(length() == array->length);
|
||||
MOZ_ASSERT(length() == array.size());
|
||||
|
||||
for (unsigned i = 0; i < length(); i++) {
|
||||
array->vector[i] = DoubleValue(list[i]);
|
||||
array[i].init(DoubleValue(list[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -9657,32 +9658,31 @@ CGObjectList::add(ObjectBox* objbox)
|
||||
}
|
||||
|
||||
void
|
||||
CGObjectList::finish(ObjectArray* array)
|
||||
CGObjectList::finish(mozilla::Span<GCPtrObject> array)
|
||||
{
|
||||
MOZ_ASSERT(length <= INDEX_LIMIT);
|
||||
MOZ_ASSERT(length == array->length);
|
||||
MOZ_ASSERT(length == array.size());
|
||||
|
||||
js::GCPtrObject* cursor = array->vector + array->length;
|
||||
ObjectBox* objbox = lastbox;
|
||||
do {
|
||||
--cursor;
|
||||
MOZ_ASSERT(!*cursor);
|
||||
for (GCPtrObject& obj : mozilla::Reversed(array)) {
|
||||
MOZ_ASSERT(obj == nullptr);
|
||||
MOZ_ASSERT(objbox->object->isTenured());
|
||||
if (objbox->isFunctionBox()) {
|
||||
objbox->asFunctionBox()->finish();
|
||||
}
|
||||
*cursor = objbox->object;
|
||||
} while ((objbox = objbox->emitLink) != nullptr);
|
||||
MOZ_ASSERT(cursor == array->vector);
|
||||
obj.init(objbox->object);
|
||||
objbox = objbox->emitLink;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGScopeList::finish(ScopeArray* array)
|
||||
CGScopeList::finish(mozilla::Span<GCPtrScope> array)
|
||||
{
|
||||
MOZ_ASSERT(length() <= INDEX_LIMIT);
|
||||
MOZ_ASSERT(length() == array->length);
|
||||
MOZ_ASSERT(length() == array.size());
|
||||
|
||||
for (uint32_t i = 0; i < length(); i++) {
|
||||
array->vector[i].init(vector[i]);
|
||||
array[i].init(vector[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9703,12 +9703,12 @@ CGTryNoteList::append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, siz
|
||||
}
|
||||
|
||||
void
|
||||
CGTryNoteList::finish(TryNoteArray* array)
|
||||
CGTryNoteList::finish(mozilla::Span<JSTryNote> array)
|
||||
{
|
||||
MOZ_ASSERT(length() == array->length);
|
||||
MOZ_ASSERT(length() == array.size());
|
||||
|
||||
for (unsigned i = 0; i < length(); i++) {
|
||||
array->vector[i] = list[i];
|
||||
array[i] = list[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -9737,9 +9737,9 @@ CGScopeNoteList::recordEnd(uint32_t index, uint32_t offset, bool inPrologue)
|
||||
}
|
||||
|
||||
void
|
||||
CGScopeNoteList::finish(ScopeNoteArray* array, uint32_t prologueLength)
|
||||
CGScopeNoteList::finish(mozilla::Span<ScopeNote> array, uint32_t prologueLength)
|
||||
{
|
||||
MOZ_ASSERT(length() == array->length);
|
||||
MOZ_ASSERT(length() == array.size());
|
||||
|
||||
for (unsigned i = 0; i < length(); i++) {
|
||||
if (!list[i].startInPrologue) {
|
||||
@ -9750,14 +9750,14 @@ CGScopeNoteList::finish(ScopeNoteArray* array, uint32_t prologueLength)
|
||||
}
|
||||
MOZ_ASSERT(list[i].end >= list[i].start);
|
||||
list[i].length = list[i].end - list[i].start;
|
||||
array->vector[i] = list[i];
|
||||
array[i] = list[i];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CGYieldAndAwaitOffsetList::finish(YieldAndAwaitOffsetArray& array, uint32_t prologueLength)
|
||||
CGYieldAndAwaitOffsetList::finish(mozilla::Span<uint32_t> array, uint32_t prologueLength)
|
||||
{
|
||||
MOZ_ASSERT(length() == array.length());
|
||||
MOZ_ASSERT(length() == array.size());
|
||||
|
||||
for (unsigned i = 0; i < length(); i++) {
|
||||
array[i] = prologueLength + list[i];
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define frontend_BytecodeEmitter_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Span.h"
|
||||
|
||||
#include "ds/InlineTable.h"
|
||||
#include "frontend/BCEParserHandle.h"
|
||||
@ -34,7 +35,7 @@ class CGNumberList {
|
||||
return list.append(v);
|
||||
}
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(ConstArray* array);
|
||||
void finish(mozilla::Span<GCPtrValue> array);
|
||||
};
|
||||
|
||||
struct CGObjectList {
|
||||
@ -44,7 +45,7 @@ struct CGObjectList {
|
||||
CGObjectList() : length(0), lastbox(nullptr) {}
|
||||
|
||||
unsigned add(ObjectBox* objbox);
|
||||
void finish(ObjectArray* array);
|
||||
void finish(mozilla::Span<GCPtrObject> array);
|
||||
};
|
||||
|
||||
struct MOZ_STACK_CLASS CGScopeList {
|
||||
@ -56,7 +57,7 @@ struct MOZ_STACK_CLASS CGScopeList {
|
||||
|
||||
bool append(Scope* scope) { return vector.append(scope); }
|
||||
uint32_t length() const { return vector.length(); }
|
||||
void finish(ScopeArray* array);
|
||||
void finish(mozilla::Span<GCPtrScope> array);
|
||||
};
|
||||
|
||||
struct CGTryNoteList {
|
||||
@ -65,7 +66,7 @@ struct CGTryNoteList {
|
||||
|
||||
MOZ_MUST_USE bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end);
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(TryNoteArray* array);
|
||||
void finish(mozilla::Span<JSTryNote> array);
|
||||
};
|
||||
|
||||
struct CGScopeNote : public ScopeNote
|
||||
@ -89,7 +90,7 @@ struct CGScopeNoteList {
|
||||
uint32_t parent);
|
||||
void recordEnd(uint32_t index, uint32_t offset, bool inPrologue);
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(ScopeNoteArray* array, uint32_t prologueLength);
|
||||
void finish(mozilla::Span<ScopeNote> array, uint32_t prologueLength);
|
||||
};
|
||||
|
||||
struct CGYieldAndAwaitOffsetList {
|
||||
@ -100,7 +101,7 @@ struct CGYieldAndAwaitOffsetList {
|
||||
|
||||
MOZ_MUST_USE bool append(uint32_t offset) { return list.append(offset); }
|
||||
size_t length() const { return list.length(); }
|
||||
void finish(YieldAndAwaitOffsetArray& array, uint32_t prologueLength);
|
||||
void finish(mozilla::Span<uint32_t> array, uint32_t prologueLength);
|
||||
};
|
||||
|
||||
// Have a few inline elements, so as to avoid heap allocation for tiny
|
||||
|
@ -489,21 +489,20 @@ HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
|
||||
return false;
|
||||
}
|
||||
|
||||
JSTryNote* tn = script->trynotes()->vector;
|
||||
JSTryNote* tnEnd = tn + script->trynotes()->length;
|
||||
uint32_t pcOffset = uint32_t(pc - script->main());
|
||||
for (; tn != tnEnd; ++tn) {
|
||||
if (pcOffset < tn->start) {
|
||||
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
if (pcOffset < tn.start) {
|
||||
continue;
|
||||
}
|
||||
if (pcOffset >= tn->start + tn->length) {
|
||||
if (pcOffset >= tn.start + tn.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (tn->kind) {
|
||||
switch (tn.kind) {
|
||||
case JSTRY_FOR_IN:
|
||||
// For-in loops have only the iterator on stack.
|
||||
if (stackDepth == tn->stackDepth) {
|
||||
if (stackDepth == tn.stackDepth) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -513,7 +512,7 @@ HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
|
||||
// result.value on stack.
|
||||
// The iterator is below the result.value, the next method below
|
||||
// the iterator.
|
||||
if (stackDepth == tn->stackDepth - 1 || stackDepth == tn->stackDepth - 2) {
|
||||
if (stackDepth == tn.stackDepth - 1 || stackDepth == tn.stackDepth - 2) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -521,7 +520,7 @@ HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
|
||||
case JSTRY_DESTRUCTURING_ITERCLOSE:
|
||||
// Destructuring code that need to call IteratorClose have both
|
||||
// the iterator and the "done" value on the stack.
|
||||
if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1) {
|
||||
if (stackDepth == tn.stackDepth || stackDepth == tn.stackDepth - 1) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
@ -117,14 +117,12 @@ BytecodeAnalysis::init(TempAllocator& alloc, GSNCache& gsn)
|
||||
}
|
||||
|
||||
case JSOP_TRY: {
|
||||
JSTryNote* tn = script_->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script_->trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
unsigned startOffset = script_->mainOffset() + tn->start;
|
||||
for (const JSTryNote& tn : script_->trynotes()) {
|
||||
unsigned startOffset = script_->mainOffset() + tn.start;
|
||||
if (startOffset == offset + 1) {
|
||||
unsigned catchOffset = startOffset + tn->length;
|
||||
unsigned catchOffset = startOffset + tn.length;
|
||||
|
||||
if (tn->kind != JSTRY_FOR_IN) {
|
||||
if (tn.kind != JSTRY_FOR_IN) {
|
||||
infos_[catchOffset].init(stackDepth);
|
||||
infos_[catchOffset].jumpTarget = true;
|
||||
}
|
||||
|
@ -564,10 +564,8 @@ ControlFlowGenerator::processTry()
|
||||
|
||||
// Try-finally is not yet supported.
|
||||
if (!checkedTryFinally_) {
|
||||
JSTryNote* tn = script->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script->trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
if (tn->kind == JSTRY_FINALLY) {
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
if (tn.kind == JSTRY_FINALLY) {
|
||||
return ControlStatus::Abort;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ NumArgAndLocalSlots(const InlineFrameIterator& frame)
|
||||
}
|
||||
|
||||
static void
|
||||
CloseLiveIteratorIon(JSContext* cx, const InlineFrameIterator& frame, JSTryNote* tn)
|
||||
CloseLiveIteratorIon(JSContext* cx, const InlineFrameIterator& frame, const JSTryNote* tn)
|
||||
{
|
||||
MOZ_ASSERT(tn->kind == JSTRY_FOR_IN ||
|
||||
tn->kind == JSTRY_DESTRUCTURING_ITERCLOSE);
|
||||
@ -223,7 +223,7 @@ HandleExceptionIon(JSContext* cx, const InlineFrameIterator& frame, ResumeFromEx
|
||||
bool inForOfIterClose = false;
|
||||
|
||||
for (TryNoteIterIon tni(cx, frame); !tni.done(); ++tni) {
|
||||
JSTryNote* tn = *tni;
|
||||
const JSTryNote* tn = *tni;
|
||||
|
||||
switch (tn->kind) {
|
||||
case JSTRY_FOR_IN:
|
||||
@ -305,7 +305,7 @@ ForcedReturn(JSContext* cx, const JSJitFrameIter& frame, jsbytecode* pc,
|
||||
}
|
||||
|
||||
static inline void
|
||||
BaselineFrameAndStackPointersFromTryNote(JSTryNote* tn, const JSJitFrameIter& frame,
|
||||
BaselineFrameAndStackPointersFromTryNote(const JSTryNote* tn, const JSJitFrameIter& frame,
|
||||
uint8_t** framePointer, uint8_t** stackPointer)
|
||||
{
|
||||
JSScript* script = frame.baselineFrame()->script();
|
||||
@ -315,7 +315,7 @@ BaselineFrameAndStackPointersFromTryNote(JSTryNote* tn, const JSJitFrameIter& fr
|
||||
}
|
||||
|
||||
static void
|
||||
SettleOnTryNote(JSContext* cx, JSTryNote* tn, const JSJitFrameIter& frame,
|
||||
SettleOnTryNote(JSContext* cx, const JSTryNote* tn, const JSJitFrameIter& frame,
|
||||
EnvironmentIter& ei, ResumeFromException* rfe, jsbytecode** pc)
|
||||
{
|
||||
RootedScript script(cx, frame.baselineFrame()->script());
|
||||
@ -376,7 +376,7 @@ CloseLiveIteratorsBaselineForUncatchableException(JSContext* cx, const JSJitFram
|
||||
{
|
||||
bool inForOfIterClose = false;
|
||||
for (TryNoteIterBaseline tni(cx, frame.baselineFrame(), pc); !tni.done(); ++tni) {
|
||||
JSTryNote* tn = *tni;
|
||||
const JSTryNote* tn = *tni;
|
||||
switch (tn->kind) {
|
||||
case JSTRY_FOR_IN: {
|
||||
// See corresponding comment in ProcessTryNotes.
|
||||
@ -415,7 +415,7 @@ ProcessTryNotesBaseline(JSContext* cx, const JSJitFrameIter& frame, EnvironmentI
|
||||
bool inForOfIterClose = false;
|
||||
|
||||
for (TryNoteIterBaseline tni(cx, frame.baselineFrame(), *pc); !tni.done(); ++tni) {
|
||||
JSTryNote* tn = *tni;
|
||||
const JSTryNote* tn = *tni;
|
||||
|
||||
MOZ_ASSERT(cx->isExceptionPending());
|
||||
switch (tn->kind) {
|
||||
|
@ -3072,17 +3072,15 @@ TryNotes(JSContext* cx, HandleScript script, Sprinter* sp)
|
||||
return false;
|
||||
}
|
||||
|
||||
JSTryNote* tn = script->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script->trynotes()->length;
|
||||
do {
|
||||
uint32_t startOff = script->pcToOffset(script->main()) + tn->start;
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
uint32_t startOff = script->pcToOffset(script->main()) + tn.start;
|
||||
if (!sp->jsprintf(" %-16s %6u %8u %8u\n",
|
||||
TryNoteName(static_cast<JSTryNoteKind>(tn->kind)),
|
||||
tn->stackDepth, startOff, startOff + tn->length))
|
||||
TryNoteName(static_cast<JSTryNoteKind>(tn.kind)),
|
||||
tn.stackDepth, startOff, startOff + tn.length))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} while (++tn != tnlimit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3097,28 +3095,26 @@ ScopeNotes(JSContext* cx, HandleScript script, Sprinter* sp)
|
||||
return false;
|
||||
}
|
||||
|
||||
ScopeNoteArray* notes = script->scopeNotes();
|
||||
for (uint32_t i = 0; i < notes->length; i++) {
|
||||
const ScopeNote* note = ¬es->vector[i];
|
||||
if (note->index == ScopeNote::NoScopeIndex) {
|
||||
for (const ScopeNote& note : script->scopeNotes()) {
|
||||
if (note.index == ScopeNote::NoScopeIndex) {
|
||||
if (!sp->jsprintf("%8s ", "(none)")) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!sp->jsprintf("%8u ", note->index)) {
|
||||
if (!sp->jsprintf("%8u ", note.index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (note->parent == ScopeNote::NoScopeIndex) {
|
||||
if (note.parent == ScopeNote::NoScopeIndex) {
|
||||
if (!sp->jsprintf("%8s ", "(none)")) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!sp->jsprintf("%8u ", note->parent)) {
|
||||
if (!sp->jsprintf("%8u ", note.parent)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!sp->jsprintf("%8u %8u\n", note->start, note->start + note->length)) {
|
||||
if (!sp->jsprintf("%8u %8u\n", note.start, note.start + note.length)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3189,9 +3185,7 @@ DisassembleScript(JSContext* cx, HandleScript script, HandleFunction fun,
|
||||
}
|
||||
|
||||
if (recursive && script->hasObjects()) {
|
||||
ObjectArray* objects = script->objects();
|
||||
for (unsigned i = 0; i != objects->length; ++i) {
|
||||
JSObject* obj = objects->vector[i];
|
||||
for (JSObject* obj : script->objects()) {
|
||||
if (obj->is<JSFunction>()) {
|
||||
if (!sp->put("\n")) {
|
||||
return false;
|
||||
|
@ -12,7 +12,7 @@ function onRejected(val) {
|
||||
Promise.prototype.then = 1;
|
||||
|
||||
// Replacing Promise@@species shouldn't affect addPromiseReactions.
|
||||
Promise[Symbol.species] = function(){};
|
||||
Object.defineProperty(Promise, Symbol.species, { get: function(){} });
|
||||
|
||||
// Replacing `Promise` shouldn't affect addPromiseReactions.
|
||||
let PromiseCtor = Promise;
|
||||
|
@ -13,7 +13,7 @@ let originalThen = Promise.prototype.then;
|
||||
Promise.prototype.then = 1;
|
||||
|
||||
// Replacing Promise[@@species] shouldn't affect getWaitForAllPromise.
|
||||
Promise[Symbol.species] = function(){};
|
||||
Object.defineProperty(Promise, Symbol.species, { get: function(){} });
|
||||
|
||||
// Replacing `Promise` shouldn't affect getWaitForAllPromise.
|
||||
let PromiseCtor = Promise;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define __STDC_FORMAT_MACROS
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ReverseIterator.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
@ -945,19 +946,17 @@ BytecodeParser::parse()
|
||||
// Note that there is no problem with code which is skipped by a thrown
|
||||
// exception but is not caught by a later handler in the same function:
|
||||
// no more code will execute, and it does not matter what is defined.
|
||||
JSTryNote* tn = script_->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script_->trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
uint32_t startOffset = script_->mainOffset() + tn->start;
|
||||
for (const JSTryNote& tn : script_->trynotes()) {
|
||||
uint32_t startOffset = script_->mainOffset() + tn.start;
|
||||
if (startOffset == offset + 1) {
|
||||
uint32_t catchOffset = startOffset + tn->length;
|
||||
if (tn->kind == JSTRY_CATCH) {
|
||||
uint32_t catchOffset = startOffset + tn.length;
|
||||
if (tn.kind == JSTRY_CATCH) {
|
||||
if (!addJump(catchOffset, &nextOffset, stackDepth, offsetStack,
|
||||
pc, JumpKind::TryCatch))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
} else if (tn->kind == JSTRY_FINALLY) {
|
||||
} else if (tn.kind == JSTRY_FINALLY) {
|
||||
if (!addJump(catchOffset, &nextOffset, stackDepth, offsetStack,
|
||||
pc, JumpKind::TryFinally))
|
||||
{
|
||||
@ -1455,15 +1454,12 @@ Disassemble1(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||
// with an offset. This simplifies code coverage analysis
|
||||
// based on this disassembled output.
|
||||
if (op == JSOP_TRY) {
|
||||
TryNoteArray* trynotes = script->trynotes();
|
||||
uint32_t i;
|
||||
size_t mainOffset = script->mainOffset();
|
||||
for(i = 0; i < trynotes->length; i++) {
|
||||
JSTryNote note = trynotes->vector[i];
|
||||
if (note.kind == JSTRY_CATCH && note.start + mainOffset == loc + 1) {
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
if (tn.kind == JSTRY_CATCH && tn.start + mainOffset == loc + 1) {
|
||||
if (!sp->jsprintf(" %u (%+d)",
|
||||
unsigned(loc + note.length + 1),
|
||||
int(note.length + 1)))
|
||||
unsigned(loc + tn.length + 1),
|
||||
int(tn.length + 1)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -3120,10 +3116,8 @@ GenerateLcovInfo(JSContext* cx, JS::Realm* realm, GenericPrinter& out)
|
||||
if (!script->hasObjects()) {
|
||||
continue;
|
||||
}
|
||||
size_t idx = script->objects()->length;
|
||||
while (idx--) {
|
||||
JSObject* obj = script->getObject(idx);
|
||||
|
||||
auto objects = script->objects();
|
||||
for (JSObject* obj : mozilla::Reversed(objects)) {
|
||||
// Only continue on JSFunction objects.
|
||||
if (!obj->is<JSFunction>()) {
|
||||
continue;
|
||||
|
@ -6238,12 +6238,10 @@ DebuggerScript_getChildScripts(JSContext* cx, unsigned argc, Value* vp)
|
||||
// and the calling function is stored as script->objects()->vector[0].
|
||||
// It is not really a child script of this script, so skip it using
|
||||
// innerObjectsStart().
|
||||
ObjectArray* objects = script->objects();
|
||||
RootedFunction fun(cx);
|
||||
RootedScript funScript(cx);
|
||||
RootedObject obj(cx), s(cx);
|
||||
for (uint32_t i = 0; i < objects->length; i++) {
|
||||
obj = objects->vector[i];
|
||||
RootedObject s(cx);
|
||||
for (const GCPtrObject& obj : script->objects()) {
|
||||
if (obj->is<JSFunction>()) {
|
||||
fun = &obj->as<JSFunction>();
|
||||
// The inner function could be a wasm native.
|
||||
@ -6429,13 +6427,11 @@ class FlowGraphSummary {
|
||||
// was an incoming edge of the catch block. This is needed
|
||||
// because we only report offsets of entry points which have
|
||||
// valid incoming edges.
|
||||
JSTryNote* tn = script->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script->trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
uint32_t startOffset = script->mainOffset() + tn->start;
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
uint32_t startOffset = script->mainOffset() + tn.start;
|
||||
if (startOffset == r.frontOffset() + 1) {
|
||||
uint32_t catchOffset = startOffset + tn->length;
|
||||
if (tn->kind == JSTRY_CATCH || tn->kind == JSTRY_FINALLY) {
|
||||
uint32_t catchOffset = startOffset + tn.length;
|
||||
if (tn.kind == JSTRY_CATCH || tn.kind == JSTRY_FINALLY) {
|
||||
addEdge(lineno, column, catchOffset);
|
||||
}
|
||||
}
|
||||
@ -7455,17 +7451,14 @@ class DebuggerScriptIsInCatchScopeMatcher
|
||||
size_t offset = offset_ - script->mainOffset();
|
||||
|
||||
if (script->hasTrynotes()) {
|
||||
JSTryNote* tnBegin = script->trynotes()->vector;
|
||||
JSTryNote* tnEnd = tnBegin + script->trynotes()->length;
|
||||
while (tnBegin != tnEnd) {
|
||||
if (tnBegin->start <= offset &&
|
||||
offset <= tnBegin->start + tnBegin->length &&
|
||||
tnBegin->kind == JSTRY_CATCH)
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
if (tn.start <= offset &&
|
||||
offset <= tn.start + tn.length &&
|
||||
tn.kind == JSTRY_CATCH)
|
||||
{
|
||||
isInCatch_ = true;
|
||||
return true;
|
||||
}
|
||||
++tnBegin;
|
||||
}
|
||||
}
|
||||
isInCatch_ = false;
|
||||
|
@ -3912,11 +3912,9 @@ RemoveReferencedNames(JSContext* cx, HandleScript script, PropertyNameSet& remai
|
||||
}
|
||||
|
||||
if (script->hasObjects()) {
|
||||
ObjectArray* objects = script->objects();
|
||||
RootedFunction fun(cx);
|
||||
RootedScript innerScript(cx);
|
||||
for (size_t i = 0; i < objects->length; i++) {
|
||||
JSObject* obj = objects->vector[i];
|
||||
for (JSObject* obj : script->objects()) {
|
||||
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
|
||||
fun = &obj->as<JSFunction>();
|
||||
innerScript = JSFunction::getOrCreateScript(cx, fun);
|
||||
@ -3984,11 +3982,9 @@ AnalyzeEntrainedVariablesInScript(JSContext* cx, HandleScript script, HandleScri
|
||||
}
|
||||
|
||||
if (innerScript->hasObjects()) {
|
||||
ObjectArray* objects = innerScript->objects();
|
||||
RootedFunction fun(cx);
|
||||
RootedScript innerInnerScript(cx);
|
||||
for (size_t i = 0; i < objects->length; i++) {
|
||||
JSObject* obj = objects->vector[i];
|
||||
for (JSObject* obj : script->objects()) {
|
||||
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
|
||||
fun = &obj->as<JSFunction>();
|
||||
innerInnerScript = JSFunction::getOrCreateScript(cx, fun);
|
||||
@ -4022,11 +4018,9 @@ js::AnalyzeEntrainedVariables(JSContext* cx, HandleScript script)
|
||||
return true;
|
||||
}
|
||||
|
||||
ObjectArray* objects = script->objects();
|
||||
RootedFunction fun(cx);
|
||||
RootedScript innerScript(cx);
|
||||
for (size_t i = 0; i < objects->length; i++) {
|
||||
JSObject* obj = objects->vector[i];
|
||||
for (JSObject* obj : script->objects()) {
|
||||
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
|
||||
fun = &obj->as<JSFunction>();
|
||||
innerScript = JSFunction::getOrCreateScript(cx, fun);
|
||||
|
@ -1303,7 +1303,7 @@ js::UnwindAllEnvironmentsInFrame(JSContext* cx, EnvironmentIter& ei)
|
||||
// will have no pc location distinguishing the try block scope from the inner
|
||||
// let block scope.
|
||||
jsbytecode*
|
||||
js::UnwindEnvironmentToTryPc(JSScript* script, JSTryNote* tn)
|
||||
js::UnwindEnvironmentToTryPc(JSScript* script, const JSTryNote* tn)
|
||||
{
|
||||
jsbytecode* pc = script->main() + tn->start;
|
||||
if (tn->kind == JSTRY_CATCH || tn->kind == JSTRY_FINALLY) {
|
||||
@ -1327,7 +1327,7 @@ ForcedReturn(JSContext* cx, InterpreterRegs& regs)
|
||||
}
|
||||
|
||||
static void
|
||||
SettleOnTryNote(JSContext* cx, JSTryNote* tn, EnvironmentIter& ei, InterpreterRegs& regs)
|
||||
SettleOnTryNote(JSContext* cx, const JSTryNote* tn, EnvironmentIter& ei, InterpreterRegs& regs)
|
||||
{
|
||||
// Unwind the environment to the beginning of the JSOP_TRY.
|
||||
UnwindEnvironment(cx, ei, UnwindEnvironmentToTryPc(regs.fp()->script(), tn));
|
||||
@ -1363,7 +1363,7 @@ UnwindIteratorsForUncatchableException(JSContext* cx, const InterpreterRegs& reg
|
||||
// ProcessTryNotes.
|
||||
bool inForOfIterClose = false;
|
||||
for (TryNoteIterInterpreter tni(cx, regs); !tni.done(); ++tni) {
|
||||
JSTryNote* tn = *tni;
|
||||
const JSTryNote* tn = *tni;
|
||||
switch (tn->kind) {
|
||||
case JSTRY_FOR_IN: {
|
||||
// See corresponding comment in ProcessTryNotes.
|
||||
@ -1403,7 +1403,7 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
|
||||
{
|
||||
bool inForOfIterClose = false;
|
||||
for (TryNoteIterInterpreter tni(cx, regs); !tni.done(); ++tni) {
|
||||
JSTryNote* tn = *tni;
|
||||
const JSTryNote* tn = *tni;
|
||||
|
||||
switch (tn->kind) {
|
||||
case JSTRY_CATCH:
|
||||
|
@ -345,17 +345,18 @@ UnwindAllEnvironmentsInFrame(JSContext* cx, EnvironmentIter& ei);
|
||||
// Compute the pc needed to unwind the scope to the beginning of the block
|
||||
// pointed to by the try note.
|
||||
extern jsbytecode*
|
||||
UnwindEnvironmentToTryPc(JSScript* script, JSTryNote* tn);
|
||||
UnwindEnvironmentToTryPc(JSScript* script, const JSTryNote* tn);
|
||||
|
||||
template <class StackDepthOp>
|
||||
class MOZ_STACK_CLASS TryNoteIter
|
||||
{
|
||||
RootedScript script_;
|
||||
uint32_t pcOffset_;
|
||||
JSTryNote* tn_;
|
||||
JSTryNote* tnEnd_;
|
||||
StackDepthOp getStackDepth_;
|
||||
|
||||
const JSTryNote* tn_;
|
||||
const JSTryNote* tnEnd_;
|
||||
|
||||
void settle() {
|
||||
for (; tn_ != tnEnd_; ++tn_) {
|
||||
/* If pc is out of range, try the next one. */
|
||||
@ -396,8 +397,11 @@ class MOZ_STACK_CLASS TryNoteIter
|
||||
getStackDepth_(getStackDepth)
|
||||
{
|
||||
if (script->hasTrynotes()) {
|
||||
tn_ = script->trynotes()->vector;
|
||||
tnEnd_ = tn_ + script->trynotes()->length;
|
||||
// NOTE: The Span is a temporary so we can't use begin()/end()
|
||||
// here or the iterator will outlive the span.
|
||||
auto trynotes = script->trynotes();
|
||||
tn_ = trynotes.data();
|
||||
tnEnd_ = tn_ + trynotes.size();
|
||||
} else {
|
||||
tn_ = tnEnd_ = nullptr;
|
||||
}
|
||||
@ -410,7 +414,7 @@ class MOZ_STACK_CLASS TryNoteIter
|
||||
}
|
||||
|
||||
bool done() const { return tn_ == tnEnd_; }
|
||||
JSTryNote* operator*() const { return tn_; }
|
||||
const JSTryNote* operator*() const { return tn_; }
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -304,11 +304,10 @@ XDRRelazificationInfo(XDRState<mode>* xdr, HandleFunction fun, HandleScript scri
|
||||
static inline uint32_t
|
||||
FindScopeIndex(JSScript* script, Scope& scope)
|
||||
{
|
||||
ScopeArray* scopes = script->scopes();
|
||||
GCPtrScope* vector = scopes->vector;
|
||||
unsigned length = scopes->length;
|
||||
auto scopes = script->scopes();
|
||||
unsigned length = scopes.size();
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
if (vector[i] == &scope) {
|
||||
if (scopes[i] == &scope) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -358,7 +357,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
};
|
||||
|
||||
uint32_t length, lineno, column, nfixed, nslots;
|
||||
uint32_t natoms, nsrcnotes, i;
|
||||
uint32_t natoms, nsrcnotes;
|
||||
uint32_t nconsts, nobjects, nscopes, nregexps, ntrynotes, nscopenotes, nyieldoffsets;
|
||||
uint32_t prologueLength;
|
||||
uint32_t funLength = 0;
|
||||
@ -408,20 +407,20 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
nsrcnotes = script->numNotes();
|
||||
|
||||
if (script->hasConsts()) {
|
||||
nconsts = script->consts()->length;
|
||||
nconsts = script->consts().size();
|
||||
}
|
||||
if (script->hasObjects()) {
|
||||
nobjects = script->objects()->length;
|
||||
nobjects = script->objects().size();
|
||||
}
|
||||
nscopes = script->scopes()->length;
|
||||
nscopes = script->scopes().size();
|
||||
if (script->hasTrynotes()) {
|
||||
ntrynotes = script->trynotes()->length;
|
||||
ntrynotes = script->trynotes().size();
|
||||
}
|
||||
if (script->hasScopeNotes()) {
|
||||
nscopenotes = script->scopeNotes()->length;
|
||||
nscopenotes = script->scopeNotes().size();
|
||||
}
|
||||
if (script->hasYieldAndAwaitOffsets()) {
|
||||
nyieldoffsets = script->yieldAndAwaitOffsets().length();
|
||||
nyieldoffsets = script->yieldAndAwaitOffsets().size();
|
||||
}
|
||||
|
||||
nTypeSets = script->nTypeSets();
|
||||
@ -704,7 +703,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
MOZ_TRY(xdr->codeBytes(code, length));
|
||||
MOZ_TRY(xdr->codeBytes(code + length, nsrcnotes));
|
||||
|
||||
for (i = 0; i != natoms; ++i) {
|
||||
for (uint32_t i = 0; i != natoms; ++i) {
|
||||
if (mode == XDR_DECODE) {
|
||||
RootedAtom tmp(cx);
|
||||
MOZ_TRY(XDRAtom(xdr, &tmp));
|
||||
@ -723,27 +722,26 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
}
|
||||
|
||||
if (nconsts) {
|
||||
GCPtrValue* vector = script->consts()->vector;
|
||||
RootedValue val(cx);
|
||||
for (i = 0; i != nconsts; ++i) {
|
||||
for (GCPtrValue& elem : script->consts()) {
|
||||
if (mode == XDR_ENCODE) {
|
||||
val = vector[i];
|
||||
val = elem.get();
|
||||
}
|
||||
MOZ_TRY(XDRScriptConst(xdr, &val));
|
||||
if (mode == XDR_DECODE) {
|
||||
vector[i].init(val);
|
||||
elem.init(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
MOZ_ASSERT(nscopes != 0);
|
||||
GCPtrScope* vector = script->scopes()->vector;
|
||||
GCPtrScope* vector = script->scopes().data();
|
||||
RootedScope scope(cx);
|
||||
RootedScope enclosing(cx);
|
||||
ScopeKind scopeKind;
|
||||
uint32_t enclosingScopeIndex = 0;
|
||||
for (i = 0; i != nscopes; ++i) {
|
||||
for (uint32_t i = 0; i != nscopes; ++i) {
|
||||
if (mode == XDR_ENCODE) {
|
||||
scope = vector[i];
|
||||
scopeKind = scope->kind();
|
||||
@ -834,87 +832,94 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
* all references to enclosing blocks (via FindScopeIndex below) happen
|
||||
* after the enclosing block has been XDR'd.
|
||||
*/
|
||||
for (i = 0; i != nobjects; ++i) {
|
||||
GCPtrObject* objp = &script->objects()->vector[i];
|
||||
XDRClassKind classk;
|
||||
if (nobjects) {
|
||||
for (GCPtrObject& elem : script->objects()) {
|
||||
XDRClassKind classk;
|
||||
|
||||
if (mode == XDR_ENCODE) {
|
||||
JSObject* obj = *objp;
|
||||
if (obj->is<RegExpObject>()) {
|
||||
classk = CK_RegexpObject;
|
||||
} else if (obj->is<JSFunction>()) {
|
||||
classk = CK_JSFunction;
|
||||
} else if (obj->is<PlainObject>() || obj->is<ArrayObject>()) {
|
||||
classk = CK_JSObject;
|
||||
} else {
|
||||
MOZ_CRASH("Cannot encode this class of object.");
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_TRY(xdr->codeEnum32(&classk));
|
||||
|
||||
switch (classk) {
|
||||
case CK_RegexpObject: {
|
||||
Rooted<RegExpObject*> regexp(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
regexp = &(*objp)->as<RegExpObject>();
|
||||
}
|
||||
MOZ_TRY(XDRScriptRegExpObject(xdr, ®exp));
|
||||
if (mode == XDR_DECODE) {
|
||||
*objp = regexp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CK_JSFunction: {
|
||||
/* Code the nested function's enclosing scope. */
|
||||
uint32_t funEnclosingScopeIndex = 0;
|
||||
RootedScope funEnclosingScope(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
RootedFunction function(cx, &(*objp)->as<JSFunction>());
|
||||
|
||||
if (function->isInterpretedLazy()) {
|
||||
funEnclosingScope = function->lazyScript()->enclosingScope();
|
||||
} else if (function->isInterpreted()) {
|
||||
funEnclosingScope = function->nonLazyScript()->enclosingScope();
|
||||
JSObject* obj = elem.get();
|
||||
if (obj->is<RegExpObject>()) {
|
||||
classk = CK_RegexpObject;
|
||||
} else if (obj->is<JSFunction>()) {
|
||||
classk = CK_JSFunction;
|
||||
} else if (obj->is<PlainObject>() || obj->is<ArrayObject>()) {
|
||||
classk = CK_JSObject;
|
||||
} else {
|
||||
MOZ_ASSERT(function->isAsmJSNative());
|
||||
return xdr->fail(JS::TranscodeResult_Failure_AsmJSNotSupported);
|
||||
MOZ_CRASH("Cannot encode this class of object.");
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_TRY(xdr->codeEnum32(&classk));
|
||||
|
||||
switch (classk) {
|
||||
case CK_RegexpObject: {
|
||||
Rooted<RegExpObject*> regexp(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
regexp = &elem->as<RegExpObject>();
|
||||
}
|
||||
MOZ_TRY(XDRScriptRegExpObject(xdr, ®exp));
|
||||
if (mode == XDR_DECODE) {
|
||||
elem.init(regexp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CK_JSFunction: {
|
||||
/* Code the nested function's enclosing scope. */
|
||||
uint32_t funEnclosingScopeIndex = 0;
|
||||
RootedScope funEnclosingScope(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
RootedFunction function(cx, &elem->as<JSFunction>());
|
||||
|
||||
if (function->isInterpretedLazy()) {
|
||||
funEnclosingScope = function->lazyScript()->enclosingScope();
|
||||
} else if (function->isInterpreted()) {
|
||||
funEnclosingScope = function->nonLazyScript()->enclosingScope();
|
||||
} else {
|
||||
MOZ_ASSERT(function->isAsmJSNative());
|
||||
return xdr->fail(JS::TranscodeResult_Failure_AsmJSNotSupported);
|
||||
}
|
||||
|
||||
funEnclosingScopeIndex = FindScopeIndex(script, *funEnclosingScope);
|
||||
}
|
||||
|
||||
funEnclosingScopeIndex = FindScopeIndex(script, *funEnclosingScope);
|
||||
MOZ_TRY(xdr->codeUint32(&funEnclosingScopeIndex));
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
funEnclosingScope = script->getScope(funEnclosingScopeIndex);
|
||||
}
|
||||
|
||||
// Code nested function and script.
|
||||
RootedFunction tmp(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
tmp = &elem->as<JSFunction>();
|
||||
}
|
||||
MOZ_TRY(XDRInterpretedFunction(xdr, funEnclosingScope, sourceObject, &tmp));
|
||||
if (mode == XDR_DECODE) {
|
||||
elem.init(tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case CK_JSObject: {
|
||||
/* Code object literal. */
|
||||
RootedObject tmp(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
tmp = elem.get();
|
||||
}
|
||||
MOZ_TRY(XDRObjectLiteral(xdr, &tmp));
|
||||
if (mode == XDR_DECODE) {
|
||||
elem.init(tmp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// Fail in debug, but only soft-fail in release
|
||||
MOZ_ASSERT(false, "Bad XDR class kind");
|
||||
return xdr->fail(JS::TranscodeResult_Failure_BadDecode);
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_TRY(xdr->codeUint32(&funEnclosingScopeIndex));
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
MOZ_ASSERT(funEnclosingScopeIndex < script->scopes()->length);
|
||||
funEnclosingScope = script->scopes()->vector[funEnclosingScopeIndex];
|
||||
}
|
||||
|
||||
// Code nested function and script.
|
||||
RootedFunction tmp(cx);
|
||||
if (mode == XDR_ENCODE) {
|
||||
tmp = &(*objp)->as<JSFunction>();
|
||||
}
|
||||
MOZ_TRY(XDRInterpretedFunction(xdr, funEnclosingScope, sourceObject, &tmp));
|
||||
*objp = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
case CK_JSObject: {
|
||||
/* Code object literal. */
|
||||
RootedObject tmp(cx, *objp);
|
||||
MOZ_TRY(XDRObjectLiteral(xdr, &tmp));
|
||||
*objp = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// Fail in debug, but only soft-fail in release
|
||||
MOZ_ASSERT(false, "Bad XDR class kind");
|
||||
return xdr->fail(JS::TranscodeResult_Failure_BadDecode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -922,30 +927,28 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope,
|
||||
// mismatch here indicates we will almost certainly crash in release.
|
||||
MOZ_TRY(xdr->codeMarker(0xF83B989A));
|
||||
|
||||
if (ntrynotes != 0) {
|
||||
JSTryNote* tnfirst = script->trynotes()->vector;
|
||||
MOZ_ASSERT(script->trynotes()->length == ntrynotes);
|
||||
JSTryNote* tn = tnfirst + ntrynotes;
|
||||
do {
|
||||
--tn;
|
||||
MOZ_TRY(xdr->codeUint8(&tn->kind));
|
||||
MOZ_TRY(xdr->codeUint32(&tn->stackDepth));
|
||||
MOZ_TRY(xdr->codeUint32(&tn->start));
|
||||
MOZ_TRY(xdr->codeUint32(&tn->length));
|
||||
} while (tn != tnfirst);
|
||||
if (ntrynotes) {
|
||||
for (JSTryNote& elem : script->trynotes()) {
|
||||
MOZ_TRY(xdr->codeUint8(&elem.kind));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.stackDepth));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.start));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.length));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nscopenotes; ++i) {
|
||||
ScopeNote* note = &script->scopeNotes()->vector[i];
|
||||
MOZ_TRY(xdr->codeUint32(¬e->index));
|
||||
MOZ_TRY(xdr->codeUint32(¬e->start));
|
||||
MOZ_TRY(xdr->codeUint32(¬e->length));
|
||||
MOZ_TRY(xdr->codeUint32(¬e->parent));
|
||||
if (nscopenotes) {
|
||||
for (ScopeNote& elem : script->scopeNotes()) {
|
||||
MOZ_TRY(xdr->codeUint32(&elem.index));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.start));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.length));
|
||||
MOZ_TRY(xdr->codeUint32(&elem.parent));
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nyieldoffsets; ++i) {
|
||||
uint32_t* offset = &script->yieldAndAwaitOffsets()[i];
|
||||
MOZ_TRY(xdr->codeUint32(offset));
|
||||
if (nyieldoffsets) {
|
||||
for (uint32_t& elem : script->yieldAndAwaitOffsets()) {
|
||||
MOZ_TRY(xdr->codeUint32(&elem));
|
||||
}
|
||||
}
|
||||
|
||||
if (scriptBits & (1 << HasLazyScript)) {
|
||||
@ -2967,25 +2970,25 @@ JSScript::partiallyInit(JSContext* cx, HandleScript script, uint32_t nscopes,
|
||||
|
||||
if (nconsts != 0) {
|
||||
MOZ_ASSERT(reinterpret_cast<uintptr_t>(cursor) % sizeof(JS::Value) == 0);
|
||||
script->consts()->length = nconsts;
|
||||
script->consts()->vector = (GCPtrValue*)cursor;
|
||||
cursor += nconsts * sizeof(script->consts()->vector[0]);
|
||||
script->constsRaw()->length = nconsts;
|
||||
script->constsRaw()->vector = (GCPtrValue*)cursor;
|
||||
cursor += nconsts * sizeof(script->constsRaw()->vector[0]);
|
||||
}
|
||||
|
||||
script->scopes()->length = nscopes;
|
||||
script->scopes()->vector = (GCPtrScope*)cursor;
|
||||
cursor += nscopes * sizeof(script->scopes()->vector[0]);
|
||||
script->scopesRaw()->length = nscopes;
|
||||
script->scopesRaw()->vector = (GCPtrScope*)cursor;
|
||||
cursor += nscopes * sizeof(script->scopesRaw()->vector[0]);
|
||||
|
||||
if (nobjects != 0) {
|
||||
script->objects()->length = nobjects;
|
||||
script->objects()->vector = (GCPtrObject*)cursor;
|
||||
cursor += nobjects * sizeof(script->objects()->vector[0]);
|
||||
script->objectsRaw()->length = nobjects;
|
||||
script->objectsRaw()->vector = (GCPtrObject*)cursor;
|
||||
cursor += nobjects * sizeof(script->objectsRaw()->vector[0]);
|
||||
}
|
||||
|
||||
if (ntrynotes != 0) {
|
||||
script->trynotes()->length = ntrynotes;
|
||||
script->trynotes()->vector = reinterpret_cast<JSTryNote*>(cursor);
|
||||
size_t vectorSize = ntrynotes * sizeof(script->trynotes()->vector[0]);
|
||||
script->trynotesRaw()->length = ntrynotes;
|
||||
script->trynotesRaw()->vector = reinterpret_cast<JSTryNote*>(cursor);
|
||||
size_t vectorSize = ntrynotes * sizeof(script->trynotesRaw()->vector[0]);
|
||||
#ifdef DEBUG
|
||||
memset(cursor, 0, vectorSize);
|
||||
#endif
|
||||
@ -2993,9 +2996,9 @@ JSScript::partiallyInit(JSContext* cx, HandleScript script, uint32_t nscopes,
|
||||
}
|
||||
|
||||
if (nscopenotes != 0) {
|
||||
script->scopeNotes()->length = nscopenotes;
|
||||
script->scopeNotes()->vector = reinterpret_cast<ScopeNote*>(cursor);
|
||||
size_t vectorSize = nscopenotes * sizeof(script->scopeNotes()->vector[0]);
|
||||
script->scopeNotesRaw()->length = nscopenotes;
|
||||
script->scopeNotesRaw()->vector = reinterpret_cast<ScopeNote*>(cursor);
|
||||
size_t vectorSize = nscopenotes * sizeof(script->scopeNotesRaw()->vector[0]);
|
||||
#ifdef DEBUG
|
||||
memset(cursor, 0, vectorSize);
|
||||
#endif
|
||||
@ -3004,7 +3007,7 @@ JSScript::partiallyInit(JSContext* cx, HandleScript script, uint32_t nscopes,
|
||||
|
||||
if (nyieldoffsets != 0) {
|
||||
yieldAndAwaitOffsets->init(reinterpret_cast<uint32_t*>(cursor), nyieldoffsets);
|
||||
size_t vectorSize = nyieldoffsets * sizeof(script->yieldAndAwaitOffsets()[0]);
|
||||
size_t vectorSize = nyieldoffsets * sizeof(script->yieldAndAwaitOffsetsRaw()[0]);
|
||||
#ifdef DEBUG
|
||||
memset(cursor, 0, vectorSize);
|
||||
#endif
|
||||
@ -3039,7 +3042,7 @@ JSScript::initFunctionPrototype(JSContext* cx, Handle<JSScript*> script,
|
||||
if (!functionProtoScope) {
|
||||
return false;
|
||||
}
|
||||
script->scopes()->vector[0].init(functionProtoScope);
|
||||
script->scopesRaw()->vector[0].init(functionProtoScope);
|
||||
|
||||
uint32_t codeLength = 1;
|
||||
uint32_t srcNotesLength = 1;
|
||||
@ -3272,17 +3275,15 @@ JSScript::assertValidJumpTargets() const
|
||||
|
||||
// Check catch/finally blocks as jump targets.
|
||||
if (hasTrynotes()) {
|
||||
JSTryNote* tn = trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
jsbytecode* tryStart = mainEntry + tn->start;
|
||||
for (const JSTryNote& tn : trynotes()) {
|
||||
jsbytecode* tryStart = mainEntry + tn.start;
|
||||
jsbytecode* tryPc = tryStart - 1;
|
||||
if (tn->kind != JSTRY_CATCH && tn->kind != JSTRY_FINALLY) {
|
||||
if (tn.kind != JSTRY_CATCH && tn.kind != JSTRY_FINALLY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(JSOp(*tryPc) == JSOP_TRY);
|
||||
jsbytecode* tryTarget = tryStart + tn->length;
|
||||
jsbytecode* tryTarget = tryStart + tn.length;
|
||||
MOZ_ASSERT(mainEntry <= tryTarget && tryTarget < end);
|
||||
MOZ_ASSERT(BytecodeIsJumpTarget(JSOp(*tryTarget)));
|
||||
}
|
||||
@ -3665,12 +3666,12 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
|
||||
/* Some embeddings are not careful to use ExposeObjectToActiveJS as needed. */
|
||||
MOZ_ASSERT(!src->sourceObject()->isMarkedGray());
|
||||
|
||||
uint32_t nconsts = src->hasConsts() ? src->consts()->length : 0;
|
||||
uint32_t nobjects = src->hasObjects() ? src->objects()->length : 0;
|
||||
uint32_t nscopes = src->scopes()->length;
|
||||
uint32_t ntrynotes = src->hasTrynotes() ? src->trynotes()->length : 0;
|
||||
uint32_t nscopenotes = src->hasScopeNotes() ? src->scopeNotes()->length : 0;
|
||||
uint32_t nyieldoffsets = src->hasYieldAndAwaitOffsets() ? src->yieldAndAwaitOffsets().length() : 0;
|
||||
uint32_t nconsts = src->hasConsts() ? src->consts().size() : 0;
|
||||
uint32_t nobjects = src->hasObjects() ? src->objects().size() : 0;
|
||||
uint32_t nscopes = src->scopes().size();
|
||||
uint32_t ntrynotes = src->hasTrynotes() ? src->trynotes().size() : 0;
|
||||
uint32_t nscopenotes = src->hasScopeNotes() ? src->scopeNotes().size() : 0;
|
||||
uint32_t nyieldoffsets = src->hasYieldAndAwaitOffsets() ? src->yieldAndAwaitOffsets().size() : 0;
|
||||
|
||||
/* Script data */
|
||||
|
||||
@ -3689,11 +3690,10 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
|
||||
{
|
||||
MOZ_ASSERT(nscopes != 0);
|
||||
MOZ_ASSERT(src->bodyScopeIndex() + 1 == scopes.length());
|
||||
GCPtrScope* vector = src->scopes()->vector;
|
||||
RootedScope original(cx);
|
||||
RootedScope clone(cx);
|
||||
for (uint32_t i = scopes.length(); i < nscopes; i++) {
|
||||
original = vector[i];
|
||||
for (const GCPtrScope& elem : src->scopes().From(scopes.length())) {
|
||||
original = elem.get();
|
||||
clone = Scope::clone(cx, original, scopes[FindScopeIndex(src, *original->enclosing())]);
|
||||
if (!clone || !scopes.append(clone)) {
|
||||
return false;
|
||||
@ -3705,11 +3705,10 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
|
||||
|
||||
AutoObjectVector objects(cx);
|
||||
if (nobjects != 0) {
|
||||
GCPtrObject* vector = src->objects()->vector;
|
||||
RootedObject obj(cx);
|
||||
RootedObject clone(cx);
|
||||
for (unsigned i = 0; i < nobjects; i++) {
|
||||
obj = vector[i];
|
||||
for (const GCPtrObject& elem : src->objects()) {
|
||||
obj = elem.get();
|
||||
clone = nullptr;
|
||||
if (obj->is<RegExpObject>()) {
|
||||
clone = CloneScriptRegExpObject(cx, obj->as<RegExpObject>());
|
||||
@ -3796,35 +3795,35 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
|
||||
dst->bitFields_.hideScriptFromDebugger_ = src->bitFields_.hideScriptFromDebugger_;
|
||||
|
||||
if (nconsts != 0) {
|
||||
GCPtrValue* vector = Rebase<GCPtrValue>(dst, src, src->consts()->vector);
|
||||
dst->consts()->vector = vector;
|
||||
GCPtrValue* vector = Rebase<GCPtrValue>(dst, src, src->constsRaw()->vector);
|
||||
dst->constsRaw()->vector = vector;
|
||||
for (unsigned i = 0; i < nconsts; ++i) {
|
||||
MOZ_ASSERT_IF(vector[i].isGCThing(), vector[i].toString()->isAtom());
|
||||
}
|
||||
}
|
||||
if (nobjects != 0) {
|
||||
GCPtrObject* vector = Rebase<GCPtrObject>(dst, src, src->objects()->vector);
|
||||
dst->objects()->vector = vector;
|
||||
GCPtrObject* vector = Rebase<GCPtrObject>(dst, src, src->objectsRaw()->vector);
|
||||
dst->objectsRaw()->vector = vector;
|
||||
for (unsigned i = 0; i < nobjects; ++i) {
|
||||
vector[i].init(&objects[i]->as<NativeObject>());
|
||||
}
|
||||
}
|
||||
{
|
||||
GCPtrScope* vector = Rebase<GCPtrScope>(dst, src, src->scopes()->vector);
|
||||
dst->scopes()->vector = vector;
|
||||
GCPtrScope* vector = Rebase<GCPtrScope>(dst, src, src->scopesRaw()->vector);
|
||||
dst->scopesRaw()->vector = vector;
|
||||
for (uint32_t i = 0; i < nscopes; ++i) {
|
||||
vector[i].init(scopes[i]);
|
||||
}
|
||||
}
|
||||
if (ntrynotes != 0) {
|
||||
dst->trynotes()->vector = Rebase<JSTryNote>(dst, src, src->trynotes()->vector);
|
||||
dst->trynotesRaw()->vector = Rebase<JSTryNote>(dst, src, src->trynotesRaw()->vector);
|
||||
}
|
||||
if (nscopenotes != 0) {
|
||||
dst->scopeNotes()->vector = Rebase<ScopeNote>(dst, src, src->scopeNotes()->vector);
|
||||
dst->scopeNotesRaw()->vector = Rebase<ScopeNote>(dst, src, src->scopeNotesRaw()->vector);
|
||||
}
|
||||
if (nyieldoffsets != 0) {
|
||||
dst->yieldAndAwaitOffsets().vector_ =
|
||||
Rebase<uint32_t>(dst, src, src->yieldAndAwaitOffsets().vector_);
|
||||
dst->yieldAndAwaitOffsetsRaw().vector_ =
|
||||
Rebase<uint32_t>(dst, src, src->yieldAndAwaitOffsetsRaw().vector_);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -4173,18 +4172,19 @@ JSScript::traceChildren(JSTracer* trc)
|
||||
scriptData()->traceChildren(trc);
|
||||
}
|
||||
|
||||
if (ScopeArray* scopearray = scopes()) {
|
||||
TraceRange(trc, scopearray->length, scopearray->vector, "scopes");
|
||||
if (data) {
|
||||
auto array = scopes();
|
||||
TraceRange(trc, array.size(), array.data(), "scopes");
|
||||
}
|
||||
|
||||
if (hasConsts()) {
|
||||
ConstArray* constarray = consts();
|
||||
TraceRange(trc, constarray->length, constarray->vector, "consts");
|
||||
auto array = consts();
|
||||
TraceRange(trc, array.size(), array.data(), "consts");
|
||||
}
|
||||
|
||||
if (hasObjects()) {
|
||||
ObjectArray* objarray = objects();
|
||||
TraceRange(trc, objarray->length, objarray->vector, "objects");
|
||||
auto array = objects();
|
||||
TraceRange(trc, array.size(), array.data(), "objects");
|
||||
}
|
||||
|
||||
MOZ_ASSERT_IF(sourceObject(), MaybeForwarded(sourceObject())->compartment() == compartment());
|
||||
@ -4252,16 +4252,16 @@ JSScript::lookupScope(jsbytecode* pc)
|
||||
|
||||
size_t offset = pc - code();
|
||||
|
||||
ScopeNoteArray* notes = scopeNotes();
|
||||
auto notes = scopeNotes();
|
||||
Scope* scope = nullptr;
|
||||
|
||||
// Find the innermost block chain using a binary search.
|
||||
size_t bottom = 0;
|
||||
size_t top = notes->length;
|
||||
size_t top = notes.size();
|
||||
|
||||
while (bottom < top) {
|
||||
size_t mid = bottom + (top - bottom) / 2;
|
||||
const ScopeNote* note = ¬es->vector[mid];
|
||||
const ScopeNote* note = ¬es[mid];
|
||||
if (note->start <= offset) {
|
||||
// Block scopes are ordered in the list by their starting offset, and since
|
||||
// blocks form a tree ones earlier in the list may cover the pc even if
|
||||
@ -4270,7 +4270,7 @@ JSScript::lookupScope(jsbytecode* pc)
|
||||
// the searched range for coverage.
|
||||
size_t check = mid;
|
||||
while (check >= bottom) {
|
||||
const ScopeNote* checkNote = ¬es->vector[check];
|
||||
const ScopeNote* checkNote = ¬es[check];
|
||||
MOZ_ASSERT(checkNote->start <= offset);
|
||||
if (offset < checkNote->start + checkNote->length) {
|
||||
// We found a matching block chain but there may be inner ones
|
||||
@ -4724,10 +4724,8 @@ JSScript::hasLoops()
|
||||
if (!hasTrynotes()) {
|
||||
return false;
|
||||
}
|
||||
JSTryNote* tn = trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
switch (tn->kind) {
|
||||
for (const JSTryNote& tn : trynotes()) {
|
||||
switch (tn.kind) {
|
||||
case JSTRY_FOR_IN:
|
||||
case JSTRY_FOR_OF:
|
||||
case JSTRY_LOOP:
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Span.h"
|
||||
#include "mozilla/Variant.h"
|
||||
|
||||
#include "jstypes.h"
|
||||
@ -1825,8 +1826,7 @@ class JSScript : public js::gc::TenuredCell
|
||||
|
||||
js::VarScope* functionExtraBodyVarScope() const {
|
||||
MOZ_ASSERT(functionHasExtraBodyVarScope());
|
||||
for (uint32_t i = 0; i < scopes()->length; i++) {
|
||||
js::Scope* scope = getScope(i);
|
||||
for (js::Scope* scope : scopes()) {
|
||||
if (scope->kind() == js::ScopeKind::FunctionBodyVar) {
|
||||
return &scope->as<js::VarScope>();
|
||||
}
|
||||
@ -1835,8 +1835,7 @@ class JSScript : public js::gc::TenuredCell
|
||||
}
|
||||
|
||||
bool needsBodyEnvironment() const {
|
||||
for (uint32_t i = 0; i < scopes()->length; i++) {
|
||||
js::Scope* scope = getScope(i);
|
||||
for (js::Scope* scope : scopes()) {
|
||||
if (ScopeKindIsInBody(scope->kind()) && scope->hasEnvironment()) {
|
||||
return true;
|
||||
}
|
||||
@ -1931,36 +1930,70 @@ class JSScript : public js::gc::TenuredCell
|
||||
|
||||
size_t dataSize() const { return dataSize_; }
|
||||
|
||||
js::ConstArray* consts() {
|
||||
private:
|
||||
|
||||
js::ConstArray* constsRaw() const {
|
||||
MOZ_ASSERT(hasConsts());
|
||||
return reinterpret_cast<js::ConstArray*>(data + constsOffset());
|
||||
}
|
||||
|
||||
js::ObjectArray* objects() {
|
||||
js::ObjectArray* objectsRaw() const {
|
||||
MOZ_ASSERT(hasObjects());
|
||||
return reinterpret_cast<js::ObjectArray*>(data + objectsOffset());
|
||||
}
|
||||
|
||||
js::ScopeArray* scopes() const {
|
||||
js::ScopeArray* scopesRaw() const {
|
||||
return reinterpret_cast<js::ScopeArray*>(data + scopesOffset());
|
||||
}
|
||||
|
||||
js::TryNoteArray* trynotes() const {
|
||||
js::TryNoteArray* trynotesRaw() const {
|
||||
MOZ_ASSERT(hasTrynotes());
|
||||
return reinterpret_cast<js::TryNoteArray*>(data + trynotesOffset());
|
||||
}
|
||||
|
||||
js::ScopeNoteArray* scopeNotes() {
|
||||
js::ScopeNoteArray* scopeNotesRaw() const {
|
||||
MOZ_ASSERT(hasScopeNotes());
|
||||
return reinterpret_cast<js::ScopeNoteArray*>(data + scopeNotesOffset());
|
||||
}
|
||||
|
||||
js::YieldAndAwaitOffsetArray& yieldAndAwaitOffsets() {
|
||||
js::YieldAndAwaitOffsetArray& yieldAndAwaitOffsetsRaw() const {
|
||||
MOZ_ASSERT(hasYieldAndAwaitOffsets());
|
||||
return *reinterpret_cast<js::YieldAndAwaitOffsetArray*>(data +
|
||||
yieldAndAwaitOffsetsOffset());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
mozilla::Span<js::GCPtrValue> consts() const {
|
||||
js::ConstArray* array = constsRaw();
|
||||
return mozilla::MakeSpan(array->vector, array->length);
|
||||
}
|
||||
|
||||
mozilla::Span<js::GCPtrObject> objects() const {
|
||||
js::ObjectArray* array = objectsRaw();
|
||||
return mozilla::MakeSpan(array->vector, array->length);
|
||||
}
|
||||
|
||||
mozilla::Span<js::GCPtrScope> scopes() const {
|
||||
js::ScopeArray* array = scopesRaw();
|
||||
return mozilla::MakeSpan(array->vector, array->length);
|
||||
}
|
||||
|
||||
mozilla::Span<JSTryNote> trynotes() const {
|
||||
js::TryNoteArray* array = trynotesRaw();
|
||||
return mozilla::MakeSpan(array->vector, array->length);
|
||||
}
|
||||
|
||||
mozilla::Span<js::ScopeNote> scopeNotes() const {
|
||||
js::ScopeNoteArray* array = scopeNotesRaw();
|
||||
return mozilla::MakeSpan(array->vector, array->length);
|
||||
}
|
||||
|
||||
mozilla::Span<uint32_t> yieldAndAwaitOffsets() const {
|
||||
js::YieldAndAwaitOffsetArray& array = yieldAndAwaitOffsetsRaw();
|
||||
return mozilla::MakeSpan(&array[0], array.length());
|
||||
}
|
||||
|
||||
bool hasLoops();
|
||||
|
||||
uint32_t numNotes() const {
|
||||
@ -2001,10 +2034,8 @@ class JSScript : public js::gc::TenuredCell
|
||||
}
|
||||
|
||||
JSObject* getObject(size_t index) {
|
||||
js::ObjectArray* arr = objects();
|
||||
MOZ_ASSERT(index < arr->length);
|
||||
MOZ_ASSERT(arr->vector[index]->isTenured());
|
||||
return arr->vector[index];
|
||||
MOZ_ASSERT(objects()[index]->isTenured());
|
||||
return objects()[index];
|
||||
}
|
||||
|
||||
JSObject* getObject(jsbytecode* pc) {
|
||||
@ -2013,9 +2044,7 @@ class JSScript : public js::gc::TenuredCell
|
||||
}
|
||||
|
||||
js::Scope* getScope(size_t index) const {
|
||||
js::ScopeArray* array = scopes();
|
||||
MOZ_ASSERT(index < array->length);
|
||||
return array->vector[index];
|
||||
return scopes()[index];
|
||||
}
|
||||
|
||||
js::Scope* getScope(jsbytecode* pc) const {
|
||||
@ -2040,9 +2069,7 @@ class JSScript : public js::gc::TenuredCell
|
||||
inline js::RegExpObject* getRegExp(jsbytecode* pc);
|
||||
|
||||
const js::Value& getConst(size_t index) {
|
||||
js::ConstArray* arr = consts();
|
||||
MOZ_ASSERT(index < arr->length);
|
||||
return arr->vector[index];
|
||||
return consts()[index];
|
||||
}
|
||||
|
||||
// The following 3 functions find the static scope just before the
|
||||
|
@ -240,15 +240,13 @@ ObjectGroup::useSingletonForAllocationSite(JSScript* script, jsbytecode* pc, JSP
|
||||
|
||||
unsigned offset = script->pcToOffset(pc);
|
||||
|
||||
JSTryNote* tn = script->trynotes()->vector;
|
||||
JSTryNote* tnlimit = tn + script->trynotes()->length;
|
||||
for (; tn < tnlimit; tn++) {
|
||||
if (tn->kind != JSTRY_FOR_IN && tn->kind != JSTRY_FOR_OF && tn->kind != JSTRY_LOOP) {
|
||||
for (const JSTryNote& tn : script->trynotes()) {
|
||||
if (tn.kind != JSTRY_FOR_IN && tn.kind != JSTRY_FOR_OF && tn.kind != JSTRY_LOOP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned startOffset = script->mainOffset() + tn->start;
|
||||
unsigned endOffset = startOffset + tn->length;
|
||||
unsigned startOffset = script->mainOffset() + tn.start;
|
||||
unsigned endOffset = startOffset + tn.length;
|
||||
|
||||
if (offset >= startOffset && offset < endOffset) {
|
||||
return GenericObject;
|
||||
|
@ -710,9 +710,7 @@ AddInnerLazyFunctionsFromScript(JSScript* script, AutoObjectVector& lazyFunction
|
||||
if (!script->hasObjects()) {
|
||||
return true;
|
||||
}
|
||||
ObjectArray* objects = script->objects();
|
||||
for (size_t i = 0; i < objects->length; i++) {
|
||||
JSObject* obj = objects->vector[i];
|
||||
for (JSObject* obj : script->objects()) {
|
||||
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpretedLazy()) {
|
||||
if (!lazyFunctions.append(obj)) {
|
||||
return false;
|
||||
|
@ -205,13 +205,13 @@ PrintDisplayItemTo(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
if (aItem->GetType() == DisplayItemType::TYPE_MASK) {
|
||||
nsCString str;
|
||||
(static_cast<nsDisplayMask*>(aItem))->PrintEffects(str);
|
||||
(static_cast<nsDisplayMasksAndClipPaths*>(aItem))->PrintEffects(str);
|
||||
aStream << str.get();
|
||||
}
|
||||
|
||||
if (aItem->GetType() == DisplayItemType::TYPE_FILTER) {
|
||||
nsCString str;
|
||||
(static_cast<nsDisplayFilter*>(aItem))->PrintEffects(str);
|
||||
(static_cast<nsDisplayFilters*>(aItem))->PrintEffects(str);
|
||||
aStream << str.get();
|
||||
}
|
||||
#endif
|
||||
|
@ -3201,8 +3201,8 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
/* List now emptied, so add the new list to the top. */
|
||||
resultList.AppendToTop(
|
||||
MakeDisplayItem<nsDisplayFilter>(aBuilder, this, &resultList,
|
||||
handleOpacity));
|
||||
MakeDisplayItem<nsDisplayFilters>(aBuilder, this, &resultList,
|
||||
handleOpacity));
|
||||
}
|
||||
|
||||
if (usingMask) {
|
||||
@ -3221,12 +3221,12 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
: containerItemASR;
|
||||
/* List now emptied, so add the new list to the top. */
|
||||
resultList.AppendToTop(
|
||||
MakeDisplayItem<nsDisplayMask>(aBuilder, this, &resultList, !useOpacity,
|
||||
maskASR));
|
||||
MakeDisplayItem<nsDisplayMasksAndClipPaths>(aBuilder, this, &resultList,
|
||||
!useOpacity, maskASR));
|
||||
}
|
||||
|
||||
// Also add the hoisted scroll info items. We need those for APZ scrolling
|
||||
// because nsDisplayMask items can't build active layers.
|
||||
// because nsDisplayMasksAndClipPaths items can't build active layers.
|
||||
aBuilder->ExitSVGEffectsContents();
|
||||
resultList.AppendToTop(&hoistedScrollInfoItemsStorage);
|
||||
if (aCreatedContainerItem) {
|
||||
|
@ -1626,11 +1626,12 @@ protected:
|
||||
Maybe<size_t> SetupMaskLayerForScrolledClip(Layer* aLayer,
|
||||
const DisplayItemClip& aClip);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Create/find a mask layer with suitable size for aMaskItem to paint
|
||||
* css-positioned-masking onto.
|
||||
*/
|
||||
void SetupMaskLayerForCSSMask(Layer* aLayer, nsDisplayMask* aMaskItem);
|
||||
void SetupMaskLayerForCSSMask(Layer* aLayer,
|
||||
nsDisplayMasksAndClipPaths* aMaskItem);
|
||||
|
||||
already_AddRefed<Layer> CreateMaskLayer(
|
||||
Layer* aLayer,
|
||||
@ -4443,12 +4444,13 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
|
||||
basic->SetTarget(context);
|
||||
|
||||
if (aItem->GetType() == DisplayItemType::TYPE_MASK) {
|
||||
static_cast<nsDisplayMask*>(aItem)->PaintAsLayer(aBuilder, aCtx, basic);
|
||||
static_cast<nsDisplayMasksAndClipPaths*>(aItem)->
|
||||
PaintAsLayer(aBuilder, aCtx, basic);
|
||||
if (basic->InTransaction()) {
|
||||
basic->AbortTransaction();
|
||||
}
|
||||
} else if (aItem->GetType() == DisplayItemType::TYPE_FILTER) {
|
||||
static_cast<nsDisplayFilter*>(aItem)->PaintAsLayer(aBuilder, aCtx, basic);
|
||||
static_cast<nsDisplayFilters*>(aItem)->PaintAsLayer(aBuilder, aCtx, basic);
|
||||
if (basic->InTransaction()) {
|
||||
basic->AbortTransaction();
|
||||
}
|
||||
@ -4612,7 +4614,7 @@ SetCSSMaskLayerUserData(Layer* aMaskLayer)
|
||||
|
||||
void
|
||||
ContainerState::SetupMaskLayerForCSSMask(Layer* aLayer,
|
||||
nsDisplayMask* aMaskItem)
|
||||
nsDisplayMasksAndClipPaths* aMaskItem)
|
||||
{
|
||||
RefPtr<ImageLayer> maskLayer =
|
||||
CreateOrRecycleMaskImageLayerFor(MaskLayerKey(aLayer, Nothing()),
|
||||
@ -5205,7 +5207,8 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
||||
if (item->GetType() == DisplayItemType::TYPE_MASK) {
|
||||
MOZ_ASSERT(itemClip.GetRoundedRectCount() == 0);
|
||||
|
||||
nsDisplayMask* maskItem = static_cast<nsDisplayMask*>(item);
|
||||
nsDisplayMasksAndClipPaths* maskItem =
|
||||
static_cast<nsDisplayMasksAndClipPaths*>(item);
|
||||
SetupMaskLayerForCSSMask(ownLayer, maskItem);
|
||||
|
||||
if (iter.PeekNext() && iter.PeekNext()->GetType() ==
|
||||
@ -7741,9 +7744,9 @@ ContainerState::CreateMaskLayer(Layer* aLayer,
|
||||
const DisplayItemClip& aClip,
|
||||
const Maybe<size_t>& aForAncestorMaskLayer)
|
||||
{
|
||||
// aLayer will never be the container layer created by an nsDisplayMask
|
||||
// because nsDisplayMask propagates the DisplayItemClip to its contents
|
||||
// and is not clipped itself.
|
||||
// aLayer will never be the container layer created by an
|
||||
// nsDisplayMasksAndClipPaths because nsDisplayMasksAndClipPaths propagates
|
||||
// the DisplayItemClip to its contents and is not clipped itself.
|
||||
// This assertion will fail if that ever stops being the case.
|
||||
MOZ_ASSERT(!aLayer->GetUserData(&gCSSMaskLayerUserData),
|
||||
"A layer contains round clips should not have css-mask on it.");
|
||||
|
@ -27,7 +27,7 @@ class nsDisplayList;
|
||||
class nsDisplayItem;
|
||||
class gfxContext;
|
||||
class nsDisplayItemGeometry;
|
||||
class nsDisplayMask;
|
||||
class nsDisplayMasksAndClipPaths;
|
||||
|
||||
namespace mozilla {
|
||||
struct ActiveScrolledRoot;
|
||||
|
@ -9445,7 +9445,7 @@ nsCharClipDisplayItem::ComputeInvalidationRegion(
|
||||
}
|
||||
}
|
||||
|
||||
nsDisplaySVGEffects::nsDisplaySVGEffects(
|
||||
nsDisplayEffectsBase::nsDisplayEffectsBase(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
@ -9459,32 +9459,32 @@ nsDisplaySVGEffects::nsDisplaySVGEffects(
|
||||
aClearClipChain)
|
||||
, mHandleOpacity(aHandleOpacity)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplaySVGEffects);
|
||||
MOZ_COUNT_CTOR(nsDisplayEffectsBase);
|
||||
}
|
||||
|
||||
nsDisplaySVGEffects::nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity)
|
||||
nsDisplayEffectsBase::nsDisplayEffectsBase(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity)
|
||||
: nsDisplayWrapList(aBuilder, aFrame, aList)
|
||||
, mHandleOpacity(aHandleOpacity)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplaySVGEffects);
|
||||
MOZ_COUNT_CTOR(nsDisplayEffectsBase);
|
||||
}
|
||||
|
||||
nsRegion
|
||||
nsDisplaySVGEffects::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const
|
||||
nsDisplayEffectsBase::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const
|
||||
{
|
||||
*aSnap = false;
|
||||
return nsRegion();
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplaySVGEffects::HitTest(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames)
|
||||
nsDisplayEffectsBase::HitTest(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames)
|
||||
{
|
||||
nsPoint rectCenter(aRect.x + aRect.width / 2, aRect.y + aRect.height / 2);
|
||||
if (nsSVGIntegrationUtils::HitTestFrameForEffects(
|
||||
@ -9494,19 +9494,19 @@ nsDisplaySVGEffects::HitTest(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
gfxRect
|
||||
nsDisplaySVGEffects::BBoxInUserSpace() const
|
||||
nsDisplayEffectsBase::BBoxInUserSpace() const
|
||||
{
|
||||
return nsSVGUtils::GetBBox(mFrame);
|
||||
}
|
||||
|
||||
gfxPoint
|
||||
nsDisplaySVGEffects::UserSpaceOffset() const
|
||||
nsDisplayEffectsBase::UserSpaceOffset() const
|
||||
{
|
||||
return nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mFrame);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplaySVGEffects::ComputeInvalidationRegion(
|
||||
nsDisplayEffectsBase::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const
|
||||
@ -9528,7 +9528,7 @@ nsDisplaySVGEffects::ComputeInvalidationRegion(
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplaySVGEffects::ValidateSVGFrame()
|
||||
nsDisplayEffectsBase::ValidateSVGFrame()
|
||||
{
|
||||
const nsIContent* content = mFrame->GetContent();
|
||||
bool hasSVGLayout = (mFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT);
|
||||
@ -9633,19 +9633,20 @@ ComputeMaskGeometry(PaintFramesParams& aParams)
|
||||
aParams.maskRect = result;
|
||||
}
|
||||
|
||||
nsDisplayMask::nsDisplayMask(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot)
|
||||
: nsDisplaySVGEffects(aBuilder,
|
||||
aFrame,
|
||||
aList,
|
||||
aHandleOpacity,
|
||||
aActiveScrolledRoot,
|
||||
true)
|
||||
nsDisplayMasksAndClipPaths::nsDisplayMasksAndClipPaths(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot)
|
||||
: nsDisplayEffectsBase(aBuilder,
|
||||
aFrame,
|
||||
aList,
|
||||
aHandleOpacity,
|
||||
aActiveScrolledRoot,
|
||||
true)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayMask);
|
||||
MOZ_COUNT_CTOR(nsDisplayMasksAndClipPaths);
|
||||
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
uint32_t flags =
|
||||
@ -9689,7 +9690,7 @@ CanMergeDisplayMaskFrame(nsIFrame* aFrame)
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::CanMerge(const nsDisplayItem* aItem) const
|
||||
nsDisplayMasksAndClipPaths::CanMerge(const nsDisplayItem* aItem) const
|
||||
{
|
||||
// Items for the same content element should be merged into a single
|
||||
// compositing group.
|
||||
@ -9703,7 +9704,7 @@ nsDisplayMask::CanMerge(const nsDisplayItem* aItem) const
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::IsValidMask() {
|
||||
nsDisplayMasksAndClipPaths::IsValidMask() {
|
||||
if (!ValidateSVGFrame()) {
|
||||
return false;
|
||||
}
|
||||
@ -9728,9 +9729,9 @@ nsDisplayMask::IsValidMask() {
|
||||
|
||||
|
||||
already_AddRefed<Layer>
|
||||
nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
nsDisplayMasksAndClipPaths::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
{
|
||||
if (!IsValidMask()) {
|
||||
return nullptr;
|
||||
@ -9744,9 +9745,9 @@ nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aMaskContext,
|
||||
bool* aMaskPainted)
|
||||
nsDisplayMasksAndClipPaths::PaintMask(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aMaskContext,
|
||||
bool* aMaskPainted)
|
||||
{
|
||||
MOZ_ASSERT(aMaskContext->GetDrawTarget()->GetFormat() == SurfaceFormat::A8);
|
||||
|
||||
@ -9768,16 +9769,16 @@ nsDisplayMask::PaintMask(nsDisplayListBuilder* aBuilder,
|
||||
*aMaskPainted = painted;
|
||||
}
|
||||
|
||||
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
nsDisplayMasksAndClipPathsGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
|
||||
return imgParams.result == ImgDrawResult::SUCCESS ||
|
||||
imgParams.result == ImgDrawResult::SUCCESS_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
LayerState
|
||||
nsDisplayMask::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters)
|
||||
nsDisplayMasksAndClipPaths::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters)
|
||||
{
|
||||
if (CanPaintOnMaskLayer(aManager)) {
|
||||
LayerState result = RequiredLayerStateForChildren(
|
||||
@ -9794,7 +9795,7 @@ nsDisplayMask::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::CanPaintOnMaskLayer(LayerManager* aManager)
|
||||
nsDisplayMasksAndClipPaths::CanPaintOnMaskLayer(LayerManager* aManager)
|
||||
{
|
||||
if (!nsSVGIntegrationUtils::IsMaskResourceReady(mFrame)) {
|
||||
return false;
|
||||
@ -9814,8 +9815,8 @@ nsDisplayMask::CanPaintOnMaskLayer(LayerManager* aManager)
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayMask::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion)
|
||||
nsDisplayMasksAndClipPaths::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion)
|
||||
{
|
||||
// Our children may be made translucent or arbitrarily deformed so we should
|
||||
// not allow them to subtract area from aVisibleRegion.
|
||||
@ -9826,14 +9827,16 @@ nsDisplayMask::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayMask::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const
|
||||
nsDisplayMasksAndClipPaths::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const
|
||||
{
|
||||
nsDisplaySVGEffects::ComputeInvalidationRegion(
|
||||
nsDisplayEffectsBase::ComputeInvalidationRegion(
|
||||
aBuilder, aGeometry, aInvalidRegion);
|
||||
|
||||
auto* geometry = static_cast<const nsDisplayMaskGeometry*>(aGeometry);
|
||||
auto* geometry =
|
||||
static_cast<const nsDisplayMasksAndClipPathsGeometry*>(aGeometry);
|
||||
bool snap;
|
||||
nsRect bounds = GetBounds(aBuilder, &snap);
|
||||
|
||||
@ -9868,9 +9871,9 @@ nsDisplayMask::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
LayerManager* aManager)
|
||||
nsDisplayMasksAndClipPaths::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
LayerManager* aManager)
|
||||
{
|
||||
// Clip the drawing target by mVisibleRect, which contains the visible
|
||||
// region of the target frame and its out-of-flow and inflow descendants.
|
||||
@ -9900,13 +9903,14 @@ nsDisplayMask::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
context->PopClip();
|
||||
|
||||
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
nsDisplayMasksAndClipPathsGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayMask::PaintWithContentsPaintCallback(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
const std::function<void()>& aPaintChildren)
|
||||
nsDisplayMasksAndClipPaths::PaintWithContentsPaintCallback(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
const std::function<void()>& aPaintChildren)
|
||||
{
|
||||
// Clip the drawing target by mVisibleRect, which contains the visible
|
||||
// region of the target frame and its out-of-flow and inflow descendants.
|
||||
@ -9936,12 +9940,12 @@ nsDisplayMask::PaintWithContentsPaintCallback(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
context->PopClip();
|
||||
|
||||
nsDisplayMaskGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
nsDisplayMasksAndClipPathsGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
nsDisplayMask::CreateWebRenderCommands(
|
||||
nsDisplayMasksAndClipPaths::CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
@ -9990,7 +9994,7 @@ nsDisplayMask::CreateWebRenderCommands(
|
||||
Nothing());
|
||||
}
|
||||
|
||||
nsDisplaySVGEffects::CreateWebRenderCommands(
|
||||
nsDisplayEffectsBase::CreateWebRenderCommands(
|
||||
aBuilder, aResources, *sc, aManager, aDisplayListBuilder);
|
||||
|
||||
if (mask) {
|
||||
@ -10001,8 +10005,9 @@ nsDisplayMask::CreateWebRenderCommands(
|
||||
}
|
||||
|
||||
Maybe<nsRect>
|
||||
nsDisplayMask::GetClipWithRespectToASR(nsDisplayListBuilder* aBuilder,
|
||||
const ActiveScrolledRoot* aASR) const
|
||||
nsDisplayMasksAndClipPaths::GetClipWithRespectToASR(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const ActiveScrolledRoot* aASR) const
|
||||
{
|
||||
if (const DisplayItemClip* clip =
|
||||
DisplayItemClipChain::ClipForASR(GetClipChain(), aASR)) {
|
||||
@ -10025,7 +10030,7 @@ nsDisplayMask::GetClipWithRespectToASR(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
void
|
||||
nsDisplayMask::PrintEffects(nsACString& aTo)
|
||||
nsDisplayMasksAndClipPaths::PrintEffects(nsACString& aTo)
|
||||
{
|
||||
nsIFrame* firstFrame =
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
|
||||
@ -10066,18 +10071,18 @@ nsDisplayMask::PrintEffects(nsACString& aTo)
|
||||
}
|
||||
#endif
|
||||
|
||||
nsDisplayFilter::nsDisplayFilter(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity)
|
||||
: nsDisplaySVGEffects(aBuilder, aFrame, aList, aHandleOpacity)
|
||||
nsDisplayFilters::nsDisplayFilters(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity)
|
||||
: nsDisplayEffectsBase(aBuilder, aFrame, aList, aHandleOpacity)
|
||||
, mEffectsBounds(aFrame->GetVisualOverflowRectRelativeToSelf())
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayFilter);
|
||||
MOZ_COUNT_CTOR(nsDisplayFilters);
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
nsDisplayFilter::BuildLayer(
|
||||
nsDisplayFilters::BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters)
|
||||
@ -10116,16 +10121,16 @@ nsDisplayFilter::BuildLayer(
|
||||
}
|
||||
|
||||
LayerState
|
||||
nsDisplayFilter::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters)
|
||||
nsDisplayFilters::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters)
|
||||
{
|
||||
return LAYER_SVG_EFFECTS;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayFilter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion)
|
||||
nsDisplayFilters::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRegion* aVisibleRegion)
|
||||
{
|
||||
nsPoint offset = ToReferenceFrame();
|
||||
nsRect dirtyRect = nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(
|
||||
@ -10142,15 +10147,15 @@ nsDisplayFilter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayFilter::ComputeInvalidationRegion(
|
||||
nsDisplayFilters::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const
|
||||
{
|
||||
nsDisplaySVGEffects::ComputeInvalidationRegion(
|
||||
nsDisplayEffectsBase::ComputeInvalidationRegion(
|
||||
aBuilder, aGeometry, aInvalidRegion);
|
||||
|
||||
auto* geometry = static_cast<const nsDisplayFilterGeometry*>(aGeometry);
|
||||
auto* geometry = static_cast<const nsDisplayFiltersGeometry*>(aGeometry);
|
||||
|
||||
if (aBuilder->ShouldSyncDecodeImages() &&
|
||||
geometry->ShouldInvalidateToSyncDecodeImages()) {
|
||||
@ -10161,9 +10166,9 @@ nsDisplayFilter::ComputeInvalidationRegion(
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
LayerManager* aManager)
|
||||
nsDisplayFilters::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx,
|
||||
LayerManager* aManager)
|
||||
{
|
||||
imgDrawingParams imgParams(aBuilder->ShouldSyncDecodeImages()
|
||||
? imgIContainer::FLAG_SYNC_DECODE
|
||||
@ -10178,7 +10183,7 @@ nsDisplayFilter::PaintAsLayer(nsDisplayListBuilder* aBuilder,
|
||||
mHandleOpacity,
|
||||
imgParams);
|
||||
nsSVGIntegrationUtils::PaintFilter(params);
|
||||
nsDisplayFilterGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
nsDisplayFiltersGeometry::UpdateDrawResult(this, imgParams.result);
|
||||
}
|
||||
|
||||
static float
|
||||
@ -10189,7 +10194,7 @@ ClampStdDeviation(float aStdDeviation)
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayFilter::CreateWebRenderCommands(
|
||||
nsDisplayFilters::CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
@ -10304,7 +10309,7 @@ nsDisplayFilter::CreateWebRenderCommands(
|
||||
aManager->CommandBuilder().PushOverrideForASR(GetActiveScrolledRoot(),
|
||||
Nothing());
|
||||
|
||||
nsDisplaySVGEffects::CreateWebRenderCommands(
|
||||
nsDisplayEffectsBase::CreateWebRenderCommands(
|
||||
aBuilder, aResources, sc, aManager, aDisplayListBuilder);
|
||||
|
||||
aManager->CommandBuilder().PopOverrideForASR(GetActiveScrolledRoot());
|
||||
@ -10313,7 +10318,7 @@ nsDisplayFilter::CreateWebRenderCommands(
|
||||
|
||||
#ifdef MOZ_DUMP_PAINTING
|
||||
void
|
||||
nsDisplayFilter::PrintEffects(nsACString& aTo)
|
||||
nsDisplayFilters::PrintEffects(nsACString& aTo)
|
||||
{
|
||||
nsIFrame* firstFrame =
|
||||
nsLayoutUtils::FirstContinuationOrIBSplitSibling(mFrame);
|
||||
|
@ -907,7 +907,7 @@ public:
|
||||
|
||||
/**
|
||||
* Returns true if we're currently building a display list that's
|
||||
* under an nsDisplayFilter.
|
||||
* under an nsDisplayFilters.
|
||||
*/
|
||||
bool IsInFilter() const { return mInFilter; }
|
||||
|
||||
@ -6659,31 +6659,34 @@ private:
|
||||
int32_t mAPD, mParentAPD;
|
||||
};
|
||||
|
||||
class nsDisplaySVGEffects : public nsDisplayWrapList
|
||||
/**
|
||||
* A base class for different effects types.
|
||||
*/
|
||||
class nsDisplayEffectsBase : public nsDisplayWrapList
|
||||
{
|
||||
public:
|
||||
nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aClearClipChain = false);
|
||||
nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity);
|
||||
nsDisplayEffectsBase(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aClearClipChain = false);
|
||||
nsDisplayEffectsBase(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity);
|
||||
|
||||
nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplaySVGEffects& aOther)
|
||||
nsDisplayEffectsBase(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayEffectsBase& aOther)
|
||||
: nsDisplayWrapList(aBuilder, aOther)
|
||||
, mEffectsBounds(aOther.mEffectsBounds)
|
||||
, mHandleOpacity(aOther.mHandleOpacity)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplaySVGEffects);
|
||||
MOZ_COUNT_CTOR(nsDisplayEffectsBase);
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
~nsDisplaySVGEffects() override { MOZ_COUNT_DTOR(nsDisplaySVGEffects); }
|
||||
~nsDisplayEffectsBase() override { MOZ_COUNT_DTOR(nsDisplayEffectsBase); }
|
||||
#endif
|
||||
|
||||
nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
@ -6717,35 +6720,44 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* A display item to paint a stacking context with mask and clip effects
|
||||
* set by the stacking context root frame's style.
|
||||
* A display item to paint a stacking context with 'mask' and 'clip-path'
|
||||
* effects set by the stacking context root frame's style. The 'mask' and
|
||||
* 'clip-path' properties may both contain multiple masks and clip paths,
|
||||
* respectively.
|
||||
*
|
||||
* Note that 'mask' and 'clip-path' may just contain CSS simple-images and CSS
|
||||
* basic shapes, respectively. That is, they don't necessarily reference
|
||||
* resources such as SVG 'mask' and 'clipPath' elements.
|
||||
*/
|
||||
class nsDisplayMask : public nsDisplaySVGEffects
|
||||
class nsDisplayMasksAndClipPaths : public nsDisplayEffectsBase
|
||||
{
|
||||
public:
|
||||
typedef mozilla::layers::ImageLayer ImageLayer;
|
||||
|
||||
nsDisplayMask(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot);
|
||||
nsDisplayMask(nsDisplayListBuilder* aBuilder, const nsDisplayMask& aOther)
|
||||
: nsDisplaySVGEffects(aBuilder, aOther)
|
||||
nsDisplayMasksAndClipPaths(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot);
|
||||
nsDisplayMasksAndClipPaths(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayMasksAndClipPaths& aOther)
|
||||
: nsDisplayEffectsBase(aBuilder, aOther)
|
||||
, mDestRects(aOther.mDestRects)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
~nsDisplayMask() override { MOZ_COUNT_DTOR(nsDisplayMask); }
|
||||
~nsDisplayMasksAndClipPaths() override {
|
||||
MOZ_COUNT_DTOR(nsDisplayMasksAndClipPaths);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_DISPLAY_DECL_NAME("Mask", TYPE_MASK)
|
||||
|
||||
nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayMask);
|
||||
return MakeDisplayItem<nsDisplayMask>(aBuilder, *this);
|
||||
MOZ_COUNT_CTOR(nsDisplayMasksAndClipPaths);
|
||||
return MakeDisplayItem<nsDisplayMasksAndClipPaths>(aBuilder, *this);
|
||||
}
|
||||
|
||||
bool CanMerge(const nsDisplayItem* aItem) const override;
|
||||
@ -6754,7 +6766,8 @@ public:
|
||||
{
|
||||
nsDisplayWrapList::Merge(aItem);
|
||||
|
||||
const nsDisplayMask* other = static_cast<const nsDisplayMask*>(aItem);
|
||||
const nsDisplayMasksAndClipPaths* other =
|
||||
static_cast<const nsDisplayMasksAndClipPaths*>(aItem);
|
||||
mEffectsBounds.UnionRect(mEffectsBounds,
|
||||
other->mEffectsBounds +
|
||||
other->mFrame->GetOffsetTo(mFrame));
|
||||
@ -6774,7 +6787,7 @@ public:
|
||||
nsDisplayItemGeometry* AllocateGeometry(
|
||||
nsDisplayListBuilder* aBuilder) override
|
||||
{
|
||||
return new nsDisplayMaskGeometry(this, aBuilder);
|
||||
return new nsDisplayMasksAndClipPathsGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
@ -6827,31 +6840,35 @@ private:
|
||||
/**
|
||||
* A display item to paint a stacking context with filter effects set by the
|
||||
* stacking context root frame's style.
|
||||
*
|
||||
* Note that the filters may just be simple CSS filter functions. That is,
|
||||
* they won't necessarily be references to SVG 'filter' elements.
|
||||
*/
|
||||
class nsDisplayFilter : public nsDisplaySVGEffects
|
||||
class nsDisplayFilters : public nsDisplayEffectsBase
|
||||
{
|
||||
public:
|
||||
nsDisplayFilter(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity);
|
||||
nsDisplayFilters(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
bool aHandleOpacity);
|
||||
|
||||
nsDisplayFilter(nsDisplayListBuilder* aBuilder, const nsDisplayFilter& aOther)
|
||||
: nsDisplaySVGEffects(aBuilder, aOther)
|
||||
nsDisplayFilters(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayFilters& aOther)
|
||||
: nsDisplayEffectsBase(aBuilder, aOther)
|
||||
, mEffectsBounds(aOther.mEffectsBounds)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
~nsDisplayFilter() override { MOZ_COUNT_DTOR(nsDisplayFilter); }
|
||||
~nsDisplayFilters() override { MOZ_COUNT_DTOR(nsDisplayFilters); }
|
||||
#endif
|
||||
|
||||
NS_DISPLAY_DECL_NAME("Filter", TYPE_FILTER)
|
||||
|
||||
nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayFilter);
|
||||
return MakeDisplayItem<nsDisplayFilter>(aBuilder, *this);
|
||||
MOZ_COUNT_CTOR(nsDisplayFilters);
|
||||
return MakeDisplayItem<nsDisplayFilters>(aBuilder, *this);
|
||||
}
|
||||
|
||||
bool CanMerge(const nsDisplayItem* aItem) const override
|
||||
@ -6866,7 +6883,7 @@ public:
|
||||
{
|
||||
nsDisplayWrapList::Merge(aItem);
|
||||
|
||||
const nsDisplayFilter* other = static_cast<const nsDisplayFilter*>(aItem);
|
||||
const nsDisplayFilters* other = static_cast<const nsDisplayFilters*>(aItem);
|
||||
mEffectsBounds.UnionRect(mEffectsBounds,
|
||||
other->mEffectsBounds +
|
||||
other->mFrame->GetOffsetTo(mFrame));
|
||||
@ -6893,7 +6910,7 @@ public:
|
||||
nsDisplayItemGeometry* AllocateGeometry(
|
||||
nsDisplayListBuilder* aBuilder) override
|
||||
{
|
||||
return new nsDisplayFilterGeometry(this, aBuilder);
|
||||
return new nsDisplayFiltersGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -125,7 +125,7 @@ nsDisplaySolidColorRegionGeometry::MoveBy(const nsPoint& aOffset)
|
||||
}
|
||||
|
||||
nsDisplaySVGEffectGeometry::nsDisplaySVGEffectGeometry(
|
||||
nsDisplaySVGEffects* aItem,
|
||||
nsDisplayEffectsBase* aItem,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
: nsDisplayItemGeometry(aItem, aBuilder)
|
||||
, mBBox(aItem->BBoxInUserSpace())
|
||||
@ -141,8 +141,9 @@ nsDisplaySVGEffectGeometry::MoveBy(const nsPoint& aOffset)
|
||||
mFrameOffsetToReferenceFrame += aOffset;
|
||||
}
|
||||
|
||||
nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
nsDisplayMasksAndClipPathsGeometry::nsDisplayMasksAndClipPathsGeometry(
|
||||
nsDisplayMasksAndClipPaths* aItem,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
: nsDisplaySVGEffectGeometry(aItem, aBuilder)
|
||||
, nsImageGeometryMixin(aItem, aBuilder)
|
||||
, mDestRects(aItem->GetDestRects())
|
||||
@ -151,8 +152,8 @@ nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem,
|
||||
{
|
||||
}
|
||||
|
||||
nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
nsDisplayFiltersGeometry::nsDisplayFiltersGeometry(nsDisplayFilters* aItem,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
: nsDisplaySVGEffectGeometry(aItem, aBuilder)
|
||||
, nsImageGeometryMixin(aItem, aBuilder)
|
||||
{
|
||||
|
@ -21,9 +21,9 @@ class nsDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayTableItem;
|
||||
class nsDisplayThemedBackground;
|
||||
class nsDisplaySVGEffects;
|
||||
class nsDisplayMask;
|
||||
class nsDisplayFilter;
|
||||
class nsDisplayEffectsBase;
|
||||
class nsDisplayMasksAndClipPaths;
|
||||
class nsDisplayFilters;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
@ -294,7 +294,7 @@ public:
|
||||
class nsDisplaySVGEffectGeometry : public nsDisplayItemGeometry
|
||||
{
|
||||
public:
|
||||
nsDisplaySVGEffectGeometry(nsDisplaySVGEffects* aItem,
|
||||
nsDisplaySVGEffectGeometry(nsDisplayEffectsBase* aItem,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
|
||||
void MoveBy(const nsPoint& aOffset) override;
|
||||
@ -304,12 +304,13 @@ public:
|
||||
nsPoint mFrameOffsetToReferenceFrame;
|
||||
};
|
||||
|
||||
class nsDisplayMaskGeometry
|
||||
class nsDisplayMasksAndClipPathsGeometry
|
||||
: public nsDisplaySVGEffectGeometry
|
||||
, public nsImageGeometryMixin<nsDisplayMaskGeometry>
|
||||
, public nsImageGeometryMixin<nsDisplayMasksAndClipPathsGeometry>
|
||||
{
|
||||
public:
|
||||
nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder);
|
||||
nsDisplayMasksAndClipPathsGeometry(nsDisplayMasksAndClipPaths* aItem,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
|
||||
bool InvalidateForSyncDecodeImages() const override
|
||||
{
|
||||
@ -321,13 +322,13 @@ public:
|
||||
bool mHandleOpacity;
|
||||
};
|
||||
|
||||
class nsDisplayFilterGeometry
|
||||
class nsDisplayFiltersGeometry
|
||||
: public nsDisplaySVGEffectGeometry
|
||||
, public nsImageGeometryMixin<nsDisplayFilterGeometry>
|
||||
, public nsImageGeometryMixin<nsDisplayFiltersGeometry>
|
||||
{
|
||||
public:
|
||||
nsDisplayFilterGeometry(nsDisplayFilter* aItem,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
nsDisplayFiltersGeometry(nsDisplayFilters* aItem,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
|
||||
bool InvalidateForSyncDecodeImages() const override
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Reference for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilter is drawn at the wrong position</title>
|
||||
<title>Reference for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilters is drawn at the wrong position</title>
|
||||
|
||||
<style>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Testcase for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilter is drawn at the wrong position</title>
|
||||
<title>Testcase for bug 1406183: ImageLayer inside inactive BasicLayerManager for fallback nsDisplayFilters is drawn at the wrong position</title>
|
||||
|
||||
<style>
|
||||
|
||||
|
@ -70,7 +70,7 @@ random != text-emoji.html text-emoji-notref.html
|
||||
== evenodd-fill-1.html evenodd-fill-ref.html
|
||||
|
||||
== dash-sanity.html data:text/html,<body>Pass
|
||||
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||azureSkia||skiaContent,0-9,0-470) random-if(Android) fails-if(webrender) == dash-1.html dash-1-ref.svg # Bug 668412 (really is android-specific, not IPC-specific)
|
||||
fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)||azureSkia||skiaContent,0-9,0-470) random-if(Android) == dash-1.html dash-1-ref.svg # Bug 668412 (really is android-specific, not IPC-specific)
|
||||
|
||||
== ctm-sanity.html data:text/html,<body>Pass
|
||||
== ctm-singular-sanity.html data:text/html,<body>Pass
|
||||
|
@ -272,7 +272,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGFilterObserver)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGFilterObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(SVGFilterObserver)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGFilterObserver)
|
||||
|
@ -290,10 +290,6 @@ protected:
|
||||
nsSVGFrameReferenceFromProperty mFrameReference;
|
||||
};
|
||||
|
||||
#define NS_SVGFILTEROBSERVER_IID \
|
||||
{ 0x9744ee20, 0x1bcf, 0x4c62, \
|
||||
{ 0x86, 0x7d, 0xd3, 0x7a, 0x91, 0x60, 0x3e, 0xef } }
|
||||
|
||||
/**
|
||||
* In a filter chain, there can be multiple SVG reference filters.
|
||||
* e.g. filter: url(#svg-filter-1) blur(10px) url(#svg-filter-2);
|
||||
@ -327,7 +323,6 @@ public:
|
||||
nsSVGFilterFrame *GetFilterFrame();
|
||||
|
||||
// nsISupports
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVGFILTEROBSERVER_IID)
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(SVGFilterObserver)
|
||||
|
||||
@ -343,8 +338,6 @@ private:
|
||||
SVGFilterObserverList* mFilterObserverList;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(SVGFilterObserver, NS_SVGFILTEROBSERVER_IID)
|
||||
|
||||
/**
|
||||
* This class manages a list of SVGFilterObservers, which correspond to
|
||||
* reference to SVG filters in a list of filters in a given 'filter' property.
|
||||
|
@ -210,10 +210,6 @@ nsSVGDisplayContainerFrame::RemoveFrame(ChildListID aListID,
|
||||
mContent->AsElement(), nsRestyleHint(0), nsChangeHint_UpdateOverflow);
|
||||
|
||||
nsSVGContainerFrame::RemoveFrame(aListID, aOldFrame);
|
||||
|
||||
if (!(GetStateBits() & (NS_FRAME_IS_NONDISPLAY | NS_STATE_IS_OUTER_SVG))) {
|
||||
nsSVGUtils::NotifyAncestorsOfFilterRegionChange(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -263,27 +263,6 @@ nsSVGUtils::NeedsReflowSVG(nsIFrame *aFrame)
|
||||
return NS_SUBTREE_DIRTY(aFrame);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGUtils::NotifyAncestorsOfFilterRegionChange(nsIFrame *aFrame)
|
||||
{
|
||||
MOZ_ASSERT(!(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG),
|
||||
"Not expecting to be called on the outer SVG Frame");
|
||||
|
||||
aFrame = aFrame->GetParent();
|
||||
|
||||
while (aFrame) {
|
||||
if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)
|
||||
return;
|
||||
|
||||
SVGFilterObserverListForCSSProp* observers =
|
||||
SVGObserverUtils::GetFilterObserverList(aFrame);
|
||||
if (observers) {
|
||||
observers->Invalidate();
|
||||
}
|
||||
aFrame = aFrame->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
Size
|
||||
nsSVGUtils::GetContextSize(const nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -228,11 +228,6 @@ public:
|
||||
*/
|
||||
static bool NeedsReflowSVG(nsIFrame *aFrame);
|
||||
|
||||
/*
|
||||
* Update the filter invalidation region for ancestor frames, if relevant.
|
||||
*/
|
||||
static void NotifyAncestorsOfFilterRegionChange(nsIFrame *aFrame);
|
||||
|
||||
/**
|
||||
* Percentage lengths in SVG are resolved against the width/height of the
|
||||
* nearest viewport (or its viewBox, if set). This helper returns the size
|
||||
|
@ -145,6 +145,7 @@ interface nsITreeView : nsISupports
|
||||
/**
|
||||
* Should be called from a XUL onselect handler whenever the selection changes.
|
||||
*/
|
||||
[binaryname(SelectionChangedXPCOM)]
|
||||
void selectionChanged();
|
||||
|
||||
/**
|
||||
|
@ -691,7 +691,7 @@ nsTreeContentView::CycleHeader(nsTreeColumn* aCol)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeContentView::SelectionChanged()
|
||||
nsTreeContentView::SelectionChangedXPCOM()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -90,7 +90,9 @@ class nsTreeContentView final : public nsITreeView,
|
||||
mozilla::ErrorResult& aError);
|
||||
void ToggleOpenState(int32_t aRow, mozilla::ErrorResult& aError);
|
||||
void CycleHeader(nsTreeColumn& aColumn, mozilla::ErrorResult& aError);
|
||||
// XPCOM SelectionChanged() is OK
|
||||
void SelectionChanged()
|
||||
{
|
||||
}
|
||||
void CycleCell(int32_t aRow, nsTreeColumn& aColumn)
|
||||
{
|
||||
}
|
||||
|
14
media/libyuv/aarch64-windows-noneon.patch
Normal file
14
media/libyuv/aarch64-windows-noneon.patch
Normal file
@ -0,0 +1,14 @@
|
||||
diff --git a/media/libyuv/libyuv/libyuv.gyp b/media/libyuv/libyuv/libyuv.gyp
|
||||
index 776510b..51ab531 100644
|
||||
--- a/media/libyuv/libyuv/libyuv.gyp
|
||||
+++ b/media/libyuv/libyuv/libyuv.gyp
|
||||
@@ -33,7 +33,8 @@
|
||||
'build_msa': 0,
|
||||
'conditions': [
|
||||
['(target_arch == "armv7" or target_arch == "armv7s" or \
|
||||
- (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
|
||||
+ (target_arch == "arm" and arm_version >= 7) or \
|
||||
+ (OS != "win" and target_arch == "arm64")) \
|
||||
and (arm_neon == 1 or arm_neon_optional == 1)', {
|
||||
'build_neon': 1,
|
||||
}],
|
@ -33,7 +33,8 @@
|
||||
'build_msa': 0,
|
||||
'conditions': [
|
||||
['(target_arch == "armv7" or target_arch == "armv7s" or \
|
||||
(target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\
|
||||
(target_arch == "arm" and arm_version >= 7) or \
|
||||
(OS != "win" and target_arch == "arm64")) \
|
||||
and (arm_neon == 1 or arm_neon_optional == 1)', {
|
||||
'build_neon': 1,
|
||||
}],
|
||||
|
2
media/libyuv/update.py
Normal file → Executable file
2
media/libyuv/update.py
Normal file → Executable file
@ -46,6 +46,8 @@ def apply_patches():
|
||||
os.system("patch -p3 < allow_disabling_asm_avx2.patch")
|
||||
# Patch to add H444ToARGB() variant
|
||||
os.system("patch -p3 < add_H444ToARGB.patch")
|
||||
# Patch to avoid selecting neon codepaths on AArch64 Windows
|
||||
os.system("patch -p3 < aarch64-windows-noneon.patch")
|
||||
|
||||
def update_readme(commit, commitdate):
|
||||
with open('README_MOZILLA') as f:
|
||||
|
@ -3766,6 +3766,7 @@ Tab.prototype = {
|
||||
this.browser.addEventListener("DOMWindowFocus", this, true);
|
||||
this.browser.addEventListener("focusin", this, true);
|
||||
this.browser.addEventListener("focusout", this, true);
|
||||
this.browser.addEventListener("TabSelect", this, true);
|
||||
|
||||
// Note that the XBL binding is untrusted
|
||||
this.browser.addEventListener("VideoBindingAttached", this, true, true);
|
||||
@ -3904,6 +3905,7 @@ Tab.prototype = {
|
||||
this.browser.removeEventListener("DOMWindowFocus", this, true);
|
||||
this.browser.removeEventListener("focusin", this, true);
|
||||
this.browser.removeEventListener("focusout", this, true);
|
||||
this.browser.removeEventListener("TabSelect", this, true);
|
||||
|
||||
this.browser.removeEventListener("VideoBindingAttached", this, true, true);
|
||||
this.browser.removeEventListener("VideoBindingCast", this, true, true);
|
||||
@ -4433,28 +4435,38 @@ Tab.prototype = {
|
||||
}
|
||||
|
||||
case "focusin": {
|
||||
if (aEvent.composedTarget instanceof HTMLInputElement) {
|
||||
if (BrowserApp.selectedTab === this &&
|
||||
aEvent.composedTarget instanceof HTMLInputElement) {
|
||||
this._autoFill.onFocus(aEvent.composedTarget);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "focusout": {
|
||||
if (aEvent.composedTarget instanceof HTMLInputElement) {
|
||||
if (BrowserApp.selectedTab === this &&
|
||||
aEvent.composedTarget instanceof HTMLInputElement) {
|
||||
this._autoFill.onFocus(null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "TabSelect": {
|
||||
this._autoFill.clearElements();
|
||||
this._autoFill.scanDocument(this.browser.contentDocument);
|
||||
break;
|
||||
}
|
||||
|
||||
case "pagehide": {
|
||||
if (aEvent.target === this.browser.contentDocument) {
|
||||
if (BrowserApp.selectedTab === this &&
|
||||
aEvent.target === this.browser.contentDocument) {
|
||||
this._autoFill.clearElements();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "pageshow": {
|
||||
if (aEvent.target === this.browser.contentDocument && aEvent.persisted) {
|
||||
if (BrowserApp.selectedTab === this &&
|
||||
aEvent.target === this.browser.contentDocument && aEvent.persisted) {
|
||||
this._autoFill.scanDocument(aEvent.target);
|
||||
}
|
||||
|
||||
|
@ -777,7 +777,6 @@ public class SessionAccessibility {
|
||||
final int id;
|
||||
if (message != null) {
|
||||
id = message.getInt("id");
|
||||
mAutoFillNodes.put(id, message);
|
||||
} else {
|
||||
id = View.NO_ID;
|
||||
}
|
||||
|
@ -734,7 +734,6 @@ public final class SessionTextInput {
|
||||
final int id;
|
||||
if (message != null) {
|
||||
id = message.getInt("id");
|
||||
mAutoFillNodes.put(id, message);
|
||||
} else {
|
||||
id = View.NO_ID;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class GeckoViewAutoFill {
|
||||
return;
|
||||
}
|
||||
|
||||
debug `Adding auto-fill ${aFormLike}`;
|
||||
debug `Adding auto-fill ${aFormLike.rootElement.tagName}`;
|
||||
|
||||
this._autoFillTasks.delete(aFormLike.rootElement);
|
||||
|
||||
|
@ -340,7 +340,7 @@ nsNSSASN1Tree::CycleHeader(nsTreeColumn*)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSASN1Tree::SelectionChanged()
|
||||
nsNSSASN1Tree::SelectionChangedXPCOM()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ nsCertTree::CycleHeader(nsTreeColumn* col)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCertTree::SelectionChanged()
|
||||
nsCertTree::SelectionChangedXPCOM()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -919,6 +919,9 @@ set_config('ENABLE_MARIONETTE', marionette)
|
||||
def geckodriver_default(enable_tests, target, cross_compile, hazard, asan):
|
||||
if not enable_tests:
|
||||
return False
|
||||
# geckodriver depends on winapi 0.2.8, which doesn't work with AArch64.
|
||||
if target.os == 'WINNT' and target.cpu == 'aarch64':
|
||||
return False
|
||||
if hazard or target.os == 'Android' or (asan and cross_compile):
|
||||
return False
|
||||
return True
|
||||
|
@ -23,10 +23,10 @@ endif
|
||||
|
||||
# TARGET_OS/TARGET_CPU may be unintuitive, so we hardcode some special formats
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifeq ($(TARGET_CPU),x86_64)
|
||||
MOZ_PKG_PLATFORM := win64
|
||||
else
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
MOZ_PKG_PLATFORM := win32
|
||||
else
|
||||
MOZ_PKG_PLATFORM := win64
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
|
@ -39,6 +39,7 @@ NFPREGS EQU 8
|
||||
|
||||
MACRO
|
||||
STUBENTRY $functionname, $paramcount
|
||||
EXPORT |$functionname|
|
||||
|$functionname| PROC
|
||||
mov w17, $paramcount
|
||||
b SharedStub
|
||||
|
@ -851,6 +851,9 @@ nsThread::ShutdownInternal(bool aSync)
|
||||
NotNull<nsThread*> currentThread =
|
||||
WrapNotNull(nsThreadManager::get().GetCurrentThread());
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(currentThread->EventQueue(),
|
||||
"Shutdown() may only be called from an XPCOM thread");
|
||||
|
||||
nsAutoPtr<nsThreadShutdownContext>& context =
|
||||
*currentThread->mRequestedShutdownContexts.AppendElement();
|
||||
context = new nsThreadShutdownContext(WrapNotNull(this), currentThread, aSync);
|
||||
|
Loading…
Reference in New Issue
Block a user