Merged revisions 3080-3081,3084,3087-3088,3090,3092,3099-3103,3113-3114,3132,3134-3143,3145,3148-3151,3154-3159,3165,3174,3194,3234-3235,3239-3240,3244,3246-3254,3258-3262,3268,3270,3274,3279,3286-3288,3294-3295 from 1.0 branch via svnmerge
This commit is contained in:
parent
be2c8095c4
commit
f37d724a9e
40 changed files with 8402 additions and 1378 deletions
|
@ -73,6 +73,8 @@ function ChromeExtensionHandler() {
|
|||
var ReportExtension = new function(){
|
||||
this.newChannel = newChannel;
|
||||
|
||||
this.__defineGetter__('loadAsChrome', function () { return true; });
|
||||
|
||||
function newChannel(uri){
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
@ -413,7 +415,9 @@ function ChromeExtensionHandler() {
|
|||
|
||||
var TimelineExtension = new function(){
|
||||
this.newChannel = newChannel;
|
||||
|
||||
|
||||
this.__defineGetter__('loadAsChrome', function () { return true; });
|
||||
|
||||
/*
|
||||
queryString key abbreviations: intervals = i | dateType = t | timelineDate = d
|
||||
|
||||
|
@ -625,6 +629,8 @@ function ChromeExtensionHandler() {
|
|||
var AttachmentExtension = new function() {
|
||||
this.newChannel = newChannel;
|
||||
|
||||
this.__defineGetter__('loadAsChrome', function () { return false; });
|
||||
|
||||
function newChannel(uri) {
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
@ -638,15 +644,29 @@ function ChromeExtensionHandler() {
|
|||
var [id, fileName] = uri.path.substr(1).split('/');
|
||||
|
||||
if (parseInt(id) != id) {
|
||||
return _errorChannel("Attachment id not an integer");
|
||||
// Proxy annotation icons
|
||||
if (id.match(/^annotation.*\.(png|html|css|gif)$/)) {
|
||||
var chromeURL = 'chrome://zotero/skin/' + id;
|
||||
var file = Zotero.convertChromeURLToFile(chromeURL);
|
||||
if (!file.exists()) {
|
||||
Zotero.debug(file.path + " not found");
|
||||
Components.utils.reportError(file.path + " not found");
|
||||
return _errorChannel("File not found");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return _errorChannel("Attachment id not an integer");
|
||||
}
|
||||
}
|
||||
|
||||
var item = Zotero.Items.get(id);
|
||||
if (!item) {
|
||||
return _errorChannel("Item not found");
|
||||
if (!file) {
|
||||
var item = Zotero.Items.get(id);
|
||||
if (!item) {
|
||||
return _errorChannel("Item not found");
|
||||
}
|
||||
var file = item.getFile();
|
||||
}
|
||||
|
||||
var file = item.getFile();
|
||||
if (!file) {
|
||||
return _errorChannel("File not found");
|
||||
}
|
||||
|
@ -661,7 +681,7 @@ function ChromeExtensionHandler() {
|
|||
|
||||
var ph = Components.classes["@mozilla.org/network/protocol;1?name=file"].
|
||||
createInstance(Components.interfaces.nsIFileProtocolHandler);
|
||||
fileURI = ph.newFileURI(file);
|
||||
var fileURI = ph.newFileURI(file);
|
||||
var channel = ioService.newChannelFromURI(fileURI);
|
||||
return channel;
|
||||
}
|
||||
|
@ -688,7 +708,7 @@ function ChromeExtensionHandler() {
|
|||
*/
|
||||
var SelectExtension = new function(){
|
||||
this.newChannel = newChannel;
|
||||
|
||||
|
||||
function newChannel(uri) {
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
|
@ -745,8 +765,11 @@ ChromeExtensionHandler.prototype = {
|
|||
|
||||
defaultPort : -1,
|
||||
|
||||
protocolFlags : Components.interfaces.nsIProtocolHandler.URI_STD,
|
||||
|
||||
protocolFlags :
|
||||
Components.interfaces.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Components.interfaces.nsIProtocolHandler.URI_NOAUTH |
|
||||
Components.interfaces.nsIProtocolHandler.URI_IS_LOCAL_FILE,
|
||||
|
||||
allowPort : function(port, scheme) {
|
||||
return false;
|
||||
},
|
||||
|
@ -755,7 +778,6 @@ ChromeExtensionHandler.prototype = {
|
|||
var newURL = Components.classes["@mozilla.org/network/standard-url;1"]
|
||||
.createInstance(Components.interfaces.nsIStandardURL);
|
||||
newURL.init(1, -1, spec, charset, baseURI);
|
||||
|
||||
return newURL.QueryInterface(Components.interfaces.nsIURI);
|
||||
},
|
||||
|
||||
|
@ -771,11 +793,11 @@ ChromeExtensionHandler.prototype = {
|
|||
try {
|
||||
var uriString = uri.spec.toLowerCase();
|
||||
|
||||
for (extSpec in this._extensions) {
|
||||
for (var extSpec in this._extensions) {
|
||||
var ext = this._extensions[extSpec];
|
||||
|
||||
if (uriString.indexOf(extSpec) == 0) {
|
||||
if (this._systemPrincipal == null) {
|
||||
if (ext.loadAsChrome && this._systemPrincipal == null) {
|
||||
var chromeURI = chromeService.newURI(DUMMY_CHROME_URL, null, null);
|
||||
var chromeChannel = chromeService.newChannel(chromeURI);
|
||||
|
||||
|
@ -796,8 +818,8 @@ ChromeExtensionHandler.prototype = {
|
|||
chromeRequest.cancel(0x804b0002); // BINDING_ABORTED
|
||||
}
|
||||
|
||||
if (this._systemPrincipal != null) {
|
||||
// applying cached system principal to extension channel
|
||||
// Apply cached system principal to extension channel
|
||||
if (ext.loadAsChrome) {
|
||||
extChannel.owner = this._systemPrincipal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue