-
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.
Runtime reachability of IPC endpoints should be defined within the .m…
…essages.in files https://bugs.webkit.org/show_bug.cgi?id=259552 rdar://112970535 Reviewed by Alex Christensen. We should define the runtime reachability of IPC endpoints consistently within the .messages.in files. Previously, this was achieved by a series of MESSAGE_CHECKS placed within the receiving handlers. This change introduces an [EnabledIf=""] attribute, which can be used within the .messages.in files, which defines additional criteria which must be met at runtime in order for the receiving handler to be invoked. Any messages received which don't satisfy the additional criteria are dropped the same way as if the endpoint had received a message it didn't know about. * LayoutTests/TestExpectations: * LayoutTests/ipc/restrictedendpoints/allow-access-attachmentElement-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/allow-access-attachmentElement.html: Added. * LayoutTests/ipc/restrictedendpoints/allow-access-modelElement-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/allow-access-modelElement.html: Added. * LayoutTests/ipc/restrictedendpoints/allow-access-webGPU-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/allow-access-webGPU.html: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-attachmentElement-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-attachmentElement.html: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-modelElement-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-modelElement.html: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-updateQuotaBasedOnSpaceUsageForTesting-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-webGPU-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-webGPU.html: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-webPush-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/deny-access-webPush.html: * LayoutTests/ipc/restrictedendpoints/no-test-only-ipc-expected-crash-expected.txt: Added. * LayoutTests/ipc/restrictedendpoints/no-test-only-ipc-expected-crash.html: * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h: (WebKit::GPUConnectionToWebProcess::isWebGPUEnabled): (WebKit::GPUConnectionToWebProcess::isWebGLEnabled): (WebKit::GPUConnectionToWebProcess::updateWebGLEnabled): * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in: * Source/WebKit/GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::updateWebGLEnabled): * Source/WebKit/GPUProcess/GPUProcess.h: * Source/WebKit/GPUProcess/GPUProcess.messages.in: * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp: (WebKit::RemoteAudioSessionProxy::allowTestOnlyIPC): * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h: * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.messages.in: * Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in: * Source/WebKit/Scripts/webkit/messages.py: (async_message_statement): (sync_message_statement): * Source/WebKit/Scripts/webkit/model.py: (Message.__init__): * Source/WebKit/Scripts/webkit/parser.py: (parse): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::updateWebGLEnabled): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::m_limitsNavigationsToAppBoundDomains): (WebKit::WebPageProxy::attachmentElementEnabled): (WebKit::WebPageProxy::modelElementEnabled): (WebKit::WebPageProxy::launchProcess): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebPageProxy.messages.in: * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::addExistingWebPage): (WebKit::WebProcessProxy::removeWebPage): (WebKit::WebProcessProxy::updatePreferencesEnabledStateInGPUProcess): (WebKit::WebProcessProxy::updateWebGPUEnabledStateInGPUProcess): Deleted. * Source/WebKit/UIProcess/WebProcessProxy.h: Canonical link: https://commits.webkit.org/267014@main
- Loading branch information
1 parent
f3caa42
commit 35edbfd
Showing
51 changed files
with
611 additions
and
77 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-attachmentElement-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
28 changes: 28 additions & 0 deletions
28
LayoutTests/ipc/restrictedendpoints/allow-access-attachmentElement.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false AttachmentElementEnabled=true ] --> | ||
<title>Test that calling into attachmentElement specific methods, like RegisterAttachmentIdentifier, is enabled if AttachmentElementEnabled is true</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
testRunner.dumpAsText(); | ||
|
||
if (window.IPC) { | ||
IPC.sendMessage( | ||
'UI', | ||
IPC.webPageProxyID, | ||
IPC.messages.WebPageProxy_RegisterAttachmentIdentifier.name, | ||
[ | ||
{ | ||
type: 'String', | ||
value: 'Some UUID' | ||
} | ||
] | ||
); | ||
|
||
setTimeout(()=>{testRunner.notifyDone();}, 100) | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
|
||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/allow-access-modelElement-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
27 changes: 27 additions & 0 deletions
27
LayoutTests/ipc/restrictedendpoints/allow-access-modelElement.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false ModelElementEnabled=true ] --> | ||
<title>Test that calling into modelElement specific methods, like ModelElementDestroyRemotePreview, is enabled if ModelElementEnabled is true</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
testRunner.dumpAsText(); | ||
|
||
if (window.IPC) { | ||
IPC.sendMessage( | ||
'UI', | ||
IPC.webPageProxyID, | ||
IPC.messages.WebPageProxy_ModelElementDestroyRemotePreview.name, | ||
[ | ||
{ | ||
type: 'String', | ||
value: 'Some UUID' | ||
} | ||
] | ||
); | ||
|
||
setTimeout(()=>{testRunner.notifyDone();}, 100); | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</body> |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
60 changes: 60 additions & 0 deletions
60
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true WebGPUEnabled=true ] --> | ||
<title>Test that instantiating a remoteGPU is allowed if WebGPUEnabled</title> | ||
<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); | ||
|
||
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], | ||
} | ||
] | ||
); | ||
|
||
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 | ||
] | ||
); | ||
|
||
setTimeout(()=>{testRunner.notifyDone();}, 100) | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/deny-access-attachmentElement-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
36 changes: 36 additions & 0 deletions
36
LayoutTests/ipc/restrictedendpoints/deny-access-attachmentElement.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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false AttachmentElementEnabled=false ] --> | ||
<title>Test that calling into attachmentElement specific methods, like RegisterAttachmentIdentifier, is disabled if AttachmentElementEnabled is false</title> | ||
<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)); | ||
} | ||
|
||
IPC.sendMessage( | ||
'UI', | ||
IPC.webPageProxyID, | ||
IPC.messages.WebPageProxy_RegisterAttachmentIdentifier.name, | ||
[ | ||
{ | ||
type: 'String', | ||
value: 'Some UUID' | ||
} | ||
] | ||
); | ||
|
||
setTimeout(()=>{console.log("Should Have Crashed!"); testRunner.notifyDone();}, 100) | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/deny-access-modelElement-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
27 changes: 27 additions & 0 deletions
27
LayoutTests/ipc/restrictedendpoints/deny-access-modelElement.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false ModelElementEnabled=false ] --> | ||
<title>Test that calling into modelElement specific methods, like ModelElementDestroyRemotePreview, is disabled if ModelElementEnabled is false</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
testRunner.dumpAsText(); | ||
|
||
if (window.IPC) { | ||
IPC.sendMessage( | ||
'UI', | ||
IPC.webPageProxyID, | ||
IPC.messages.WebPageProxy_ModelElementDestroyRemotePreview.name, | ||
[ | ||
{ | ||
type: 'String', | ||
value: 'Some UUID' | ||
} | ||
] | ||
); | ||
|
||
setTimeout(()=>{console.log("Should Have Crashed!"); testRunner.notifyDone();}, 100) | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</body> |
3 changes: 3 additions & 0 deletions
3
...s/ipc/restrictedendpoints/deny-access-updateQuotaBasedOnSpaceUsageForTesting-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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS Send updateQuotaBasedOnSpaceUsage without AllowTestOnlyIPC being set | ||
|
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/deny-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 |
---|---|---|
@@ -0,0 +1 @@ | ||
|
63 changes: 63 additions & 0 deletions
63
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ IPCTestingAPIEnabled=true IgnoreInvalidMessageWhenIPCTestingAPIEnabled=false WebGPUEnabled=false ] --> | ||
<title>Test that instantiating a remoteGPU is allowed if WebGPUEnabled</title> | ||
<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") | ||
|
||
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], | ||
} | ||
] | ||
); | ||
|
||
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 | ||
] | ||
); | ||
|
||
setTimeout(()=>{console.log("Should Have Crashed!"); testRunner.notifyDone();}, 100) | ||
} else { | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</body> |
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/deny-access-webPush-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 |
---|---|---|
@@ -0,0 +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
1 change: 1 addition & 0 deletions
1
LayoutTests/ipc/restrictedendpoints/no-test-only-ipc-expected-crash-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 |
---|---|---|
@@ -0,0 +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
2 changes: 0 additions & 2 deletions
2
...tTests/platform/glib/ipc/restrictedendpoints/no-test-only-ipc-expected-crash-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,3 +1 @@ | ||
|
||
PASS Send beginAudioSessionInterruption without AllowTestOnlyIPC being set | ||
|
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
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
Oops, something went wrong.