dom/events/Event-dispatch-click.html shouldn't depend on javascript: urls running synchronously

Bug: 638435
Change-Id: I25e5f54b90651309ced2c5e305c3725a31f8fd07
Reviewed-on: https://chromium-review.googlesource.com/c/1389503
Reviewed-by: Mike West <mkwst@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621648}
diff --git a/dom/events/Event-dispatch-click.html b/dom/events/Event-dispatch-click.html
index 4aa4bbe..2241d57 100644
--- a/dom/events/Event-dispatch-click.html
+++ b/dom/events/Event-dispatch-click.html
@@ -74,17 +74,17 @@
   t.done()
 }, "pick the first with activation behavior <input type=checkbox>")
 
-var globalCounter = 0 // sorry
 async_test(function(t) { // as above with <a>
-  var i = 0
+  window.hrefComplete = t.step_func(function(a) {
+    assert_equals(a, 'child');
+    t.done();
+  });
   var link = document.createElement("a")
-  link.href = "javascript:(function(){globalCounter--})()" // must not be triggered
+  link.href = "javascript:hrefComplete('link')" // must not be triggered
   dump.appendChild(link)
   var child = link.appendChild(document.createElement("a"))
-  child.href = "javascript:(function(){globalCounter++})()"
+  child.href = "javascript:hrefComplete('child')"
   child.dispatchEvent(new MouseEvent("click", {bubbles:true}))
-  assert_equals(globalCounter, 1)
-  t.done()
 }, "pick the first with activation behavior <a href>")
 
 async_test(function(t) {