Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] don't enable appcontainer loopback on Windows 11 #875

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions packages/office-addin-debugging/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,19 +304,35 @@ export async function startDebugging(manifestPath: string, options: StartDebuggi
}

// enable loopback for Edge
if (isWindowsPlatform && parseInt(os.release(), 10) === 10) {
const name = isDesktopAppType ? "EdgeWebView" : "EdgeWebBrowser";
try {
await devSettings.ensureLoopbackIsEnabled(name);
} catch (err: any) {
// if add loopback exemption failed, report the error then continue
console.error(err)
console.warn("Failed to add loopback exemption.\nWill try to sideload the Office Add-in without the loopback exemption, but it might not load correctly from localhost.\n")
usageDataObject.reportException("startDebugging()", err, {
app: app,
document: document,
appType: appType,
});
if (isWindowsPlatform) {
let enableLoopback = false;
const [majorVersion, , releaseVersion] = os
.release()
.split(".")
.map((version) => parseInt(version, 10));

if (majorVersion === 10) {
if (releaseVersion && releaseVersion >= 18362 && releaseVersion < 20000) {
enableLoopback = true;
}
}

if (enableLoopback) {
const name = isDesktopAppType ? "EdgeWebView" : "EdgeWebBrowser";
try {
await devSettings.ensureLoopbackIsEnabled(name, false);
} catch (err: any) {
// if add loopback exemption failed, report the error then continue
console.error(err);
console.warn(
"Failed to add loopback exemption.\nWill try to sideload the Office Add-in without the loopback exemption, but it might not load correctly from localhost.\n"
);
usageDataObject.reportException("startDebugging()", err, {
app: app,
document: document,
appType: appType,
});
}
}
}

Expand Down Expand Up @@ -445,8 +461,7 @@ async function extractManifest(zipPath: string): Promise<string> {
const manifestPath = fspath.join(targetPath, "manifest.json");
if (fs.existsSync(manifestPath)) {
return manifestPath;
}
else {
} else {
throw new Error(`The zip file '${zipPath}' does not contain a "manifest.json" file`);
}
}
Loading