aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2011-09-21 14:10:34 +0200
committerIgor Minar2011-09-26 23:51:54 +0200
commitea3228e311a22d5f917ca7135ee4d68738a6dfb4 (patch)
tree1a4e38059d465f303ef548167a48546f1c65580e
parent2eb49147d69fe930714578dd7aa13f8d5e3a6d49 (diff)
downloadangular.js-ea3228e311a22d5f917ca7135ee4d68738a6dfb4.tar.bz2
fix(scenario): workaround for FF6 dispatchEvent issue #684208
-rw-r--r--src/scenario/Scenario.js23
-rw-r--r--src/service/location.js2
2 files changed, 23 insertions, 2 deletions
diff --git a/src/scenario/Scenario.js b/src/scenario/Scenario.js
index 420345f6..5ee7bde4 100644
--- a/src/scenario/Scenario.js
+++ b/src/scenario/Scenario.js
@@ -279,9 +279,28 @@ function browserTrigger(element, type) {
}
return ret;
} else {
- var evnt = document.createEvent('MouseEvents');
+ var evnt = document.createEvent('MouseEvents'),
+ originalPreventDefault = evnt.preventDefault,
+ iframe = _jQuery('#application iframe')[0],
+ appWindow = iframe ? iframe.contentWindow : window,
+ fakeProcessDefault = true,
+ finalProcessDefault;
+
+ // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208
+ appWindow.angular['ff-684208-preventDefault'] = false;
+ evnt.preventDefault = function() {
+ fakeProcessDefault = false;
+ return originalPreventDefault.apply(evnt, arguments);
+ };
+
evnt.initMouseEvent(type, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
- return element.dispatchEvent(evnt);
+
+ element.dispatchEvent(evnt);
+ finalProcessDefault = !(appWindow.angular['ff-684208-preventDefault'] || !fakeProcessDefault)
+
+ delete appWindow.angular['ff-684208-preventDefault'];
+
+ return finalProcessDefault;
}
}
diff --git a/src/service/location.js b/src/service/location.js
index 644b4aaa..de359220 100644
--- a/src/service/location.js
+++ b/src/service/location.js
@@ -461,6 +461,8 @@ angularServiceInject('$location', function($browser, $sniffer, $config, $documen
currentUrl.url(href);
scope.$apply();
event.preventDefault();
+ // hack to work around FF6 bug 684208 when scenario runner clicks on links
+ window.angular['ff-684208-preventDefault'] = true;
});
} else {
currentUrl = new LocationHashbangUrl(initUrl, hashPrefix);