function testLoadStartLoadRedirect() {
  var webview = document.createElement('webview');
  var loadstartCalled = false;
  webview.setAttribute('src', embedder.redirectGuestURL);
  webview.addEventListener('loadstart', function(e) {
    embedder.test.assertTrue(e.isTopLevel);
    embedder.test.assertEq(embedder.redirectGuestURL, e.url);
    loadstartCalled = true;
  });
  webview.addEventListener('loadredirect', function(e) {
    embedder.test.assertTrue(e.isTopLevel);
    embedder.test.assertEq(embedder.redirectGuestURL,
        e.oldUrl.replace('127.0.0.1', 'localhost'));
    embedder.test.assertEq(embedder.redirectGuestURLDest,
        e.newUrl.replace('127.0.0.1', 'localhost'));
    if (loadstartCalled) {
      embedder.test.succeed();
    } else {
      embedder.test.fail();
    }
  });
  document.body.appendChild(webview);
}
// and the loadredirect event fires when a redirect occurs.
and the loadredirect event fires when a redirect occurs.
and the loadredirect event fires when a redirect occurs .
function testLoadStartLoadRedirect() {
  var webview = document.createElement('webview');
  var loadstartCalled = false;
  webview.setAttribute('src', embedder.redirectGuestURL);
  webview.addEventListener('loadstart', function(e) {
    embedder.test.assertTrue(e.isTopLevel);
    embedder.test.assertEq(embedder.redirectGuestURL, e.url);
    loadstartCalled = true;
  });
  webview.addEventListener('loadredirect', function(e) {
    embedder.test.assertTrue(e.isTopLevel);
    embedder.test.assertEq(embedder.redirectGuestURL,
        e.oldUrl.replace('127.0.0.1', 'localhost'));
    embedder.test.assertEq(embedder.redirectGuestURLDest,
        e.newUrl.replace('127.0.0.1', 'localhost'));
    if (loadstartCalled) {
      embedder.test.succeed();
    } else {
      embedder.test.fail();
    }
  });
  document.body.appendChild(webview);
}
function testLoadStartLoadRedirect ( ) { var webview = document . createElement ( 'webview' ) ; var loadstartCalled = false ; webview . setAttribute ( 'src' , embedder . redirectGuestURL ) ; webview . addEventListener ( 'loadstart' , function ( e ) { embedder . test . assertTrue ( e . isTopLevel ) ; embedder . test . assertEq ( embedder . redirectGuestURL , e . url ) ; loadstartCalled = true ; } ) ; webview . addEventListener ( 'loadredirect' , function ( e ) { embedder . test . assertTrue ( e . isTopLevel ) ; embedder . test . assertEq ( embedder . redirectGuestURL , e . oldUrl . replace ( '127.0.0.1' , 'localhost' ) ) ; embedder . test . assertEq ( embedder . redirectGuestURLDest , e . newUrl . replace ( '127.0.0.1' , 'localhost' ) ) ; if ( loadstartCalled ) { embedder . test . succeed ( ) ; } else { embedder . test . fail ( ) ; } } ) ; document . body . appendChild ( webview ) ; }
and the loadredirect event fires when a redirect occurs.
and the loadredirect event fires when a redirect occurs .