Bug 1147235 - Use AppConstants in urlbarBindings.xml (r=gavin)

This commit is contained in:
Bill McCloskey 2015-03-17 11:43:35 -07:00
parent 9cfbb2049f
commit b4eb3c2229
2 changed files with 21 additions and 16 deletions

View File

@ -1,9 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
# -*- Mode: HTML -*- <!--
# This Source Code Form is subject to the terms of the Mozilla Public -*- Mode: HTML -*-
# License, v. 2.0. If a copy of the MPL was not distributed with this This Source Code Form is subject to the terms of the Mozilla Public
# file, You can obtain one at http://mozilla.org/MPL/2.0/. License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<!DOCTYPE bindings [ <!DOCTYPE bindings [
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd"> <!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
@ -49,6 +51,9 @@
</content> </content>
<implementation implements="nsIObserver, nsIDOMEventListener"> <implementation implements="nsIObserver, nsIDOMEventListener">
<field name="AppConstants" readonly="true">
(Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
</field>
<constructor><![CDATA[ <constructor><![CDATA[
this._prefs = Components.classes["@mozilla.org/preferences-service;1"] this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService) .getService(Components.interfaces.nsIPrefService)
@ -403,11 +408,9 @@
// and only if we get a keyboard event, to match user expectations. // and only if we get a keyboard event, to match user expectations.
if (/^\s*[^.:\/\s]+(?:\/.*|\s*)$/i.test(url) && if (/^\s*[^.:\/\s]+(?:\/.*|\s*)$/i.test(url) &&
(aTriggeringEvent instanceof KeyEvent)) { (aTriggeringEvent instanceof KeyEvent)) {
#ifdef XP_MACOSX let accel = this.AppConstants.platform == "macosx" ?
let accel = aTriggeringEvent.metaKey; aTriggeringEvent.metaKey :
#else aTriggeringEvent.ctrlKey;
let accel = aTriggeringEvent.ctrlKey;
#endif
let shift = aTriggeringEvent.shiftKey; let shift = aTriggeringEvent.shiftKey;
let suffix = ""; let suffix = "";
@ -937,6 +940,10 @@
<!-- Note: this binding is applied to the autocomplete popup used in the Search bar and in web page content --> <!-- Note: this binding is applied to the autocomplete popup used in the Search bar and in web page content -->
<binding id="browser-autocomplete-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup"> <binding id="browser-autocomplete-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
<implementation> <implementation>
<field name="AppConstants" readonly="true">
(Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
</field>
<method name="openAutocompletePopup"> <method name="openAutocompletePopup">
<parameter name="aInput"/> <parameter name="aInput"/>
<parameter name="aElement"/> <parameter name="aElement"/>
@ -989,13 +996,11 @@
var where = whereToOpenLink(aEvent, false, true); var where = whereToOpenLink(aEvent, false, true);
// But open ctrl/cmd clicks on autocomplete items in a new background tab. // But open ctrl/cmd clicks on autocomplete items in a new background tab.
let modifier = this.AppConstants.platform == "macosx" ?
aEvent.metaKey :
aEvent.ctrlKey;
if (where == "tab" && (aEvent instanceof MouseEvent) && if (where == "tab" && (aEvent instanceof MouseEvent) &&
(aEvent.button == 1 || (aEvent.button == 1 || modifier))
#ifdef XP_MACOSX
aEvent.metaKey))
#else
aEvent.ctrlKey))
#endif
where = "tab-background"; where = "tab-background";
searchBar.doSearch(search, where); searchBar.doSearch(search, where);

View File

@ -144,7 +144,7 @@ browser.jar:
content/browser/searchSuggestionUI.css (content/searchSuggestionUI.css) content/browser/searchSuggestionUI.css (content/searchSuggestionUI.css)
content/browser/tabbrowser.css (content/tabbrowser.css) content/browser/tabbrowser.css (content/tabbrowser.css)
content/browser/tabbrowser.xml (content/tabbrowser.xml) content/browser/tabbrowser.xml (content/tabbrowser.xml)
* content/browser/urlbarBindings.xml (content/urlbarBindings.xml) content/browser/urlbarBindings.xml (content/urlbarBindings.xml)
* content/browser/utilityOverlay.js (content/utilityOverlay.js) * content/browser/utilityOverlay.js (content/utilityOverlay.js)
content/browser/web-panels.js (content/web-panels.js) content/browser/web-panels.js (content/web-panels.js)
* content/browser/web-panels.xul (content/web-panels.xul) * content/browser/web-panels.xul (content/web-panels.xul)