forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/WebKit/WebKit
- Loading branch information
Showing
693 changed files
with
11,386 additions
and
4,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function sameValue(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
function test(array, value) { | ||
return array.indexOf(value); | ||
} | ||
noInline(test); | ||
|
||
print(testLoopCount); | ||
|
||
var array = [1, 2, 3.4, "foo", 5, 6, 6, 4]; | ||
for (let i = 0; i < testLoopCount; i++) { | ||
sameValue(test(array, "foo"), 3); | ||
sameValue(test(array, "bar"), -1); | ||
} |
123 changes: 123 additions & 0 deletions
123
JSTests/stress/async-from-sync-iterator-prototype-next-rejected-close-sync-iter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
function shouldBe(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
|
||
function shouldThrowAsync(run, errorType, message) { | ||
let actual; | ||
var hadError = false; | ||
run().then(function(value) { actual = value; }, | ||
function(error) { hadError = true; actual = error; }); | ||
drainMicrotasks(); | ||
if (!hadError) | ||
throw new Error("Expected " + run + "() to throw " + errorType.name + ", but did not throw."); | ||
if (!(actual instanceof errorType)) | ||
throw new Error("Expected " + run + "() to throw " + errorType.name + ", but threw '" + actual + "'"); | ||
if (message !== void 0 && actual.message !== message) | ||
throw new Error("Expected " + run + "() to throw '" + message + "', but threw '" + actual.message + "'"); | ||
} | ||
|
||
{ | ||
let finallyCount = 0; | ||
|
||
function OurError() {} | ||
|
||
function* iterator() { | ||
try { | ||
yield Promise.reject(new OurError()); | ||
} finally { | ||
finallyCount += 1; | ||
} | ||
} | ||
|
||
shouldThrowAsync(async () => { | ||
for await (const _ of iterator()); | ||
}, OurError); | ||
drainMicrotasks(); | ||
|
||
shouldBe(finallyCount, 1); | ||
} | ||
|
||
{ | ||
let returnCount = 0; | ||
|
||
function OurError() {} | ||
|
||
const syncIterator = { | ||
[Symbol.iterator]() { | ||
return { | ||
next() { | ||
return { value: Promise.reject(new OurError()), done: false }; | ||
}, | ||
return() { | ||
returnCount += 1; | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
shouldThrowAsync(async () => { | ||
for await (const _ of syncIterator); | ||
}, OurError); | ||
drainMicrotasks(); | ||
|
||
shouldBe(returnCount, 1); | ||
} | ||
|
||
{ | ||
let finallyCount = 0; | ||
|
||
function OurError() {} | ||
|
||
function* iterator() { | ||
try { | ||
yield Promise.reject(new OurError()); | ||
} finally { | ||
finallyCount += 1; | ||
} | ||
} | ||
|
||
async function* asyncIterator() { | ||
yield* iterator() | ||
} | ||
|
||
shouldThrowAsync(async () => { | ||
await asyncIterator().next(); | ||
}, OurError); | ||
drainMicrotasks(); | ||
|
||
shouldBe(finallyCount, 1); | ||
|
||
} | ||
|
||
{ | ||
let returnCount = 0; | ||
|
||
function OurError() {} | ||
|
||
const syncIterator = { | ||
[Symbol.iterator]() { | ||
return { | ||
next() { | ||
return { value: Promise.reject(new OurError()), done: false }; | ||
}, | ||
return() { | ||
returnCount += 1; | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
async function* asyncIterator() { | ||
yield* syncIterator; | ||
} | ||
|
||
shouldThrowAsync(async () => { | ||
await asyncIterator().next(); | ||
}, OurError); | ||
drainMicrotasks(); | ||
|
||
shouldBe(returnCount, 1); | ||
} | ||
|
59 changes: 59 additions & 0 deletions
59
JSTests/stress/async-from-sync-iterator-prototype-throw-rejected-close-sync-iter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
function shouldBe(a, b) { | ||
if (a !== b) | ||
throw new Error(`Expected ${b} but got ${a}`); | ||
} | ||
|
||
|
||
function shouldThrowAsync(run, errorType, message) { | ||
let actual; | ||
var hadError = false; | ||
run().then(function(value) { actual = value; }, | ||
function(error) { hadError = true; actual = error; }); | ||
drainMicrotasks(); | ||
if (!hadError) | ||
throw new Error("Expected " + run + "() to throw " + errorType.name + ", but did not throw."); | ||
if (!(actual instanceof errorType)) | ||
throw new Error("Expected " + run + "() to throw " + errorType.name + ", but threw '" + actual + "'"); | ||
if (message !== void 0 && actual.message !== message) | ||
throw new Error("Expected " + run + "() to throw '" + message + "', but threw '" + actual.message + "'"); | ||
} | ||
|
||
{ | ||
let returnCount = 0; | ||
|
||
function OurError() {} | ||
|
||
var iterator = { | ||
[Symbol.iterator]() { | ||
return { | ||
next() { | ||
return { value: 1, done: false }; | ||
}, | ||
throw() { | ||
return { | ||
value: Promise.reject(new OurError()), | ||
done: false | ||
}; | ||
}, | ||
return() { | ||
returnCount += 1; | ||
} | ||
}; | ||
} | ||
}; | ||
|
||
async function* asyncIterator() { | ||
return yield* iterator; | ||
} | ||
|
||
let iter = asyncIterator(); | ||
|
||
shouldThrowAsync(async () => { | ||
await iter.next(); | ||
await iter.throw(); | ||
}, OurError); | ||
drainMicrotasks(); | ||
|
||
shouldBe(returnCount, 1); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
JSTests/wasm/stress/init-expr-cannot-include-non-import-globals.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.