Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
/ jfx23u Public archive

Commit 2e2af94

Browse files
author
Hima Bindu Meda
committed
8338307: Additional WebKit 619.1 fixes from WebKitGTK 2.44.3
Backport-of: aa52f7efc370a4c55ff7a05a6903988871436d64
1 parent faf4c28 commit 2e2af94

File tree

181 files changed

+1163
-555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+1163
-555
lines changed

modules/javafx.web/src/main/native/Source/JavaScriptCore/assembler/ARM64EAssembler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ class ARM64EAssembler : public ARM64Assembler {
261261

262262
ALWAYS_INLINE void braaz(RegisterID dest)
263263
{
264-
insn(encodeGroup4(Group4Op::BLRAAZ, dest));
264+
insn(encodeGroup4(Group4Op::BRAAZ, dest));
265265
}
266266

267267
ALWAYS_INLINE void brabz(RegisterID dest)
268268
{
269-
insn(encodeGroup4(Group4Op::BLRABZ, dest));
269+
insn(encodeGroup4(Group4Op::BRABZ, dest));
270270
}
271271

272272
ALWAYS_INLINE void blraaz(RegisterID dest)

modules/javafx.web/src/main/native/Source/JavaScriptCore/builtins/ArrayConstructor.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ function isArray(array)
120120

121121
@linkTimeConstant
122122
@visibility=PrivateRecursive
123-
async function defaultAsyncFromAsyncIterator(result, iterator, mapFn, thisArg)
123+
async function defaultAsyncFromAsyncIterator(iterator, mapFn, thisArg)
124124
{
125125
"use strict";
126126

127+
var result = this !== @Array && @isConstructor(this) ? new this() : [];
128+
127129
var k = 0;
128130

129131
// Since for-of loop once more looks up the @@iterator property of a given iterable,
@@ -202,14 +204,12 @@ function fromAsync(asyncItems /*, mapFn, thisArg */)
202204
}
203205
}
204206

205-
var result = this !== @Array && @isConstructor(this) ? new this() : [];
206-
207207
if (!@isUndefinedOrNull(usingAsyncIterator))
208-
return @defaultAsyncFromAsyncIterator(result, usingAsyncIterator.@call(asyncItems), mapFn, thisArg);
208+
return @defaultAsyncFromAsyncIterator.@call(this, usingAsyncIterator.@call(asyncItems), mapFn, thisArg);
209209

210210
if (!@isUndefinedOrNull(usingSyncIterator)) {
211211
var iterator = usingSyncIterator.@call(asyncItems);
212-
return @defaultAsyncFromAsyncIterator(result, @createAsyncFromSyncIterator(iterator, iterator.next), mapFn, thisArg);
212+
return @defaultAsyncFromAsyncIterator.@call(this, @createAsyncFromSyncIterator(iterator, iterator.next), mapFn, thisArg);
213213
}
214214

215215
return @defaultAsyncFromAsyncArrayLike.@call(this, asyncItems, mapFn, thisArg);

modules/javafx.web/src/main/native/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,10 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionNode* functionNode, Unlinke
602602
SymbolTableEntry entry(varOffset);
603603
functionSymbolTable->set(NoLockingNecessary, name, entry);
604604

605+
IGNORE_GCC_WARNINGS_BEGIN("dangling-reference")
605606
const Identifier& ident =
606607
static_cast<const BindingNode*>(parameters.at(i).first)->boundProperty();
608+
IGNORE_GCC_WARNINGS_END
607609

608610
varOrAnonymous = addConstant(ident);
609611
}

modules/javafx.web/src/main/native/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5019,18 +5019,18 @@ Node* ByteCodeParser::load(
50195019

50205020
ObjectPropertyCondition ByteCodeParser::presenceConditionIfConsistent(JSObject* knownBase, UniquedStringImpl* uid, PropertyOffset offset, const StructureSet& set)
50215021
{
5022-
if (set.isEmpty())
5023-
return ObjectPropertyCondition();
5022+
Structure* structure = knownBase->structure();
50245023
unsigned attributes;
5025-
PropertyOffset firstOffset = set[0]->getConcurrently(uid, attributes);
5026-
if (firstOffset != offset)
5024+
PropertyOffset baseOffset = structure->getConcurrently(uid, attributes);
5025+
if (offset != baseOffset)
50275026
return ObjectPropertyCondition();
5028-
for (unsigned i = 1; i < set.size(); ++i) {
5029-
unsigned otherAttributes;
5030-
PropertyOffset otherOffset = set[i]->getConcurrently(uid, otherAttributes);
5031-
if (otherOffset != offset || otherAttributes != attributes)
5032-
return ObjectPropertyCondition();
5033-
}
5027+
5028+
// We need to check set contains knownBase's structure because knownBase's GetOwnPropertySlot could normally prevent access
5029+
// to this property, for example via a cross-origin restriction check. So unless we've executed this access before we can't assume
5030+
// just because knownBase has a property uid at offset we're allowed to access.
5031+
if (!set.contains(structure))
5032+
return ObjectPropertyCondition();
5033+
50345034
return ObjectPropertyCondition::presenceWithoutBarrier(knownBase, uid, offset, attributes);
50355035
}
50365036

modules/javafx.web/src/main/native/Source/JavaScriptCore/heap/Heap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,8 @@ size_t Heap::extraMemorySize()
973973
checkedTotal += m_arrayBuffers.size();
974974
size_t total = UNLIKELY(checkedTotal.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedTotal.value();
975975

976-
ASSERT(m_objectSpace.capacity() >= m_objectSpace.size());
976+
// It would be nice to have `ASSERT(m_objectSpace.capacity() >= m_objectSpace.size());` here but `m_objectSpace.size()`
977+
// requires having heap access which thread might not. Specifically, we might be called from the resource usage thread.
977978
return std::min(total, std::numeric_limits<size_t>::max() - m_objectSpace.capacity());
978979
}
979980

modules/javafx.web/src/main/native/Source/JavaScriptCore/jit/JITCode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ enum class JITType : uint8_t {
7272
static constexpr unsigned widthOfJITType = 3;
7373
static_assert(WTF::getMSBSetConstexpr(static_cast<std::underlying_type_t<JITType>>(JITType::FTLJIT)) + 1 == widthOfJITType);
7474

75-
#if USE(JSVALUE64)
75+
#if CPU(ADDRESS64)
7676
template<typename ByteSizedEnumType>
7777
class JITConstant {
7878
static_assert(sizeof(ByteSizedEnumType) == 1);

modules/javafx.web/src/main/native/Source/JavaScriptCore/jsc.cpp

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
#include <fenv.h>
147147
#include <arm/arch.h>
148148
#endif
149+
149150
#if OS(DARWIN) && PLATFORM(MAC)
150151
#include <libproc.h>
151152
#endif
@@ -285,6 +286,7 @@ class Workers {
285286
SentinelLinkedList<Worker, BasicRawSentinelNode<Worker>> m_workers;
286287
Deque<String> m_reports;
287288
};
289+
288290
WTF_MAKE_TZONE_ALLOCATED_IMPL(Workers);
289291

290292

@@ -416,6 +418,7 @@ static JSC_DECLARE_HOST_FUNCTION(functionDropAllLocks);
416418
#if ENABLE(FUZZILLI)
417419
static JSC_DECLARE_HOST_FUNCTION(functionFuzzilli);
418420
#endif
421+
419422
struct Script {
420423
enum class StrictMode {
421424
Strict,
@@ -563,6 +566,7 @@ class GlobalObject final : public JSGlobalObject {
563566
propertyNames.add(propertyName);
564567
}
565568
}
569+
566570
private:
567571
GlobalObject(VM&, Structure*);
568572

@@ -577,30 +581,39 @@ class GlobalObject final : public JSGlobalObject {
577581
if (result.isNewEntry)
578582
m_strings.append(uid);
579583
}
584+
580585
bool contains(UniquedStringImpl* name) const { return m_names.contains(name); }
581586
const HashSet<UniquedStringImpl*>& names() const { return m_names; }
587+
582588
private:
583589
Vector<AtomString> m_strings; // To keep the UniqueStringImpls alive.
584590
HashSet<UniquedStringImpl*> m_names;
585591
};
592+
586593
void finishCreation(VM& vm, const Vector<String>& arguments)
587594
{
588595
auto& filter = ensurePropertyFilter();
596+
589597
auto addFunction = [&] (VM& vm, ASCIILiteral name, NativeFunction function, unsigned arguments, unsigned attributes = static_cast<unsigned>(PropertyAttribute::DontEnum)) {
590598
addFunctionImpl(filter, vm, name, function, arguments, attributes);
591599
};
600+
592601
auto addFunctionToObject = [&] (VM& vm, JSObject* owner, ASCIILiteral name, NativeFunction function, unsigned arguments, unsigned attributes = static_cast<unsigned>(PropertyAttribute::DontEnum)) {
593602
addFunctionToObjectImpl(filter, vm, owner, name, function, arguments, attributes);
594603
};
604+
595605
auto putDirect = [&] (VM& vm, PropertyName propertyName, JSValue value, unsigned attributes = 0) -> bool {
596606
return putDirectImpl(filter, vm, propertyName, value, attributes);
597607
};
608+
598609
auto putDirectWithoutTransition = [&] (VM& vm, PropertyName propertyName, JSValue value, unsigned attributes) {
599610
putDirectWithoutTransitionImpl(filter, vm, propertyName, value, attributes);
600611
};
612+
601613
auto putDirectNativeFunction = [&] (VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, unsigned functionLength, NativeFunction nativeFunction, ImplementationVisibility implementationVisibility, Intrinsic intrinsic, unsigned attributes) -> bool {
602614
return putDirectNativeFunctionImpl(filter, vm, globalObject, propertyName, functionLength, nativeFunction, implementationVisibility, intrinsic, attributes);
603615
};
616+
604617
Base::finishCreation(vm);
605618
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
606619

@@ -776,10 +789,12 @@ class GlobalObject final : public JSGlobalObject {
776789
#if ENABLE(FUZZILLI)
777790
addFunction(vm, "fuzzilli"_s, functionFuzzilli, 2);
778791
#endif
792+
779793
if (Options::exposeCustomSettersOnGlobalObjectForTesting()) {
780794
auto putDirectCustomAccessor = [&] (VM& vm, PropertyName propertyName, JSValue value, unsigned attributes) -> bool {
781795
return putDirectCustomAccessorImpl(filter, vm, propertyName, value, attributes);
782796
};
797+
783798
{
784799
CustomGetterSetter* custom = CustomGetterSetter::create(vm, nullptr, testCustomAccessorSetter);
785800
Identifier identifier = Identifier::fromString(vm, "testCustomAccessorSetter"_s);
@@ -792,6 +807,7 @@ class GlobalObject final : public JSGlobalObject {
792807
putDirectCustomAccessor(vm, identifier, custom, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::CustomValue);
793808
}
794809
}
810+
795811
if (Options::useDollarVM()) {
796812
// $vm is added in JSGlobalObject but we also want it filtered out. Just add it to the filter here.
797813
Identifier dollarVMIdentifier = Identifier::fromString(vm, "$vm"_s);
@@ -1193,6 +1209,7 @@ static bool fillBufferWithContentsOfFile(const String& fileName, Vector<char>& b
11931209
fprintf(stderr, "Could not open file: %s\n", fileName.utf8().data());
11941210
return false;
11951211
}
1212+
11961213
if ((statBuf.st_mode & S_IFMT) != S_IFREG) {
11971214
fprintf(stderr, "Trying to open a non-file: %s\n", fileName.utf8().data());
11981215
return false;
@@ -1339,7 +1356,6 @@ class ShellSourceProvider final : public StringSourceProvider {
13391356
// bytecode cache, which results in intermittent test failures. As $.agent.start is only
13401357
// a rarely used testing facility, we simply do not cache bytecode on these threads.
13411358
, m_cacheEnabled(Worker::current().isMain() && !!Options::diskCachePath())
1342-
13431359
{
13441360
}
13451361

@@ -3232,19 +3248,30 @@ JSC_DEFINE_HOST_FUNCTION(functionDropAllLocks, (JSGlobalObject* globalObject, Ca
32323248
JSLock::DropAllLocks dropAllLocks(globalObject);
32333249
return JSValue::encode(jsUndefined());
32343250
}
3251+
32353252
#if ENABLE(FUZZILLI)
3253+
3254+
// We have to assume that the fuzzer will be able to call this function e.g. by
3255+
// enumerating the properties of the global object and eval'ing them. As such
3256+
// this function is implemented in a way that requires passing some magic value
3257+
// as first argument (with the idea being that the fuzzer won't be able to
3258+
// generate this value) which then also acts as a selector for the operation
3259+
// to perform.
32363260
JSC_DEFINE_HOST_FUNCTION(functionFuzzilli, (JSGlobalObject* globalObject, CallFrame* callFrame))
32373261
{
32383262
VM& vm = globalObject->vm();
32393263
auto scope = DECLARE_THROW_SCOPE(vm);
32403264
if (!callFrame->argument(0).isString()) {
3265+
// We directly require a string as argument for simplicity.
32413266
return JSValue::encode(jsUndefined());
32423267
}
32433268
auto operation = callFrame->argument(0).toWTFString(globalObject);
32443269
RETURN_IF_EXCEPTION(scope, { });
3270+
32453271
if (operation == "FUZZILLI_CRASH"_s) {
32463272
int32_t command = callFrame->argument(1).toInt32(globalObject);
32473273
RETURN_IF_EXCEPTION(scope, { });
3274+
32483275
switch (command) {
32493276
case 0:
32503277
*reinterpret_cast<int32_t*>(0x41414141) = 0x1337;
@@ -3256,14 +3283,18 @@ JSC_DEFINE_HOST_FUNCTION(functionFuzzilli, (JSGlobalObject* globalObject, CallFr
32563283
ASSERT(0);
32573284
break;
32583285
}
3286+
32593287
} else if (operation == "FUZZILLI_PRINT"_s) {
32603288
String string = callFrame->argument(1).toWTFString(globalObject);
32613289
RETURN_IF_EXCEPTION(scope, { });
3290+
32623291
Fuzzilli::logFile().println(string);
32633292
Fuzzilli::logFile().flush();
32643293
}
3294+
32653295
return JSValue::encode(jsUndefined());
32663296
}
3297+
32673298
#endif // ENABLE(FUZZILLI)
32683299

32693300
// Use SEH for Release builds only to get rid of the crash report dialog
@@ -3638,6 +3669,7 @@ static void runWithOptions(GlobalObject* globalObject, CommandLine& options, boo
36383669
for (size_t i = 0; i < scripts.size(); i++) {
36393670
JSInternalPromise* promise = nullptr;
36403671
bool isModule = options.m_module || scripts[i].scriptType == Script::ScriptType::Module;
3672+
36413673
switch (scripts[i].codeSource) {
36423674
case Script::CodeSource::File: {
36433675
fileName = String::fromLatin1(scripts[i].argument);
@@ -4047,6 +4079,7 @@ void CommandLine::parseArguments(int argc, char** argv)
40474079
}
40484080
continue;
40494081
}
4082+
40504083
// See if the -- option is a JSC VM option.
40514084
if (strstr(arg, "--") == arg) {
40524085
if (!JSC::Options::setOption(&arg[2], /* verify = */ false)) {
@@ -4096,16 +4129,20 @@ int runJSC(const CommandLine& options, bool isWorker, const Func& func)
40964129

40974130
int result;
40984131
bool success;
4132+
40994133
#if ENABLE(FUZZILLI)
4134+
// Let parent know we are ready.
41004135
if (options.m_reprl) {
41014136
Fuzzilli::initializeReprl();
41024137
}
41034138
#endif // ENABLE(FUZZILLI)
4139+
41044140
do {
41054141
#if ENABLE(FUZZILLI)
41064142
if (options.m_reprl)
41074143
Fuzzilli::waitForCommand();
41084144
#endif // ENABLE(FUZZILLI)
4145+
41094146
success = true;
41104147
GlobalObject* globalObject = nullptr;
41114148
{
@@ -4120,6 +4157,7 @@ int runJSC(const CommandLine& options, bool isWorker, const Func& func)
41204157
vm.deferredWorkTimer->runRunLoop();
41214158
{
41224159
JSLockHolder locker(vm);
4160+
41234161
if (!options.m_reprl && options.m_interactive && success)
41244162
runInteractive(globalObject);
41254163
}
@@ -4152,7 +4190,6 @@ int runJSC(const CommandLine& options, bool isWorker, const Func& func)
41524190
printf("JSC OSR EXIT FUZZ: encountered %u dynamic checks.\n", numberOfOSRExitFuzzChecks());
41534191
}
41544192

4155-
41564193
auto compileTimeStats = JIT::compileTimeStats();
41574194
Vector<CString> compileTimeKeys;
41584195
for (auto& entry : compileTimeStats)
@@ -4196,6 +4233,7 @@ int runJSC(const CommandLine& options, bool isWorker, const Func& func)
41964233
}
41974234
#endif // ENABLE(FUZZILLI)
41984235
} while (options.m_reprl);
4236+
41994237
vm.codeCache()->write();
42004238

42014239
if (options.m_destroyVM || isWorker) {

modules/javafx.web/src/main/native/Source/JavaScriptCore/runtime/ArgList.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void MarkedVectorBase::addMarkSet(JSValue v)
4545

4646
void ArgList::getSlice(int startIndex, ArgList& result) const
4747
{
48-
if (startIndex <= 0 || startIndex >= m_argCount) {
48+
if (startIndex <= 0 || static_cast<unsigned>(startIndex) >= m_argCount) {
4949
result = ArgList();
5050
return;
5151
}
@@ -60,7 +60,7 @@ void MarkedVectorBase::markLists(Visitor& visitor, ListSet& markSet)
6060
ListSet::iterator end = markSet.end();
6161
for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
6262
MarkedVectorBase* list = *it;
63-
for (int i = 0; i < list->m_size; ++i)
63+
for (unsigned i = 0; i < list->m_size; ++i)
6464
visitor.appendUnbarriered(JSValue::decode(list->slotFor(i)));
6565
}
6666
}
@@ -86,7 +86,7 @@ auto MarkedVectorBase::expandCapacity() -> Status
8686
return expandCapacity(checkedNewCapacity);
8787
}
8888

89-
auto MarkedVectorBase::expandCapacity(int newCapacity) -> Status
89+
auto MarkedVectorBase::expandCapacity(unsigned newCapacity) -> Status
9090
{
9191
setNeedsOverflowCheck();
9292
ASSERT(m_capacity < newCapacity);
@@ -96,7 +96,7 @@ auto MarkedVectorBase::expandCapacity(int newCapacity) -> Status
9696
EncodedJSValue* newBuffer = static_cast<EncodedJSValue*>(Gigacage::tryMalloc(Gigacage::JSValue, checkedSize));
9797
if (!newBuffer)
9898
return Status::Overflowed;
99-
for (int i = 0; i < m_size; ++i) {
99+
for (unsigned i = 0; i < m_size; ++i) {
100100
newBuffer[i] = m_buffer[i];
101101
addMarkSet(JSValue::decode(m_buffer[i]));
102102
}

0 commit comments

Comments
 (0)