Merge commit '8fef2aa64ec1ee742e8b70b825938d30a0ea7319' into HEAD
This commit is contained in:
Vendored
+3
@@ -28,6 +28,7 @@ export const startFakeCdpBrowser = async (
|
||||
referer: string | undefined;
|
||||
}[] = [];
|
||||
const sockets = new Set<WebSocket>();
|
||||
let openedConnections = 0;
|
||||
let frameTreeReads = 0;
|
||||
let port = 0;
|
||||
const http = createServer((request, response) => {
|
||||
@@ -85,6 +86,7 @@ export const startFakeCdpBrowser = async (
|
||||
});
|
||||
webSockets.on("connection", (socket: WebSocket, request: IncomingMessage) => {
|
||||
const directPage = request.url?.startsWith("/devtools/page/") === true;
|
||||
openedConnections += 1;
|
||||
sockets.add(socket);
|
||||
socket.on("close", () => sockets.delete(socket));
|
||||
socket.on("message", (raw) => {
|
||||
@@ -142,6 +144,7 @@ export const startFakeCdpBrowser = async (
|
||||
allowedOrigin: endpoint,
|
||||
commands,
|
||||
activeConnectionCount: () => sockets.size,
|
||||
openedConnectionCount: () => openedConnections,
|
||||
emitRawMessage(message) {
|
||||
for (const socket of sockets) socket.send(message);
|
||||
},
|
||||
|
||||
+11
@@ -24,6 +24,8 @@ export const resultFor = (
|
||||
return responseBodyResult(options);
|
||||
case "Page.captureScreenshot":
|
||||
return screenshotResult();
|
||||
case "Browser.getVersion":
|
||||
return browserVersionResult();
|
||||
case "Target.getTargets":
|
||||
return { targetInfos: targets(port, options).map(endpointTargetToInfo) };
|
||||
case "Storage.getUsageAndQuota":
|
||||
@@ -66,6 +68,15 @@ export const resultFor = (
|
||||
}
|
||||
};
|
||||
|
||||
/** Chrome's browser-socket reply shape, mirroring the fake's `/json/version`. */
|
||||
const browserVersionResult = () => ({
|
||||
protocolVersion: "1.3",
|
||||
product: "FakeChrome/1.0",
|
||||
revision: "@fake-revision",
|
||||
userAgent: "FakeChrome",
|
||||
jsVersion: "13.0",
|
||||
});
|
||||
|
||||
const attachToTargetResult = (options: FakeOptions) => ({
|
||||
sessionId: options.invalidAttachedSession ? "" : "session-1",
|
||||
});
|
||||
|
||||
+2
@@ -13,6 +13,8 @@ export interface FakeCdpBrowser {
|
||||
readonly commands: readonly FakeCdpCommand[];
|
||||
/** Actual WebSocket connections still held by the wire fixture. */
|
||||
activeConnectionCount(): number;
|
||||
/** WebSocket upgrades accepted over the fixture's lifetime. */
|
||||
openedConnectionCount(): number;
|
||||
/** Deliver actual malformed wire data without bypassing the production transport parser. */
|
||||
emitRawMessage(message: string): void;
|
||||
emitEvent(event: {
|
||||
|
||||
@@ -37,6 +37,19 @@ import rows from `xcrun dyld_info -imports /usr/lib/libobjc.A.dylib`.
|
||||
`xcrun dyld_info -exports /usr/lib/libc++.1.dylib`. These are separate library
|
||||
captures used to check their respective row formats.
|
||||
|
||||
`renamed-reexports.txt` is `xcrun dyld_info -exports` for a dylib that
|
||||
re-exports `_foo` from `libfoo` under the name `_foo_renamed`:
|
||||
|
||||
```sh
|
||||
printf 'int foo(void){return 1;}\n' > /tmp/foo.c
|
||||
printf 'int own(void){return 2;}\n' > /tmp/re.c
|
||||
xcrun clang -dynamiclib /tmp/foo.c -o /tmp/libfoo.dylib -install_name @rpath/libfoo.dylib
|
||||
xcrun clang -dynamiclib /tmp/re.c -o /tmp/libre.dylib -install_name @rpath/libre.dylib \
|
||||
/tmp/libfoo.dylib -Wl,-alias,_foo,_foo_renamed
|
||||
xcrun dyld_info -exports /tmp/libre.dylib
|
||||
xcrun nm -gjU /tmp/libre.dylib
|
||||
```
|
||||
|
||||
`codesign-missing.txt` is stderr from `codesign -d --verbose=4` on a nonexistent
|
||||
path (exit 1). `codesign-unsigned.txt` is stderr from the same command on a copy
|
||||
of the fixture after `codesign --remove-signature` (exit 1). Only the latter is
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
fixture [arm64]:
|
||||
-exports:
|
||||
offset symbol
|
||||
[re-export] _foo_renamed (_foo from libfoo)
|
||||
0x00000308 _own
|
||||
Reference in New Issue
Block a user