bug 404066 - implement webprogress listeners for notificationboxes (SeaMonkey only), p=twanno@lycos.nl r+sr=Neil

git-svn-id: svn://10.0.0.236/trunk@239657 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kairo%kairo.at
2007-11-19 16:44:39 +00:00
parent 45dc5e3d89
commit 72b2d3e544
4 changed files with 45 additions and 18 deletions

View File

@@ -451,14 +451,7 @@
if (this.mBrowser.userTypedClear > 0)
this.mBrowser.userTypedValue = null;
if (this.mBlank)
return;
// XXX should be: removeAllNotifications(true) once bug 303327 is fixed
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow && aWebProgress.isLoadingDocument)
this.mBrowser.parentNode.removeAllNotifications(false);
if (this.mTabBrowser.mCurrentTab == this.mTab) {
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
var p = this.mTabBrowser.mProgressListeners[i];
if (p)

View File

@@ -12,7 +12,7 @@
<binding id="browser-notificationbox"
extends="chrome://global/content/bindings/notification.xml#notificationbox">
<implementation implements="nsIObserver">
<implementation implements="nsIObserver, nsIWebProgressListener">
<field name="_stringBundle" readonly="true">
<![CDATA[
Components.classes["@mozilla.org/intl/stringbundle;1"]
@@ -52,7 +52,36 @@
]]>
</getter>
</property>
<field name="_addedProgressListener">false</field>
<method name="addProgressListener">
<body>
<![CDATA[
if (this.activeBrowser && !this._addedProgressListener) {
this.activeBrowser.webProgress.addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
this._addedProgressListener = true;
}
]]>
</body>
</method>
<method name="onLocationChange">
<parameter name="aWebProgress" />
<parameter name="aRequest" />
<parameter name="aLocation" />
<body>
<![CDATA[
var errorPage = aRequest && !Components.isSuccessCode(aRequest.status);
if (aWebProgress.DOMWindow == this.activeBrowser.contentWindow &&
(aWebProgress.isLoadingDocument || errorPage)) {
// XXX should be: removeAllNotifications(true) once bug 303327 is fixed
this.removeAllNotifications(false);
}
]]>
</body>
</method>
<method name="observe">
<parameter name="aSubject" />
<parameter name="aTopic" />
@@ -131,7 +160,9 @@
<![CDATA[
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "xpinstall-install-blocked", false);
os.addObserver(this, "xpinstall-install-blocked", false);
this.addProgressListener();
]]>
</constructor>
@@ -140,7 +171,7 @@
this.destroy();
]]>
</destructor>
<field name="mDestroyed">false</field>
<!-- This is necessary because the destructor doesn't always get called when
@@ -152,6 +183,11 @@
return;
this.mDestroyed = true;
if (this._addedProgressListener) {
this.activeBrowser.webProgress.removeProgressListener(this);
this._addedProgressListener = false;
}
this._activeBrowser = null;
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);

View File

@@ -94,7 +94,7 @@ comm.jar:
#endif
#endif
#endif
* content/communicator/bindings/notification.xml (bindings/notification.xml)
content/communicator/bindings/notification.xml (bindings/notification.xml)
content/communicator/bindings/toolbar.xml (bindings/toolbar.xml)
* content/communicator/bindings/prefwindow.xml (bindings/prefwindow.xml)
content/communicator/bookmarks/addBookmark.js (bookmarks/addBookmark.js)

View File

@@ -303,6 +303,9 @@ function panel_loader() {
this.removeAttribute('collapsed');
// uncollapse the notificationbox element
this.parentNode.removeAttribute('collapsed');
// register a progress listener for the notificationbox,
// now that this browser has a docShell
this.parentNode.addProgressListener();
this.setAttribute('loadstate', 'loaded');
// hide the load area
this.parentNode.parentNode.firstChild.setAttribute('hidden', 'true');
@@ -429,9 +432,6 @@ function (force_reload)
if (!panel.is_persistent()) {
debug(" set src=about:blank");
iframe.setAttribute('src', 'about:blank');
// content will be reloaded: remove notifications
// to prevent them from showing when expanding the sidebar
notificationbox.removeAllNotifications(true);
}
} else {
var saved_src = iframe.getAttribute('content');
@@ -441,8 +441,6 @@ function (force_reload)
if (force_reload || (saved_src != src)) {
debug(" set src="+saved_src);
iframe.setAttribute('src', saved_src);
// content is being reloaded: remove notifications
notificationbox.removeAllNotifications(true);
if (gTimeoutID != null)
clearTimeout(gTimeoutID);