如何为在不同主机但相同二级域上提供的 iframe 强制 Chrome 的“站点隔离”?

ych*_*hed 6 google-chrome chromium

我有一个在http://foo.example.com/page上提供的页面,它嵌入了一个在http://bar.example.com/iframe 上提供的 iframe 。出于性能原因,我想使用 Chrome 的“站点隔离”(自 Chrome 67 以来默认启用)在与主页面不同的线程中呈现 iframe。

但是,这种“站点隔离”行为似乎仅在主页和 iframe 服务于不同的二级域(例如 foo.example.com 和 bar.otherexample.com)时才会触发

chrome://process-internals/#web-contents 的调试页面显示以下内容:

如果 foo.example.com 上的页面 / bar.otherexample.com 上的 iframe :

Frame: locked, site:http://example.com/ | url: http://foo.example.com/page
? Frame: locked, site:http://otherexample.com/ | url: http://bar.otherexample.com/iframe
Run Code Online (Sandbox Code Playgroud)

这两个框架具有不同的“站点”--> 我可以在 Chrome 的任务管理器中看到 iframe的单独“子框架:站点:http : //otherexample.com/ ”进程。

如果 foo.example.com 上的页面 / bar.example.com 上的 iframe :

Frame: locked, site:http://example.com/ | url: http://foo.example.com/page
? Frame: locked, site:http://example.com/ | url: http://bar.example.com/iframe
Run Code Online (Sandbox Code Playgroud)

这两个框架具有相同的“站点”--> iframe 没有“子框架”过程。

有什么方法可以提示 Chrome 将 foo.example.com/page 和 bar.example.com/iframe 视为不同的“站点”?

(FWIW,在我的浏览器中碰巧打开的其他随机选项卡上,我确实看到“子框架”进程被拆分为“站点”被列为https://content.googleapis.com/https://accounts 的框架。 google.com/ - 也就是说,考虑到第 3 级域。不过,它们恰好是 Google URL,所以我不知道这是否是某些特定的硬编码行为?)