function testCannotMutateEventName() {
  var webview = document.createElement('webview');
  var url = 'data:text/html,<body>Two</body>';

  var loadCommitACalled = false;
  var loadCommitBCalled = false;

  var maybeFinishTest = function(e) {
    if (loadCommitACalled && loadCommitBCalled) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.succeed();
    }
  };

  var onLoadCommitA = function(e) {
    if (e.url == url) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.assertTrue(e.isTopLevel);
      embedder.test.assertFalse(loadCommitACalled);
      loadCommitACalled = true;
      // Try mucking with properities inside |e|.
      e.type = 'modified';
      maybeFinishTest(e);
    }
  };
  var onLoadCommitB = function(e) {
    if (e.url == url) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.assertTrue(e.isTopLevel);
      embedder.test.assertFalse(loadCommitBCalled);
      loadCommitBCalled = true;
      // Try mucking with properities inside |e|.
      e.type = 'modified';
      maybeFinishTest(e);
    }
  };

  // The test starts from here, by setting the src to |url|. Event
  // listener registration works because we already have a (dummy) src set
  // on the <webview> tag.
  webview.addEventListener('loadcommit', onLoadCommitA);
  webview.addEventListener('loadcommit', onLoadCommitB);
  webview.setAttribute('src', url);
  document.body.appendChild(webview);
}
// which should not be possible.
which should not be possible.
which should not be possible .
function testCannotMutateEventName() {
  var webview = document.createElement('webview');
  var url = 'data:text/html,<body>Two</body>';
  var loadCommitACalled = false;
  var loadCommitBCalled = false;
  var maybeFinishTest = function(e) {
    if (loadCommitACalled && loadCommitBCalled) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.succeed();
    }
  };
  var onLoadCommitA = function(e) {
    if (e.url == url) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.assertTrue(e.isTopLevel);
      embedder.test.assertFalse(loadCommitACalled);
      loadCommitACalled = true;
      e.type = 'modified';
      maybeFinishTest(e);
    }
  };
  var onLoadCommitB = function(e) {
    if (e.url == url) {
      embedder.test.assertEq('loadcommit', e.type);
      embedder.test.assertTrue(e.isTopLevel);
      embedder.test.assertFalse(loadCommitBCalled);
      loadCommitBCalled = true;
      e.type = 'modified';
      maybeFinishTest(e);
    }
  };
  webview.addEventListener('loadcommit', onLoadCommitA);
  webview.addEventListener('loadcommit', onLoadCommitB);
  webview.setAttribute('src', url);
  document.body.appendChild(webview);
}
function testCannotMutateEventName ( ) { var webview = document . createElement ( 'webview' ) ; var url = 'data:text/html,<body>Two</body>' ; var loadCommitACalled = false ; var loadCommitBCalled = false ; var maybeFinishTest = function ( e ) { if ( loadCommitACalled && loadCommitBCalled ) { embedder . test . assertEq ( 'loadcommit' , e . type ) ; embedder . test . succeed ( ) ; } } ; var onLoadCommitA = function ( e ) { if ( e . url == url ) { embedder . test . assertEq ( 'loadcommit' , e . type ) ; embedder . test . assertTrue ( e . isTopLevel ) ; embedder . test . assertFalse ( loadCommitACalled ) ; loadCommitACalled = true ; e . type = 'modified' ; maybeFinishTest ( e ) ; } } ; var onLoadCommitB = function ( e ) { if ( e . url == url ) { embedder . test . assertEq ( 'loadcommit' , e . type ) ; embedder . test . assertTrue ( e . isTopLevel ) ; embedder . test . assertFalse ( loadCommitBCalled ) ; loadCommitBCalled = true ; e . type = 'modified' ; maybeFinishTest ( e ) ; } } ; webview . addEventListener ( 'loadcommit' , onLoadCommitA ) ; webview . addEventListener ( 'loadcommit' , onLoadCommitB ) ; webview . setAttribute ( 'src' , url ) ; document . body . appendChild ( webview ) ; }
which should not be possible.
which should not be possible .
// Try mucking with properities inside |e|. // Try mucking with properities inside |e|. // The test starts from here, by setting the src to |url|. Event // listener registration works because we already have a (dummy) src set // on the <webview> tag.