Repository: dotnet/runtime
File: src/native/corehost/browserhost/loader/assets.ts (TypeScript)

Code before:
}

export async function fetchDll(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "assembly";
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;

    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.registerDllBytes(bytes, asset);
    }
}

export async function fetchPdb(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "pdb";
    assetInternal.isOptional == assetInternal.isOptional || loaderConfig.ignorePdbLoadErrors;
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;

    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.registerPdbBytes(bytes, asset);
    }
}

export async function fetchVfs(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "vfs";
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;
    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.installVfsFile(bytes, asset);
    }
}

async function fetchBytes(asset: AssetEntryInternal): Promise<Uint8Array | null> {

Review comment (bug):
The double equals operator (==) should be a single equals (=) for assignment. This line attempts to set isOptional but incorrectly uses a comparison operator, which will always evaluate to the current value of isOptional and have no effect.
```suggestion
    assetInternal.isOptional = assetInternal.isOptional || loaderConfig.ignorePdbLoadErrors;
```

Code after:
}

export async function fetchDll(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "assembly";
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;

    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.registerDllBytes(bytes, asset);
    }
}

export async function fetchPdb(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "pdb";
    assetInternal.isOptional = assetInternal.isOptional || loaderConfig.ignorePdbLoadErrors;
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;

    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.registerPdbBytes(bytes, asset);
    }
}

export async function fetchVfs(asset: AssemblyAsset): Promise<void> {
    totalAssetsToDownload++;
    const assetInternal = asset as AssetEntryInternal;
    if (assetInternal.name && !asset.resolvedUrl) {
        asset.resolvedUrl = locateFile(assetInternal.name);
    }
    assetInternal.behavior = "vfs";
    const bytes = await fetchBytes(assetInternal);
    await nativeModulePromiseController.promise;
    onDownloadedAsset();
    if (bytes) {
        dotnetBrowserHostExports.installVfsFile(bytes, asset);
    }
}

async function fetchBytes(asset: AssetEntryInternal): Promise<Uint8Array | null> {