mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 883390 - Part 1.4 - Update urlbar more intelligently, use tasks in doOpenSearch like we do in goToURI. r=sfoster
--HG-- extra : rebase_source : 18cd879a7ca42ed197de49759574ea66cfb27e5d
This commit is contained in:
parent
36a547693c
commit
4308a5abec
@ -84,8 +84,10 @@ const WebProgress = {
|
||||
let spec = aJson.location;
|
||||
let location = spec.split("#")[0]; // Ignore fragment identifier changes.
|
||||
|
||||
if (aTab == Browser.selectedTab)
|
||||
if (aTab == Browser.selectedTab) {
|
||||
BrowserUI.updateURI();
|
||||
BrowserUI.update();
|
||||
}
|
||||
|
||||
let locationHasChanged = (location != aTab.browser.lastLocation);
|
||||
if (locationHasChanged) {
|
||||
@ -123,22 +125,15 @@ const WebProgress = {
|
||||
_networkStart: function _networkStart(aJson, aTab) {
|
||||
aTab.startLoading();
|
||||
|
||||
if (aTab == Browser.selectedTab) {
|
||||
if (aTab == Browser.selectedTab)
|
||||
BrowserUI.update(TOOLBARSTATE_LOADING);
|
||||
|
||||
// We should at least show something in the URLBar until
|
||||
// the load has progressed further along
|
||||
if (aTab.browser.currentURI.spec == "about:blank")
|
||||
BrowserUI.updateURI({ captionOnly: true });
|
||||
}
|
||||
},
|
||||
|
||||
_networkStop: function _networkStop(aJson, aTab) {
|
||||
aTab.endLoading();
|
||||
|
||||
if (aTab == Browser.selectedTab) {
|
||||
if (aTab == Browser.selectedTab)
|
||||
BrowserUI.update(TOOLBARSTATE_LOADED);
|
||||
}
|
||||
},
|
||||
|
||||
_windowStart: function _windowStart(aJson, aTab) {
|
||||
|
@ -294,10 +294,22 @@ var BrowserUI = {
|
||||
* Navigation
|
||||
*/
|
||||
|
||||
/* Updates the overall state of the toolbar, but not the URL bar. */
|
||||
update: function(aState) {
|
||||
let uri = this.getDisplayURI(Browser.selectedBrowser);
|
||||
StartUI.update(uri);
|
||||
|
||||
this._updateButtons();
|
||||
this._updateToolbar();
|
||||
},
|
||||
|
||||
/* Updates the URL bar. */
|
||||
updateURI: function(aOptions) {
|
||||
let uri = this.getDisplayURI(Browser.selectedBrowser);
|
||||
let cleanURI = Util.isURLEmpty(uri) ? "" : uri;
|
||||
this._edit.value = cleanURI;
|
||||
},
|
||||
|
||||
getDisplayURI: function(browser) {
|
||||
let uri = browser.currentURI;
|
||||
let spec = uri.spec;
|
||||
@ -316,23 +328,6 @@ var BrowserUI = {
|
||||
return spec;
|
||||
},
|
||||
|
||||
/* Set the location to the current content */
|
||||
updateURI: function(aOptions) {
|
||||
aOptions = aOptions || {};
|
||||
|
||||
let uri = this.getDisplayURI(Browser.selectedBrowser);
|
||||
let cleanURI = Util.isURLEmpty(uri) ? "" : uri;
|
||||
|
||||
this._edit.value = cleanURI;
|
||||
|
||||
if ("captionOnly" in aOptions && aOptions.captionOnly)
|
||||
return;
|
||||
|
||||
StartUI.update(uri);
|
||||
this._updateButtons();
|
||||
this._updateToolbar();
|
||||
},
|
||||
|
||||
goToURI: function(aURI) {
|
||||
aURI = aURI || this._edit.value;
|
||||
if (!aURI)
|
||||
@ -344,7 +339,7 @@ var BrowserUI = {
|
||||
Util.forceOnline();
|
||||
|
||||
BrowserUI.showContent(aURI);
|
||||
content.focus();
|
||||
Browser.selectedBrowser.focus();
|
||||
|
||||
Task.spawn(function() {
|
||||
let postData = {};
|
||||
@ -371,13 +366,17 @@ var BrowserUI = {
|
||||
|
||||
// Make sure we're online before attempting to load
|
||||
Util.forceOnline();
|
||||
BrowserUI.showContent();
|
||||
|
||||
BrowserUI.showContent();
|
||||
Browser.selectedBrowser.focus();
|
||||
|
||||
Task.spawn(function () {
|
||||
Browser.loadURI(submission.uri.spec, { postData: submission.postData });
|
||||
|
||||
// loadURI may open a new tab, so get the selectedBrowser afterward.
|
||||
Browser.selectedBrowser.userTypedValue = submission.uri.spec;
|
||||
this._titleChanged(Browser.selectedBrowser);
|
||||
BrowserUI._titleChanged(Browser.selectedBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
/*********************************
|
||||
|
@ -574,6 +574,7 @@ var Browser = {
|
||||
} else {
|
||||
// Update all of our UI to reflect the new tab's location
|
||||
BrowserUI.updateURI();
|
||||
BrowserUI.update();
|
||||
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("TabSelect", true, false);
|
||||
|
Loading…
Reference in New Issue
Block a user