function testRendererNavigationRedirectWhileUnattached() {
  var webview = document.createElement('webview');
  // So that |webview| is unattached, but can navigate.
  webview.style.display = 'none';

  var seenRedirectURLCommit = false;
  var seenRedirectLoadStop = false;

  var checkTest = function() {
    if (seenRedirectLoadStop && seenRedirectURLCommit) {
      embedder.test.succeed();
    }
  };

  webview.onloadstop = function(e) {

    webview.onloadstop = function() {
      webview.onloadstop = null;
      seenRedirectLoadStop = true;
      checkTest();
    };
    webview.executeScript({
      code: 'window.location.href="' + embedder.redirectGuestURL + '"',
    }, function(res) {
      if (!res || !res.length) {
        embedder.test.fail();
        return;
      }
    });
  };

  webview.onloadcommit = function(e) {
    if (e.url.indexOf(GUEST_REDIRECT_FILE_NAME) != -1) {
      seenRedirectURLCommit = true;
      checkTest();
    }
  };
  document.body.appendChild(webview);
  webview.src = 'about:blank';
}
// end we verify that the redirected URL loads in the guest properly.
end we verify that the redirected URL loads in the guest properly.
end we verify that the redirected URL loads in the guest properly .
function testRendererNavigationRedirectWhileUnattached() {
  var webview = document.createElement('webview');
  webview.style.display = 'none';
  var seenRedirectURLCommit = false;
  var seenRedirectLoadStop = false;
  var checkTest = function() {
    if (seenRedirectLoadStop && seenRedirectURLCommit) {
      embedder.test.succeed();
    }
  };
  webview.onloadstop = function(e) {
    webview.onloadstop = function() {
      webview.onloadstop = null;
      seenRedirectLoadStop = true;
      checkTest();
    };
    webview.executeScript({
      code: 'window.location.href="' + embedder.redirectGuestURL + '"',
    }, function(res) {
      if (!res || !res.length) {
        embedder.test.fail();
        return;
      }
    });
  };
  webview.onloadcommit = function(e) {
    if (e.url.indexOf(GUEST_REDIRECT_FILE_NAME) != -1) {
      seenRedirectURLCommit = true;
      checkTest();
    }
  };
  document.body.appendChild(webview);
  webview.src = 'about:blank';
}
function testRendererNavigationRedirectWhileUnattached ( ) { var webview = document . createElement ( 'webview' ) ; webview . style . display = 'none' ; var seenRedirectURLCommit = false ; var seenRedirectLoadStop = false ; var checkTest = function ( ) { if ( seenRedirectLoadStop && seenRedirectURLCommit ) { embedder . test . succeed ( ) ; } } ; webview . onloadstop = function ( e ) { webview . onloadstop = function ( ) { webview . onloadstop = null ; seenRedirectLoadStop = true ; checkTest ( ) ; } ; webview . executeScript ( { code : 'window.location.href="' + embedder . redirectGuestURL + '"' , } , function ( res ) { if ( ! res || ! res . length ) { embedder . test . fail ( ) ; return ; } } ) ; } ; webview . onloadcommit = function ( e ) { if ( e . url . indexOf ( GUEST_REDIRECT_FILE_NAME ) != - 1 ) { seenRedirectURLCommit = true ; checkTest ( ) ; } } ; document . body . appendChild ( webview ) ; webview . src = 'about:blank' ; }
end we verify that the redirected URL loads in the guest properly.
end we verify that the redirected URL loads in the guest properly .
// So that |webview| is unattached, but can navigate.