Bug 690011 - Do not initialize the urlbar binding until the UI get activated [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2011-09-28 14:09:00 -04:00
parent c4a996026b
commit 45eb9818b0
3 changed files with 16 additions and 4 deletions

View File

@ -399,14 +399,25 @@ var BrowserUI = {
}, },
init: function() { init: function() {
this._edit = document.getElementById("urlbar-edit"); let edit = this._edit = document.getElementById("urlbar-edit");
this._title = document.getElementById("urlbar-title"); this._title = document.getElementById("urlbar-title");
this._throbber = document.getElementById("urlbar-throbber"); this._throbber = document.getElementById("urlbar-throbber");
this._favicon = document.getElementById("urlbar-favicon"); this._favicon = document.getElementById("urlbar-favicon");
this._favicon.addEventListener("error", this, false); this._favicon.addEventListener("error", this, false);
this._edit.addEventListener("click", this, false); edit.addEventListener("click", this, false);
this._edit.addEventListener("mousedown", this, false);
// Delay urlbar binding initialization until the user interact with it
function urlbarBindOnFocus() {
if (!edit.hasAttribute("delaybinding"))
return;
window.removeEventListener("mousedown", urlbarBindOnFocus, true);
window.removeEventListener("keydown", urlbarBindOnFocus, true);
edit.removeAttribute("delaybinding");
};
window.addEventListener("mousedown", urlbarBindOnFocus, true);
window.addEventListener("keydown", urlbarBindOnFocus, true);
window.addEventListener("NavigationPanelShown", this, false); window.addEventListener("NavigationPanelShown", this, false);
window.addEventListener("NavigationPanelHidden", this, false); window.addEventListener("NavigationPanelHidden", this, false);

View File

@ -6,7 +6,7 @@ browser[remote="true"] {
-moz-binding: url("chrome://browser/content/bindings/browser.xml#remote-browser"); -moz-binding: url("chrome://browser/content/bindings/browser.xml#remote-browser");
} }
#urlbar-edit { #urlbar-edit:not([delaybinding]) {
-moz-binding: url("chrome://browser/content/bindings.xml#autocomplete-aligned"); -moz-binding: url("chrome://browser/content/bindings.xml#autocomplete-aligned");
} }

View File

@ -253,6 +253,7 @@
placeholder="&urlbar.emptytext;" placeholder="&urlbar.emptytext;"
collapsed="true" collapsed="true"
flex="1" flex="1"
delaybinding="true"
readonly="true" readonly="true"
ontextentered="BrowserUI.goToURI();" ontextentered="BrowserUI.goToURI();"
clickSelectsAll="true"/> clickSelectsAll="true"/>