-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Direct Sockets: stub implementations for openTCPSocket openUDPSocket
The rename is tentative, blocked on naming decision WICG/direct-sockets#10 Explainer: https://github.com/WICG/raw-sockets/blob/master/docs/explainer.md Intent to Prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/ARtkaw4e9T4/m/npjeMssPCAAJ Design doc: https://docs.google.com/document/d/1Xa5nFkIWxkL3hZHvDYWPhT8sZvNeFpCUKNuqIwZHxnE/edit?usp=sharing We introduce IDL methods for opening TCP and UDP sockets. We introduce a mojom service that will perform permission checks before forwarding socket opening requests to the Network Service. Not yet implemented: Permissions checks, calls to Network Service Bug: 909927 Change-Id: Ifec9860d4e0b8211af7b142b856efc29cd6f9b35
- Loading branch information
1 parent
8adc6cb
commit a77ecce
Showing
4 changed files
with
62 additions
and
0 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,5 @@ | ||
spec: https://github.com/WICG/raw-sockets/blob/master/docs/explainer.md | ||
suggested_reviewers: | ||
- ewilligers | ||
- mgiuca | ||
- phoglenix |
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,2 @@ | ||
These tests are for the TCP and UDP sockets API proposed in | ||
https://github.com/WICG/raw-sockets/blob/master/docs/explainer.md |
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,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Sockets test: Open from non-secure context</title> | ||
<link rel="help" href="https://github.com/WICG/raw-sockets/blob/master/docs/explainer.md#security-considerations"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
test(() => { | ||
assert_false('openTCPSocket' in navigator, 'navigator has attribute \'openTCPSocket\'.'); | ||
}, 'navigator.openTCPSocket must be undefined in non-secure context'); | ||
|
||
test(() => { | ||
assert_false('openUDPSocket' in navigator, 'navigator has attribute \'openUDPSocket\'.'); | ||
}, 'navigator.openUDPSocket must be undefined in non-secure context'); | ||
</script> | ||
</body> | ||
</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,34 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Sockets test: open without remotePort</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
'use strict'; | ||
|
||
const options = { | ||
localAddress: "127.0.0.1", | ||
localPort: 0, | ||
remoteAddress: "127.0.0.1", | ||
}; | ||
|
||
test(() => { | ||
assert_throws_js(TypeError, () => { navigator.openTCPSocket() }); | ||
assert_throws_js(TypeError, () => { navigator.openTCPSocket(null) }); | ||
assert_throws_js(TypeError, () => { navigator.openTCPSocket(undefined) }); | ||
assert_throws_js(TypeError, () => { navigator.openTCPSocket(options) }); | ||
}, 'openTCPSocket requires remotePort'); | ||
|
||
test(() => { | ||
assert_throws_js(TypeError, () => { navigator.openUDPSocket() }); | ||
assert_throws_js(TypeError, () => { navigator.openUDPSocket(null) }); | ||
assert_throws_js(TypeError, () => { navigator.openUDPSocket(undefined) }); | ||
assert_throws_js(TypeError, () => { navigator.openTCPSocket(options) }); | ||
}, 'openUDPSocket requires remotePort'); | ||
</script> | ||
</body> | ||
</html> |