diff --git a/common/content/buffer.js b/common/content/buffer.js index 7298c8e5..c0806589 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -645,7 +645,8 @@ const Buffer = Module("buffer", { prefs.withContext(function () { prefs.set("browser.tabs.loadInBackground", true); - ["mousedown", "mouseup"].forEach(function (event) { + ["mousedown", "mouseup", "click"].slice(0, util.haveGecko("2.0") ? 2 : 3) + .forEach(function (event) { events.dispatch(elem, events.create(doc, event, { screenX: offsetX, screenY: offsetY, ctrlKey: ctrlKey, shiftKey: shiftKey, metaKey: ctrlKey diff --git a/common/content/events.js b/common/content/events.js index 04bb0dd1..73eca85b 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -364,11 +364,13 @@ const Events = Module("events", { * @param {Node} target The DOM node to which to dispatch the event. * @param {Event} event The event to dispatch. */ - dispatch: function (target, event) { - return target.ownerDocument.defaultView - .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) - .dispatchDOMEventViaPresShell(target, event, true); - }, + dispatch: Class.memoize(function () + util.haveGecko("2.0") + ? function (target, event) // This causes a crash on Gecko<2.0, it seems. + target.ownerDocument.defaultView + .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils) + .dispatchDOMEventViaPresShell(target, event, true) + : function (target, event) target.dispatchEvent(event)), /** * Converts an event string into an array of pseudo-event objects. diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 4e96d0ea..cb534236 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -52,6 +52,7 @@ const Services = Module("Services", { this.add("tagging", "@mozilla.org/browser/tagging-service;1", Ci.nsITaggingService); this.add("threading", "@mozilla.org/thread-manager;1", Ci.nsIThreadManager); this.add("urifixup", "@mozilla.org/docshell/urifixup;1", Ci.nsIURIFixup); + this.add("versionCompare", "@mozilla.org/xpcom/version-comparator;1", Ci.nsIVersionComparator); this.add("windowMediator", "@mozilla.org/appshell/window-mediator;1", Ci.nsIWindowMediator); this.add("windowWatcher", "@mozilla.org/embedcomp/window-watcher;1", Ci.nsIWindowWatcher); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index b91114c9..be3b04ad 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -466,6 +466,14 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) return null; }, + /** + * Returns true if the current Gecko runtime is of the given version + * or greater. + * + * @param {string} ver The required version. + */ + haveGecko: function (ver) services.get("versionCompare").compare(services.get("runtime").platformVersion, ver) >= 0, + /** * Sends a synchronous or asynchronous HTTP request to *url* and returns * the XMLHttpRequest object. If *callback* is specified the request is