chromium/chrome/test/data/extensions/api_test/active_tab_file_urls/window_onload.js

window.onload = function() {
  var iframe = document.getElementById('file_iframe');
  try {
    var url = iframe.contentWindow.location.href
    if (url === 'about:blank')
      chrome.test.sendMessage('denied');
  } catch (e) {
    var expectedError =
        `Failed to read a named property 'href' from 'Location': Blocked a ` +
        `frame with origin "${window.location.origin}" from ` +
        `accessing a cross-origin frame.`;
    if (e.message === expectedError)
      chrome.test.sendMessage('allowed');
  }
};