Hi folk,
I was looking into
a bug someone reported around the extensions pageCapture.saveAsMHTML() API failing for them with file:// URLs loaded in Chrome. Looking at the
underlying code I see it is special casing the file:// URL permission check, but to determine if the page is for a file:// URL it is basically doing:
web_contents.GetPrimaryMainFrame()->GetLastCommittedOrigin().scheme() == url::kFileScheme
From what I understand Origin.scheme() returns an empty string for opaque URLs and in general file:// URLs are opaque, so it seems like this is not a good way to check if the page is for a file:// URL. Is there a recommended better way to check this?
Also worth noting that I can't seem to reproduce the bug locally with an unpacked extension and we even
have a test for this, so I'm not exactly sure what case the origin ends up opaque and where this is going wrong for the reporter.