-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jquery/attributes.html is flaky fail with StreamClientConnection ASSE…
…RTION FAILED: !m_connection->isValid() https://bugs.webkit.org/show_bug.cgi?id=261555 rdar://115494068 Reviewed by Antti Koivisto. Fix two tests that create StreamClientConnection instances through the JS IPC Testing API. The connections must be invalidated if they are created. Both allow and deny tests are run as normal JS business as usual, even though the test runner automatically ends the deny test when GPUP crashes. This means that the JS GC will clean up the stream connections during the next tests, causing unrelated tests to fail with the assertion. Fix the allow test to actually test what it tests, e.g. to fail if WebGPU is disabled. * LayoutTests/ipc/restrictedendpoints/allow-access-webGPU-expected.txt: * LayoutTests/ipc/restrictedendpoints/allow-access-webGPU.html: * LayoutTests/ipc/restrictedendpoints/deny-access-webGPU.html: * LayoutTests/resources/ipc.js: (randomID): (asyncFlush): (syncFlush): Deleted. * Source/WebKit/Shared/IPCTester.cpp: (WebKit::IPCTester::asyncPing): (WebKit::IPCTester::syncPing): * Source/WebKit/Shared/IPCTester.h: * Source/WebKit/Shared/IPCTester.messages.in: Canonical link: https://commits.webkit.org/268086@main
- Loading branch information
1 parent
ab8e3bc
commit c0a9a95
Showing
10 changed files
with
135 additions
and
122 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
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/allow-access-webGPU-expected.txt
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
CONSOLE MESSAGE: PASS: Test runner did not detect GPUP crash. | ||
|
108 changes: 56 additions & 52 deletions
108
LayoutTests/ipc/restrictedendpoints/allow-access-webGPU.html
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 |
---|---|---|
@@ -1,63 +1,67 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true WebGPUEnabled=true ] --> | ||
<title>Test that instantiating a remoteGPU is allowed if WebGPUEnabled</title> | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false WebGPUEnabled=true runSingly=true ] --> | ||
<title>Test that instantiating a remoteGPU is allowed if WebGPUEnabled=true</title> | ||
<script src="../../resources/ipc.js"></script> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
if (window.IPC) { | ||
function randomID() { | ||
return Math.floor(Math.random() * 10000) + 1; | ||
} | ||
|
||
function sleep(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
|
||
let renderingBackendID = randomID(); | ||
let webgpuID = randomID(); | ||
let semaphore = IPC.createSemaphore(); | ||
|
||
let connectionIdentifier = IPC.createSharedMemory(0x1000); | ||
|
||
let connectionPair = IPC.createConnectionPair(); | ||
let streamConnection = IPC.createStreamClientConnection(16); | ||
let webgpuStreamConnection = IPC.createStreamClientConnection(16); | ||
testRunner.dumpAsText(); | ||
if (window.IPC) | ||
runTest(); | ||
|
||
function runTest() { | ||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
let rrbStreamConnection; | ||
let rrbStreamConnectionHandle; | ||
let webGPUStreamConnection; | ||
let webGPUStreamConnectionHandle; | ||
try { | ||
[rrbStreamConnection, rrbStreamConnectionHandle] = IPC.createStreamClientConnection(16); | ||
let renderingBackendID = randomIPCID(); | ||
IPC.sendMessage( | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, | ||
[ | ||
{ // creationParameters | ||
type: 'RemoteRenderingBackendCreationParameters', | ||
identifier: renderingBackendID, | ||
pageProxyID: IPC.webPageProxyID, | ||
pageID: IPC.pageID, | ||
}, | ||
{ // connectionIdentifier | ||
type: 'StreamServerConnectionHandle', | ||
value: streamConnection[1], | ||
} | ||
] | ||
); | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, | ||
[ | ||
{ // creationParameters | ||
type: 'RemoteRenderingBackendCreationParameters', | ||
identifier: renderingBackendID, | ||
pageProxyID: IPC.webPageProxyID, | ||
pageID: IPC.pageID, | ||
}, | ||
{ | ||
type: 'StreamServerConnectionHandle', | ||
value: rrbStreamConnectionHandle, | ||
} | ||
]); | ||
|
||
let webGPUID = randomIPCID(); | ||
[webGPUStreamConnection, webGPUStreamConnectionHandle] = IPC.createStreamClientConnection(16); | ||
var result = IPC.sendMessage( | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name, | ||
[ | ||
{ type: 'uint64_t', value: webgpuID }, // identifier | ||
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier | ||
{ type: 'StreamServerConnectionHandle', value: streamConnection[1] }, // stream | ||
] | ||
); | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name, | ||
[ | ||
{ type: 'uint64_t', value: webGPUID }, // identifier | ||
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier | ||
{ type: 'StreamServerConnectionHandle', value: webGPUStreamConnectionHandle }, // stream | ||
]); | ||
|
||
asyncFlush('GPU').then(() => { | ||
testRunner.notifyDone(); | ||
}); | ||
} else { | ||
testRunner.notifyDone(); | ||
const success = syncFlush('GPU'); | ||
if (!success) | ||
console.log("FAIL: Failed to flush GPU process commands"); | ||
// FIXME: currently we cannot detect that GPUP crashes and test runner doesn't | ||
// let the test continue if the subprocesses crash. | ||
setTimeout(() => { | ||
console.log("PASS: Test runner did not detect GPUP crash."); | ||
if (window.testRunner) | ||
testRunner.notifyDone() | ||
}, 300); | ||
} finally { | ||
if (rrbStreamConnection) | ||
rrbStreamConnection.invalidate(); | ||
if (webGPUStreamConnection) | ||
webGPUStreamConnection.invalidate(); | ||
} | ||
} | ||
</script> | ||
</body> |
111 changes: 56 additions & 55 deletions
111
LayoutTests/ipc/restrictedendpoints/deny-access-webGPU.html
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 |
---|---|---|
@@ -1,66 +1,67 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false WebGPUEnabled=false ] --> | ||
<title>Test that instantiating a remoteGPU is allowed if WebGPUEnabled</title> | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false WebGPUEnabled=false runSingly=true ] --> | ||
<title>Test that instantiating a remoteGPU is not allowed if WebGPUEnabled=false</title> | ||
<script src="../../resources/ipc.js"></script> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
testRunner.dumpAsText(); | ||
|
||
if (window.IPC) { | ||
function randomID() { | ||
return Math.floor(Math.random() * 10000) + 1; | ||
} | ||
|
||
function sleep(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
|
||
let renderingBackendID = randomID(); | ||
let webgpuID = randomID(); | ||
let semaphore = IPC.createSemaphore(); | ||
|
||
let connectionIdentifier = IPC.createSharedMemory(0x1000); | ||
|
||
let connectionPair = IPC.createConnectionPair(); | ||
let streamConnection = IPC.createStreamClientConnection(16); | ||
let webgpuStreamConnection = IPC.createStreamClientConnection(16); | ||
console.log("HERE") | ||
testRunner.dumpAsText(); | ||
if (window.IPC) | ||
runTest(); | ||
|
||
function runTest() { | ||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
let rrbStreamConnection; | ||
let rrbStreamConnectionHandle; | ||
let webGPUStreamConnection; | ||
let webGPUStreamConnectionHandle; | ||
try { | ||
[rrbStreamConnection, rrbStreamConnectionHandle] = IPC.createStreamClientConnection(16); | ||
let renderingBackendID = randomIPCID(); | ||
IPC.sendMessage( | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, | ||
[ | ||
{ // creationParameters | ||
type: 'RemoteRenderingBackendCreationParameters', | ||
identifier: renderingBackendID, | ||
pageProxyID: IPC.webPageProxyID, | ||
pageID: IPC.pageID, | ||
}, | ||
{ // connectionIdentifier | ||
type: 'StreamServerConnectionHandle', | ||
value: streamConnection[1], | ||
} | ||
] | ||
); | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name, | ||
[ | ||
{ // creationParameters | ||
type: 'RemoteRenderingBackendCreationParameters', | ||
identifier: renderingBackendID, | ||
pageProxyID: IPC.webPageProxyID, | ||
pageID: IPC.pageID, | ||
}, | ||
{ | ||
type: 'StreamServerConnectionHandle', | ||
value: rrbStreamConnectionHandle, | ||
} | ||
]); | ||
|
||
let webGPUID = randomIPCID(); | ||
[webGPUStreamConnection, webGPUStreamConnectionHandle] = IPC.createStreamClientConnection(16); | ||
var result = IPC.sendMessage( | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name, | ||
[ | ||
{ type: 'uint64_t', value: webgpuID }, // identifier | ||
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier | ||
{ type: 'StreamServerConnectionHandle', value: streamConnection[1] }, // stream | ||
] | ||
); | ||
'GPU', | ||
IPC.webPageProxyID, | ||
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name, | ||
[ | ||
{ type: 'uint64_t', value: webGPUID }, // identifier | ||
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier | ||
{ type: 'StreamServerConnectionHandle', value: webGPUStreamConnectionHandle }, // stream | ||
]); | ||
|
||
syncFlush('GPU'); | ||
console.log("PASS: Will pass if test runner ends the test prematurely."); | ||
|
||
asyncFlush('GPU').then(() => { | ||
console.log("Should have crashed!"); | ||
}); | ||
} else { | ||
testRunner.notifyDone(); | ||
// FIXME: currently we cannot detect that GPUP crashes and test runner doesn't | ||
// let the test continue if the subprocesses crash. | ||
setTimeout(() => { | ||
console.log("FAIL: test runner should have detected GPUP crash."); | ||
if (window.testRunner) | ||
testRunner.notifyDone() | ||
}, 1000); | ||
} finally { | ||
if (rrbStreamConnection) | ||
rrbStreamConnection.invalidate(); | ||
if (webGPUStreamConnection) | ||
webGPUStreamConnection.invalidate(); | ||
} | ||
} | ||
</script> | ||
</body> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
function randomIPCID() { | ||
return Math.floor(Math.random() * 10000) + 1; | ||
} | ||
|
||
function asyncFlush(processTarget) { | ||
if (!IPC.processTargets.includes(processTarget)) | ||
throw Error("Invalid processTarget passed to asyncFlush") | ||
return IPC.sendMessage(processTarget, 0, IPC.messages.IPCTester_AsyncPing.name, []) | ||
return IPC.sendMessage(processTarget, 0, IPC.messages.IPCTester_AsyncPing.name, [{type: "uint32_t", value: 88}]); | ||
} | ||
|
||
function syncFlush(processTarget) { | ||
if (!IPC.processTargets.includes(processTarget)) | ||
throw Error("Invalid processTarget passed to syncFlush") | ||
return new Promise((resolve) => { | ||
IPC.sendSyncMessage(processTarget, 0, IPC.messages.IPCTester_SyncPing.name, 1000, []); | ||
resolve(); | ||
}) | ||
|
||
let reply = IPC.sendSyncMessage(processTarget, 0, IPC.messages.IPCTester_SyncPing.name, 1000, [{type: "uint32_t", value: 77}]); | ||
const firstResult = reply.arguments[0]; | ||
return firstResult.type == "uint32_t" && firstResult.value == 78; | ||
} |
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