remove old backstage injection and remove all legacy code
This commit is contained in:
@@ -1750,12 +1750,8 @@ func findReflectiveLoaderOffset(pe []byte) (uint32, error) {
|
||||
// BackstageInjection reflective loader entry. The loader entry is exported
|
||||
// under a per-build random name of the form "x" + six lowercase hex digits
|
||||
// (generated by the DLL's build.rs), so a fixed string cannot be used to
|
||||
// find it. The legacy fixed name is still accepted so DLL artifacts produced
|
||||
// by older builds keep working.
|
||||
// find it.
|
||||
func isBackstageLoaderExport(name string) bool {
|
||||
if name == "ReflectiveLoader" {
|
||||
return true
|
||||
}
|
||||
if len(name) != 7 || name[0] != 'x' {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ func TestGetProcessesLockingFileShortPathDoesNotPanic(t *testing.T) {
|
||||
_ = getProcessesLockingFile("a")
|
||||
}
|
||||
|
||||
func TestIsBackstageLoaderExportSupportsBothCommandVersions(t *testing.T) {
|
||||
for _, name := range []string{"ReflectiveLoader", "x012abc", "xffffff"} {
|
||||
func TestIsBackstageLoaderExportAcceptsRandomizedExport(t *testing.T) {
|
||||
for _, name := range []string{"x012abc", "xffffff"} {
|
||||
if !isBackstageLoaderExport(name) {
|
||||
t.Fatalf("expected loader export %q to be accepted", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"reflectiveloader", "x012ABc", "x12345", "x1234567", "other"} {
|
||||
for _, name := range []string{"ReflectiveLoader", "reflectiveloader", "x012ABc", "x12345", "x1234567", "other"} {
|
||||
if isBackstageLoaderExport(name) {
|
||||
t.Fatalf("expected loader export %q to be rejected", name)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package wire
|
||||
|
||||
const (
|
||||
WireSchemaVersion = 1
|
||||
WireSchemaVersion = 2
|
||||
WireProtocolVersion = 1
|
||||
)
|
||||
|
||||
@@ -456,10 +456,10 @@ var CommandVersionSupport = map[CommandType]CommandVersionRange{
|
||||
CommandBackstageSetQuality: {Min: 1, Max: 1},
|
||||
CommandBackstageSetResolution: {Min: 1, Max: 1},
|
||||
CommandBackstageStart: {Min: 1, Max: 1},
|
||||
CommandBackstageStartBrowserInjected: {Min: 1, Max: 2},
|
||||
CommandBackstageStartChromeInjected: {Min: 1, Max: 2},
|
||||
CommandBackstageStartBrowserInjected: {Min: 2, Max: 3},
|
||||
CommandBackstageStartChromeInjected: {Min: 2, Max: 3},
|
||||
CommandBackstageStartProcess: {Min: 1, Max: 1},
|
||||
CommandBackstageStartProcessInjected: {Min: 1, Max: 2},
|
||||
CommandBackstageStartProcessInjected: {Min: 2, Max: 3},
|
||||
CommandBackstageStop: {Min: 1, Max: 1},
|
||||
CommandBackstageWindowList: {Min: 1, Max: 1},
|
||||
CommandClientLogsRequest: {Min: 1, Max: 1},
|
||||
|
||||
@@ -17,20 +17,23 @@ func TestGeneratedWireContract(t *testing.T) {
|
||||
if !ok {
|
||||
t.Fatalf("missing version range for %s", command)
|
||||
}
|
||||
wantMax := 1
|
||||
wantMin, wantMax := 1, 1
|
||||
switch command {
|
||||
case CommandBackstageStartBrowserInjected, CommandBackstageStartChromeInjected, CommandBackstageStartProcessInjected:
|
||||
wantMax = 2
|
||||
wantMin, wantMax = 2, 3
|
||||
}
|
||||
if versionRange.Min != 1 || versionRange.Max != wantMax {
|
||||
if versionRange.Min != wantMin || versionRange.Max != wantMax {
|
||||
t.Fatalf("unexpected version range for %s: %+v", command, versionRange)
|
||||
}
|
||||
if !IsSupportedCommandVersion(string(command), 1) {
|
||||
t.Fatalf("%s must support v1", command)
|
||||
if IsSupportedCommandVersion(string(command), 1) != (wantMin == 1) {
|
||||
t.Fatalf("unexpected v1 support for %s", command)
|
||||
}
|
||||
if IsSupportedCommandVersion(string(command), 2) != (wantMax == 2) {
|
||||
if IsSupportedCommandVersion(string(command), 2) != (wantMin <= 2 && wantMax >= 2) {
|
||||
t.Fatalf("unexpected v2 support for %s", command)
|
||||
}
|
||||
if IsSupportedCommandVersion(string(command), 3) != (wantMin <= 3 && wantMax >= 3) {
|
||||
t.Fatalf("unexpected v3 support for %s", command)
|
||||
}
|
||||
}
|
||||
if !IsCommandType("desktop_start") {
|
||||
t.Fatal("desktop_start must be a known command")
|
||||
|
||||
Reference in New Issue
Block a user