commit bbbc8991f2510a48ecb841c77d04ac96d9a32895
parent 18f7bf1112bb10f53878e31cb73928bfcac17293
Author: Simon Kornblith <simon@simonster.com>
Date: Fri, 12 Aug 2011 18:10:53 +0000
- Fix failure to save snapshots, caused by failure to add and remove our request from loadGroup
- Fix a few other issues in ConnectorChannel
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js
@@ -353,7 +353,8 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
var pageShowCalled = false;
var cookieSandbox = new Zotero.CookieSandbox(browser, data["url"], data["cookie"]);
browser.addEventListener("pageshow", function() {
- if(browser.contentDocument.location.href == "about:blank") return;
+ if(browser.contentDocument.location.href == "about:blank"
+ || browser.contentDocument.readyState !== "complete") return;
if(pageShowCalled) return;
pageShowCalled = true;
delete Zotero.Server.Connector.Data[data["url"]];
diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js
@@ -967,7 +967,7 @@ function ChromeExtensionHandler() {
ConnectorChannel.prototype.contentCharset = "UTF-8";
ConnectorChannel.prototype.contentType = "text/html";
- ConnectorChannel.prototype.notificationCallbacks = {};
+ ConnectorChannel.prototype.notificationCallbacks = null;
ConnectorChannel.prototype.securityInfo = null;
ConnectorChannel.prototype.status = 0;
ConnectorChannel.prototype.loadGroup = null;
@@ -978,10 +978,12 @@ function ChromeExtensionHandler() {
ConnectorChannel.prototype.__defineSetter__("originalURI", function() { });
ConnectorChannel.prototype.asyncOpen = function(streamListener, context) {
+ if(this.loadGroup) this.loadGroup.addRequest(this, null);
streamListener.onStartRequest(this, context);
streamListener.onDataAvailable(this, context, this._stream, 0, this.contentLength);
streamListener.onStopRequest(this, context, this.status);
this._isPending = false;
+ if(this.loadGroup) this.loadGroup.removeRequest(this, null, 0);
}
ConnectorChannel.prototype.isPending = function() {
@@ -994,13 +996,9 @@ function ChromeExtensionHandler() {
if(this._stream) this._stream.close();
}
- ConnectorChannel.prototype.suspend = function(status) {
- this.status = status;
- }
+ ConnectorChannel.prototype.suspend = function() {}
- ConnectorChannel.prototype.resume = function(status) {
- this.status = status;
- }
+ ConnectorChannel.prototype.resume = function() {}
ConnectorChannel.prototype.open = function() {
return this._stream;