fix up network loading bugs

This commit is contained in:
Stuart Parmenter 2009-07-22 06:12:02 -07:00
parent 600e926a00
commit b49ec38f3d
2 changed files with 23 additions and 19 deletions

View File

@ -248,11 +248,12 @@ var Browser = {
_selectedTab : null,
windowUtils: window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils),
_isStartup : true,
startup: function() {
var self = this;
dump("begin startup\n");
let container = document.getElementById("tile-container");
let bv = this._browserView = new BrowserView(container, getVisibleRect());
@ -331,6 +332,8 @@ var Browser = {
if (e.target != window)
return;
dump(window.innerWidth + "," + window.innerHeight + "\n");
// XXX is this code right here actually needed?
let w = window.innerWidth;
let maximize = (document.documentElement.getAttribute("sizemode") == "maximized");
if (maximize && w > screen.width)
@ -462,8 +465,10 @@ var Browser = {
this.setPluginState(true);
}
bv.commitBatchOperation();
dump("end startup\n");
},
shutdown: function() {
@ -520,6 +525,9 @@ var Browser = {
},
endLoading: function() {
if (!this._pageLoading)
alert("endLoading when page is already done\n");
this._pageLoading = false;
clearTimeout(this._loadingTimeout);
// in order to ensure we commit our current batch,
@ -1476,21 +1484,13 @@ ProgressController.prototype = {
}
},
_networkStop: function() {
_networkStop: function _networkStop() {
this._tab.setLoading(false);
if (Browser.selectedBrowser == this.browser) {
Browser.endLoading();
BrowserUI.update(TOOLBARSTATE_LOADED);
this.browser.docShell.isOffScreenBrowser = true;
if (Browser._isStartup) {
// force the urlbar into position
//ws.panTo(0, -BrowserUI.toolbarH);
// now we can set the viewport to a real size and draw the page
//ws.endUpdateBatch();
Browser._isStartup = false;
}
Browser.endLoading();
}
this._tab.updateThumbnail();
@ -1590,7 +1590,7 @@ Tab.prototype = {
load: function(uri) {
dump("cb set src\n");
this._browser.setAttribute("src", uri);
dump("cb set src\n");
dump("cb end src\n");
},
create: function() {
@ -1615,7 +1615,7 @@ Tab.prototype = {
let scaledHeight = kDefaultBrowserWidth * (window.innerHeight / window.innerWidth);
let browser = this._browser = document.createElement("browser");
browser.setAttribute("style", "overflow: hidden; visibility: hidden; width: " + kDefaultBrowserWidth + "px; height: " + scaledHeight + "px;");
browser.setAttribute("style", "overflow: -moz-hidden-unscrollable; visibility: hidden; width: " + kDefaultBrowserWidth + "px; height: " + scaledHeight + "px;");
browser.setAttribute("type", "content");
// Attach the popup contextmenu
@ -1628,6 +1628,9 @@ Tab.prototype = {
// Append the browser to the document, which should start the page load
document.getElementById("browsers").appendChild(browser);
// stop about:blank from loading
browser.stop();
// Attach a separate progress listener to the browser
this._listener = new ProgressController(this);
browser.addProgressListener(this._listener);

View File

@ -180,8 +180,8 @@
<scrollbox id="scrollbox" style="-moz-box-orient: vertical; overflow: scroll;" top="0" left="0" flex="1">
<scrollbox id="scrollbox" style="overflow: scroll;" top="0" left="0" flex="1">
<vbox>
<!-- Main Toolbar -->
<toolbar id="toolbar-main" class="panel-dark" style="width: 800px;">
<hbox id="urlbar-container" flex="1">
@ -242,9 +242,11 @@
<toolbarbutton id="tool-panel-open" class="page-button button-image" command="cmd_panel"/>
</vbox>
</hbox>
</vbox>
</scrollbox>
<stack>
<stack flex="1">
<notificationbox id="notifications" top="0" left="0"/>
<!-- popup for find toolbar -->
@ -444,9 +446,8 @@
</hbox>
</stack>
<box>
<html:div style="position: relative; overflow: hidden; max-width: 0px; max-height: 0px; visibility: hidden;">
<html:div style="position: relative; overflow: -moz-hidden-unscrollable; max-width: 0px; max-height: 0px; visibility: hidden;">
<html:div id="browsers" style="position: absolute;"/>
</html:div>
</box>